✨ feat(controlcenter): replace SVG icons with symbolic icons for Bluetooth and Wi-Fi, improving theming and state indication

This commit is contained in:
sankalp committed 2025-08-01 00:16:54 +05:45
1 parent d7287e50d4
commit 2cf16c98c5
3 files changed
+95 -41

No files matched your search

-1
View File
@@ -7,7 +7,6 @@
</BoxV>
<BoxH name="dnd-widget" style_classes="menu" h_expand="true">
<Ref>self.focus_widget</Ref>
<Svg path="config/assets/icons/dnd.svg" name="dnd-menu-icon"/>
</BoxH>
</BoxH>
<BoxV name="brightness-widget" style_classes="menu" h_expand="true">
+54 -37
View File
@@ -8,6 +8,7 @@ from fabric.widgets.centerbox import CenterBox
from fabric.widgets.label import Label
from fabric.widgets.scale import Scale
from fabric.widgets.svg import Svg
from fabric.widgets.image import Image
from gi.repository import Gdk, GLib
from modules.controlcenter.bluetooth import BluetoothConnections
@@ -51,8 +52,17 @@ class ModusControlCenter(Window):
audio_service.connect("changed", self.volume_changed)
self.wlan_label = Label(wlan, name="wifi-widget-label", h_align="start")
if bluetooth != "disabled":
if bluetooth.startswith("connected:"):
parts = bluetooth.split(":")
bluetooth_display = parts[1] if len(parts) >= 2 else "Connected"
else:
bluetooth_display = "On"
else:
bluetooth_display = "Off"
self.bluetooth_label = Label(
bluetooth, name="bluetooth-widget-label", h_align="start"
bluetooth_display, name="bluetooth-widget-label", h_align="start"
)
self.volume_scale = Scale(
value=volume,
@@ -103,24 +113,17 @@ class ModusControlCenter(Window):
self.has_bluetooth_open = False
self.has_wifi_open = False
self.bluetooth_svg = Svg(
svg_file=get_relative_path(
"../../config/assets/icons/bluetooth.svg"
if bluetooth == "On"
else "../../config/assets/icons/bluetooth-off.svg"
),
style_classes="icon",
self.bluetooth_svg = Image(
name="bluetooth-icon",
icon_name="bluetooth-symbolic",
size=24,
style_classes="connected" if bluetooth != "disabled" else "",
)
self.wifi_svg = (
Svg(
svg_file=get_relative_path("../../config/assets/icons/wifi.svg"),
style_classes="icon",
)
if wlan != "No Connection"
else Svg(
svg_file=get_relative_path("../../config/assets/icons/wifi-off.svg"),
style_classes="icon",
)
self.wifi_svg = Image(
name="wifi-icon",
icon_name="network-wireless-symbolic",
size=24,
style_classes="connected" if wlan != "No Connection" else "",
)
self.bluetooth_widget = Button(
@@ -169,7 +172,7 @@ class ModusControlCenter(Window):
self.focus_icon = Svg(
svg_file=get_relative_path("../../config/assets/icons/dnd-off.svg"),
style_classes="icon",
size=24,
)
self.focus_widget = Button(
@@ -249,9 +252,9 @@ class ModusControlCenter(Window):
modus_service.dont_disturb = self.focus_mode
self.focus_icon.set_from_file(
get_relative_path(
"../../config/assets/icons/dnd.svg"
"config/assets/icons/dnd.svg"
if self.focus_mode
else "../../config/assets/icons/dnd-off.svg"
else "config/assets/icons/dnd-off.svg"
)
)
@@ -342,24 +345,38 @@ class ModusControlCenter(Window):
)
def wlan_changed(self, _, wlan):
self.wifi_svg.set_from_file(
get_relative_path(
"../../config/assets/icons/wifi.svg"
if wlan != "No Connection"
else "../../config/assets/icons/wifi-off.svg"
)
)
GLib.idle_add(lambda: self.wlan_label.set_property("label", wlan))
if wlan != "No Connection":
self.wifi_svg.set_property("style-classes", "connected")
if wlan.startswith("connected:"):
parts = wlan.split(":")
if len(parts) >= 2:
wifi_name = parts[1]
GLib.idle_add(lambda: self.wlan_label.set_property("label", wifi_name))
else:
GLib.idle_add(lambda: self.wlan_label.set_property("label", "Connected"))
else:
GLib.idle_add(lambda: self.wlan_label.set_property("label", wlan))
else:
self.wifi_svg.set_property("style-classes", "")
GLib.idle_add(lambda: self.wlan_label.set_property("label", wlan))
def bluetooth_changed(self, _, bluetooth):
self.bluetooth_svg.set_from_file(
get_relative_path(
"../../config/assets/icons/bluetooth.svg"
if bluetooth == "On"
else "../../config/assets/icons/bluetooth-off.svg"
)
)
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", bluetooth))
if bluetooth != "disabled":
self.bluetooth_svg.set_property("style-classes", "connected")
if bluetooth.startswith("connected:"):
parts = bluetooth.split(":")
if len(parts) >= 2:
device_name = parts[1]
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", device_name))
else:
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", "Connected"))
elif bluetooth == "enabled":
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", "On"))
else:
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", "On"))
else:
self.bluetooth_svg.set_property("style-classes", "")
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", "Off"))
def audio_changed(self, *_):
pass
+41 -3
View File
@@ -19,10 +19,26 @@
padding: 10px;
}
.icon {
#focus-widget {
padding: 10px;
min-width: 100px;
}
#bluetooth-icon,
#wifi-icon {
background-color: #666666;
padding: 8px;
min-width: 24px;
min-height: 24px;
border-radius: 50%;
color: #ffffff;
opacity: 0.6;
}
#bluetooth-icon.connected,
#wifi-icon.connected {
background-color: #2369ff;
font-size: 15px;
padding: 20px 20px;
opacity: 1;
}
#bluetooth-widget-label,
@@ -65,6 +81,28 @@
background-color: #2369ff;
}
#device-icon.connecting {
background-color: #ff9500;
animation: pulse 1s infinite;
}
#device-icon.disconnecting {
background-color: #ff3b30;
animation: pulse 1s infinite;
}
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0.6;
}
100% {
opacity: 1;
}
}
#toggle-button {
min-width: 40px;
min-height: 20px;