✨ feat(controlcenter): replace SVG icons with symbolic icons for Bluetooth and Wi-Fi, improving theming and state indication
This commit is contained in:
3 files changed
+95
-41
No files matched your search
@@ -7,7 +7,6 @@
|
|||||||
</BoxV>
|
</BoxV>
|
||||||
<BoxH name="dnd-widget" style_classes="menu" h_expand="true">
|
<BoxH name="dnd-widget" style_classes="menu" h_expand="true">
|
||||||
<Ref>self.focus_widget</Ref>
|
<Ref>self.focus_widget</Ref>
|
||||||
<Svg path="config/assets/icons/dnd.svg" name="dnd-menu-icon"/>
|
|
||||||
</BoxH>
|
</BoxH>
|
||||||
</BoxH>
|
</BoxH>
|
||||||
<BoxV name="brightness-widget" style_classes="menu" h_expand="true">
|
<BoxV name="brightness-widget" style_classes="menu" h_expand="true">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from fabric.widgets.centerbox import CenterBox
|
|||||||
from fabric.widgets.label import Label
|
from fabric.widgets.label import Label
|
||||||
from fabric.widgets.scale import Scale
|
from fabric.widgets.scale import Scale
|
||||||
from fabric.widgets.svg import Svg
|
from fabric.widgets.svg import Svg
|
||||||
|
from fabric.widgets.image import Image
|
||||||
from gi.repository import Gdk, GLib
|
from gi.repository import Gdk, GLib
|
||||||
|
|
||||||
from modules.controlcenter.bluetooth import BluetoothConnections
|
from modules.controlcenter.bluetooth import BluetoothConnections
|
||||||
@@ -51,8 +52,17 @@ class ModusControlCenter(Window):
|
|||||||
audio_service.connect("changed", self.volume_changed)
|
audio_service.connect("changed", self.volume_changed)
|
||||||
|
|
||||||
self.wlan_label = Label(wlan, name="wifi-widget-label", h_align="start")
|
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(
|
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(
|
self.volume_scale = Scale(
|
||||||
value=volume,
|
value=volume,
|
||||||
@@ -103,24 +113,17 @@ class ModusControlCenter(Window):
|
|||||||
self.has_bluetooth_open = False
|
self.has_bluetooth_open = False
|
||||||
self.has_wifi_open = False
|
self.has_wifi_open = False
|
||||||
|
|
||||||
self.bluetooth_svg = Svg(
|
self.bluetooth_svg = Image(
|
||||||
svg_file=get_relative_path(
|
name="bluetooth-icon",
|
||||||
"../../config/assets/icons/bluetooth.svg"
|
icon_name="bluetooth-symbolic",
|
||||||
if bluetooth == "On"
|
size=24,
|
||||||
else "../../config/assets/icons/bluetooth-off.svg"
|
style_classes="connected" if bluetooth != "disabled" else "",
|
||||||
),
|
|
||||||
style_classes="icon",
|
|
||||||
)
|
)
|
||||||
self.wifi_svg = (
|
self.wifi_svg = Image(
|
||||||
Svg(
|
name="wifi-icon",
|
||||||
svg_file=get_relative_path("../../config/assets/icons/wifi.svg"),
|
icon_name="network-wireless-symbolic",
|
||||||
style_classes="icon",
|
size=24,
|
||||||
)
|
style_classes="connected" if wlan != "No Connection" else "",
|
||||||
if wlan != "No Connection"
|
|
||||||
else Svg(
|
|
||||||
svg_file=get_relative_path("../../config/assets/icons/wifi-off.svg"),
|
|
||||||
style_classes="icon",
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.bluetooth_widget = Button(
|
self.bluetooth_widget = Button(
|
||||||
@@ -169,7 +172,7 @@ class ModusControlCenter(Window):
|
|||||||
|
|
||||||
self.focus_icon = Svg(
|
self.focus_icon = Svg(
|
||||||
svg_file=get_relative_path("../../config/assets/icons/dnd-off.svg"),
|
svg_file=get_relative_path("../../config/assets/icons/dnd-off.svg"),
|
||||||
style_classes="icon",
|
size=24,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.focus_widget = Button(
|
self.focus_widget = Button(
|
||||||
@@ -249,9 +252,9 @@ class ModusControlCenter(Window):
|
|||||||
modus_service.dont_disturb = self.focus_mode
|
modus_service.dont_disturb = self.focus_mode
|
||||||
self.focus_icon.set_from_file(
|
self.focus_icon.set_from_file(
|
||||||
get_relative_path(
|
get_relative_path(
|
||||||
"../../config/assets/icons/dnd.svg"
|
"config/assets/icons/dnd.svg"
|
||||||
if self.focus_mode
|
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):
|
def wlan_changed(self, _, wlan):
|
||||||
self.wifi_svg.set_from_file(
|
if wlan != "No Connection":
|
||||||
get_relative_path(
|
self.wifi_svg.set_property("style-classes", "connected")
|
||||||
"../../config/assets/icons/wifi.svg"
|
if wlan.startswith("connected:"):
|
||||||
if wlan != "No Connection"
|
parts = wlan.split(":")
|
||||||
else "../../config/assets/icons/wifi-off.svg"
|
if len(parts) >= 2:
|
||||||
)
|
wifi_name = parts[1]
|
||||||
)
|
GLib.idle_add(lambda: self.wlan_label.set_property("label", wifi_name))
|
||||||
GLib.idle_add(lambda: self.wlan_label.set_property("label", wlan))
|
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):
|
def bluetooth_changed(self, _, bluetooth):
|
||||||
self.bluetooth_svg.set_from_file(
|
if bluetooth != "disabled":
|
||||||
get_relative_path(
|
self.bluetooth_svg.set_property("style-classes", "connected")
|
||||||
"../../config/assets/icons/bluetooth.svg"
|
if bluetooth.startswith("connected:"):
|
||||||
if bluetooth == "On"
|
parts = bluetooth.split(":")
|
||||||
else "../../config/assets/icons/bluetooth-off.svg"
|
if len(parts) >= 2:
|
||||||
)
|
device_name = parts[1]
|
||||||
)
|
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", device_name))
|
||||||
GLib.idle_add(lambda: self.bluetooth_label.set_property("label", bluetooth))
|
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, *_):
|
def audio_changed(self, *_):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -19,10 +19,26 @@
|
|||||||
padding: 10px;
|
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;
|
background-color: #2369ff;
|
||||||
font-size: 15px;
|
opacity: 1;
|
||||||
padding: 20px 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#bluetooth-widget-label,
|
#bluetooth-widget-label,
|
||||||
@@ -65,6 +81,28 @@
|
|||||||
background-color: #2369ff;
|
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 {
|
#toggle-button {
|
||||||
min-width: 40px;
|
min-width: 40px;
|
||||||
min-height: 20px;
|
min-height: 20px;
|
||||||
|
|||||||
Reference in new issue
Block a user