diff --git a/config/assets/icons/1bluetooth.svg b/config/assets/icons/applets/bluetooth-clear.svg similarity index 100% rename from config/assets/icons/1bluetooth.svg rename to config/assets/icons/applets/bluetooth-clear.svg diff --git a/config/assets/icons/1bluetooth-off.svg b/config/assets/icons/applets/bluetooth-off-clear.svg similarity index 100% rename from config/assets/icons/1bluetooth-off.svg rename to config/assets/icons/applets/bluetooth-off-clear.svg diff --git a/config/assets/icons/applets/bluetooth-off.svg b/config/assets/icons/applets/bluetooth-off.svg new file mode 100644 index 0000000..39361e6 --- /dev/null +++ b/config/assets/icons/applets/bluetooth-off.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/config/assets/icons/applets/bluetooth.svg b/config/assets/icons/applets/bluetooth.svg new file mode 100644 index 0000000..a9b1960 --- /dev/null +++ b/config/assets/icons/applets/bluetooth.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/config/assets/icons/brightness.svg b/config/assets/icons/applets/brightness.svg similarity index 100% rename from config/assets/icons/brightness.svg rename to config/assets/icons/applets/brightness.svg diff --git a/config/assets/icons/dnd-off.svg b/config/assets/icons/applets/dnd-off.svg similarity index 100% rename from config/assets/icons/dnd-off.svg rename to config/assets/icons/applets/dnd-off.svg diff --git a/config/assets/icons/dnd.svg b/config/assets/icons/applets/dnd.svg similarity index 100% rename from config/assets/icons/dnd.svg rename to config/assets/icons/applets/dnd.svg diff --git a/config/assets/icons/wifi.svg b/config/assets/icons/applets/wifi-clear.svg similarity index 100% rename from config/assets/icons/wifi.svg rename to config/assets/icons/applets/wifi-clear.svg diff --git a/config/assets/icons/wifi-off.svg b/config/assets/icons/applets/wifi-off-clear.svg similarity index 100% rename from config/assets/icons/wifi-off.svg rename to config/assets/icons/applets/wifi-off-clear.svg diff --git a/config/assets/icons/applets/wifi-off.svg b/config/assets/icons/applets/wifi-off.svg new file mode 100644 index 0000000..4a379bb --- /dev/null +++ b/config/assets/icons/applets/wifi-off.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/config/assets/icons/applets/wifi.svg b/config/assets/icons/applets/wifi.svg new file mode 100644 index 0000000..b0303d8 --- /dev/null +++ b/config/assets/icons/applets/wifi.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/config/assets/icons/battery.svg b/config/assets/icons/battery.svg deleted file mode 100644 index 8c4ef65..0000000 --- a/config/assets/icons/battery.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/config/assets/icons/bluetooth-activated.svg b/config/assets/icons/bluetooth-activated.svg deleted file mode 100644 index e3ef1e1..0000000 --- a/config/assets/icons/bluetooth-activated.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/config/assets/icons/bluetooth-off.svg b/config/assets/icons/bluetooth-off.svg deleted file mode 100644 index b90cd7a..0000000 --- a/config/assets/icons/bluetooth-off.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/config/assets/icons/bluetooth.svg b/config/assets/icons/bluetooth.svg deleted file mode 100644 index f982699..0000000 --- a/config/assets/icons/bluetooth.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/config/assets/icons/brightness/brightness.svg b/config/assets/icons/brightness/brightness.svg new file mode 100755 index 0000000..bcc61ef --- /dev/null +++ b/config/assets/icons/brightness/brightness.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/config/assets/icons/imac.png b/config/assets/icons/imac.png deleted file mode 100644 index c344ad2..0000000 Binary files a/config/assets/icons/imac.png and /dev/null differ diff --git a/config/assets/icons/indicator.svg b/config/assets/icons/indicator.svg deleted file mode 100644 index db3bede..0000000 --- a/config/assets/icons/indicator.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/config/assets/icons/microphone.svg b/config/assets/icons/mic/microphone.svg similarity index 100% rename from config/assets/icons/microphone.svg rename to config/assets/icons/mic/microphone.svg diff --git a/config/assets/icons/chevron-left.svg b/config/assets/icons/misc/chevron-left.svg similarity index 100% rename from config/assets/icons/chevron-left.svg rename to config/assets/icons/misc/chevron-left.svg diff --git a/config/assets/icons/chevron-right.svg b/config/assets/icons/misc/chevron-right.svg similarity index 100% rename from config/assets/icons/chevron-right.svg rename to config/assets/icons/misc/chevron-right.svg diff --git a/config/assets/icons/control-center.svg b/config/assets/icons/misc/control-center.svg similarity index 100% rename from config/assets/icons/control-center.svg rename to config/assets/icons/misc/control-center.svg diff --git a/config/assets/icons/imac.svg b/config/assets/icons/misc/imac.svg similarity index 100% rename from config/assets/icons/imac.svg rename to config/assets/icons/misc/imac.svg diff --git a/config/assets/icons/logo.svg b/config/assets/icons/misc/logo.svg similarity index 100% rename from config/assets/icons/logo.svg rename to config/assets/icons/misc/logo.svg diff --git a/config/assets/icons/media-record.svg b/config/assets/icons/misc/media-record.svg similarity index 100% rename from config/assets/icons/media-record.svg rename to config/assets/icons/misc/media-record.svg diff --git a/config/assets/icons/1search.svg b/config/assets/icons/misc/search.svg similarity index 100% rename from config/assets/icons/1search.svg rename to config/assets/icons/misc/search.svg diff --git a/config/assets/icons/search.svg b/config/assets/icons/search.svg deleted file mode 100644 index 0ea0f28..0000000 --- a/config/assets/icons/search.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/config/assets/icons/audio-volume.svg b/config/assets/icons/volume/audio-volume.svg similarity index 100% rename from config/assets/icons/audio-volume.svg rename to config/assets/icons/volume/audio-volume.svg diff --git a/modules/about.py b/modules/about.py index 30e9e31..221659d 100644 --- a/modules/about.py +++ b/modules/about.py @@ -1,8 +1,13 @@ -import re import subprocess +import re +import gi # type: ignore -from fabric.utils.helpers import get_relative_path -from gi.repository import GdkPixbuf, Gtk # type: ignore +from fabric.widgets.label import Label +from fabric.widgets.button import Button +from fabric.widgets.box import Box +from widgets.wayland import WaylandWindow as Window +from fabric.utils.helpers import exec_shell_command_async, get_relative_path +from gi.repository import Gtk, GdkPixbuf # type: ignore def read_dmi(field): @@ -14,31 +19,32 @@ def read_dmi(field): def get_gpu_name(): - output = subprocess.check_output("lspci", text=True) - gpus = [] + try: + output = ( + subprocess.check_output( + "lspci -nn | grep -i 'VGA compatible controller'", shell=True, text=True + ) + .strip() + .split("\n") + ) - for line in output.splitlines(): - if "VGA compatible controller" in line or "3D controller" in line: - parts = line.split(":", 2) - if len(parts) < 3: - continue - desc = parts[2].strip() - desc = re.sub(r"\(rev .*?\)", "", desc).strip() + def clean(line): + matches = re.findall(r"\[(.*?)\]", line) + if len(matches) >= 2: + return matches[1].strip() + desc = line.split(":", 2)[-1] + return desc.replace("Corporation", "").strip() - if "NVIDIA" in desc: - match = re.search(r"\[(.*?)\]", desc) - name = match.group(1) if match else desc - elif "Intel" in desc: - name = re.sub(r"Intel Corporation", "Intel", desc).strip() - elif "AMD" in desc or "ATI" in desc: - matches = re.findall(r"\[(.*?)\]", desc) - name = matches[1] if len(matches) > 1 else desc - else: - name = desc + for line in output: + if any(vendor in line.lower() for vendor in ["nvidia", "amd", "radeon"]): + return clean(line) - gpus.append((name)) + if output: + return clean(output[0]) - return gpus[-1] + return "Unknown GPU" + except Exception: + return "Unknown GPU" class About(Gtk.Window): @@ -60,7 +66,7 @@ class About(Gtk.Window): # Logo logo_box = Gtk.Box(halign=Gtk.Align.CENTER, valign=Gtk.Align.CENTER) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale( - get_relative_path("../config/assets/icons/imac.svg"), + get_relative_path("../config/assets/icons/misc/imac.svg"), 158, 108, preserve_aspect_ratio=True, diff --git a/modules/controlcenter/main.py b/modules/controlcenter/main.py index 9361ed9..bd49bf1 100644 --- a/modules/controlcenter/main.py +++ b/modules/controlcenter/main.py @@ -113,17 +113,23 @@ class ModusControlCenter(Window): self.has_bluetooth_open = False self.has_wifi_open = False - self.bluetooth_svg = Image( + self.bluetooth_svg = Svg( name="bluetooth-icon", - icon_name="bluetooth-symbolic", - size=24, - style_classes="connected" if bluetooth != "disabled" else "", + svg_file=get_relative_path( + "../../config/assets/icons/applets/bluetooth.svg" + if bluetooth != "disabled" + else "../../config/assets/icons/applets/bluetooth-off.svg" + ), + size=42, ) - self.wifi_svg = Image( + self.wifi_svg = Svg( name="wifi-icon", - icon_name="network-wireless-symbolic", - size=24, - style_classes="connected" if wlan != "No Connection" else "", + svg_file=get_relative_path( + "../../config/assets/icons/applets/wifi.svg" + if wlan != "No Connection" + else "../../config/assets/icons/applets/wifi-off.svg" + ), + size=46, ) self.bluetooth_widget = Button( @@ -171,8 +177,9 @@ class ModusControlCenter(Window): ) self.focus_icon = Svg( - svg_file=get_relative_path("../../config/assets/icons/dnd-off.svg"), - size=24, + name="focus-icon", + svg_file=get_relative_path("../../config/assets/icons/applets/dnd-off.svg"), + size=46, ) self.focus_widget = Button( @@ -252,9 +259,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/applets/dnd.svg" if self.focus_mode - else "config/assets/icons/dnd-off.svg" + else "../../config/assets/icons/applets/dnd-off.svg" ) ) @@ -345,8 +352,14 @@ class ModusControlCenter(Window): ) def wlan_changed(self, _, wlan): + self.wifi_svg.set_from_file( + get_relative_path( + "../../config/assets/icons/applets/wifi.svg" + if wlan != "No Connection" + else "../../config/assets/icons/applets/wifi-off.svg" + ) + ) if wlan != "No Connection": - self.wifi_svg.set_property("style-classes", "connected") if wlan.startswith("connected:"): parts = wlan.split(":") if len(parts) >= 2: @@ -357,16 +370,21 @@ class ModusControlCenter(Window): 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/applets/bluetooth.svg" + if bluetooth != "disabled" + else "../../config/assets/icons/applets/bluetooth-off.svg" + ) + ) 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] + 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")) @@ -375,7 +393,6 @@ class ModusControlCenter(Window): 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, *_): diff --git a/modules/osd.py b/modules/osd.py index 8bc776b..4bc37b3 100644 --- a/modules/osd.py +++ b/modules/osd.py @@ -50,7 +50,7 @@ class BrightnessOSDContainer(Box): orientation="h", ) self.osd_window_image = Svg( - get_relative_path("../config/assets/icons/brightness.svg"), + get_relative_path("../config/assets/icons/brightness/brightness.svg"), size=(84, 150), name="osd-image", h_align="center", @@ -112,7 +112,7 @@ class AudioOSDContainer(Box): orientation="h", ) self.osd_window_image = Svg( - get_relative_path("../config/assets/icons/audio-volume.svg"), + get_relative_path("../config/assets/icons/volume/audio-volume.svg"), size=(64, 150), name="osd-image", h_align="center", @@ -253,7 +253,7 @@ class MicrophoneOSDContainer(Box): ) self.osd_window_image = Svg( - get_relative_path("../config/assets/icons/microphone.svg"), + get_relative_path("../config/assets/icons/mic/microphone.svg"), size=(64, 150), name="osd-image", h_align="center", diff --git a/modules/panel/components/indicators.py b/modules/panel/components/indicators.py index 44dd374..4b9618c 100644 --- a/modules/panel/components/indicators.py +++ b/modules/panel/components/indicators.py @@ -3,9 +3,8 @@ from fabric.utils import get_relative_path from fabric.widgets.box import Box from fabric.widgets.button import Button from fabric.widgets.svg import Svg - -from services.battery import Battery from services.network import NetworkService +from services.battery import Battery from utils.roam import modus_service @@ -17,7 +16,7 @@ class BluetoothIndicator(Box): self.bt_icon = Svg( name="bt-icon", size=20, - svg_file=get_relative_path("../../../config/assets/icons/bluetooth.svg"), + svg_file=get_relative_path("../../../config/assets/icons/applets/bluetooth-clear.svg"), ) self.bt_button = Button(name="bt-button", child=self.bt_icon) @@ -35,14 +34,14 @@ class BluetoothIndicator(Box): def update_state(self): if not self.bluetooth.enabled: self.bt_icon.set_from_file( - get_relative_path("../../../config/assets/icons/bluetooth-off.svg") + get_relative_path("../../../config/assets/icons/applets/bluetooth-off-clear.svg") ) tooltip = "Bluetooth disabled" else: connected_devices = self.bluetooth.connected_devices if connected_devices: self.bt_icon.set_from_file( - get_relative_path("../../../config/assets/icons/bluetooth.svg") + get_relative_path("../../../config/assets/icons/applets/bluetooth-clear.svg") ) if len(connected_devices) == 1: device = connected_devices[0] @@ -53,7 +52,7 @@ class BluetoothIndicator(Box): tooltip = f"Connected to {len(connected_devices)} devices" else: self.bt_icon.set_from_file( - get_relative_path("../../../config/assets/icons/bluetooth.svg") + get_relative_path("../../../config/assets/icons/applets/bluetooth-clear.svg") ) tooltip = "No devices connected" @@ -105,7 +104,7 @@ class NetworkIndicator(Box): self.network_icon = Svg( name="network-icon", size=22, - svg_file=get_relative_path("../../../config/assets/icons/wifi.svg"), + svg_file=get_relative_path("../../../config/assets/icons/applets/wifi-clear.svg"), ) self.network_button = Button(name="network-button", child=self.network_icon) @@ -177,26 +176,26 @@ class NetworkIndicator(Box): def update_state(self): primary_device = self.network_service.primary_device tooltip = "No network connection" - icon_file = "wifi-off.svg" + icon_file = "wifi-off-clear.svg" if primary_device == "wifi" and self.network_service.wifi_device: wifi = self.network_service.wifi_device if not wifi.enabled: - icon_file = "wifi-off.svg" + icon_file = "wifi-off-clear.svg" tooltip = "WiFi disabled" elif wifi.internet == "activated": - icon_file = "wifi.svg" + icon_file = "wifi-clear.svg" tooltip = f"Connected to {wifi.ssid}" if wifi.strength >= 0: tooltip += f" ({wifi.strength}%)" elif wifi.internet == "activating": - icon_file = "wifi.svg" + icon_file = "wifi-clear.svg" tooltip = f"Connecting to {wifi.ssid}..." elif wifi.internet in ["deactivating", "deactivated", "disconnected"]: - icon_file = "wifi-off.svg" + icon_file = "wifi-off-clear.svg" tooltip = "WiFi disconnected" else: - icon_file = "wifi-off.svg" + icon_file = "wifi-off-clear.svg" tooltip = "WiFi disconnected" elif primary_device == "wired" and self.network_service.ethernet_device: @@ -207,14 +206,14 @@ class NetworkIndicator(Box): if hasattr(ethernet, "speed") and ethernet.speed > 0: tooltip += f" ({ethernet.speed} Mbps)" elif ethernet.internet == "activating": - icon_file = "wifi.svg" + icon_file = "wifi-clear.svg" tooltip = "Ethernet connecting..." else: - icon_file = "wifi-off.svg" + icon_file = "wifi-off-clear.svg" tooltip = "Ethernet disconnected" self.network_icon.set_from_file( - get_relative_path(f"../../../config/assets/icons/{icon_file}") + get_relative_path(f"../../../config/assets/icons/applets/{icon_file}") ) self.network_button.set_tooltip_text(tooltip) @@ -228,7 +227,7 @@ class BatteryIndicator(Box): self.battery_icon = Svg( name="battery-icon", size=22, - svg_file=get_relative_path("../../../config/assets/icons/battery.svg"), + svg_file=get_relative_path("../../../config/assets/icons/battery/battery-100.svg"), ) self.battery_button = Button(name="battery-button", child=self.battery_icon) diff --git a/modules/panel/components/recording_indicator.py b/modules/panel/components/recording_indicator.py index cf2d515..1653395 100644 --- a/modules/panel/components/recording_indicator.py +++ b/modules/panel/components/recording_indicator.py @@ -28,7 +28,7 @@ class RecordingIndicator(Button): self.recording_icon = Svg( name="indicators-icon", size=24, - svg_file=get_relative_path("../../../config/assets/icons/media-record.svg"), + svg_file=get_relative_path("../../../config/assets/icons/misc/media-record.svg"), ) self.time_label = Label( name="recording-time-label", diff --git a/modules/panel/main.py b/modules/panel/main.py index 82a9570..2fac2eb 100644 --- a/modules/panel/main.py +++ b/modules/panel/main.py @@ -43,7 +43,7 @@ class Panel(Window): name="panel-button", child=Svg( size=22, - svg_file=get_relative_path("../../config/assets/icons/logo.svg"), + svg_file=get_relative_path("../../config/assets/icons/misc/logo.svg"), ), on_clicked=lambda *_: self.menubar.show_system_dropdown(self.imac), ) @@ -63,7 +63,7 @@ class Panel(Window): child=Svg( size=16, svg_file=get_relative_path( - "../../config/assets/icons/chevron-right.svg" + "../../config/assets/icons/misc/chevron-right.svg" ), ), on_clicked=self.toggle_tray, @@ -85,7 +85,7 @@ class Panel(Window): on_clicked=lambda *_: self.search_apps(), child=Svg( size=20, - svg_file=get_relative_path("../../config/assets/icons/search.svg"), + svg_file=get_relative_path("../../config/assets/icons/misc/search.svg"), ), ) @@ -100,7 +100,7 @@ class Panel(Window): child=Svg( size=22, svg_file=get_relative_path( - "../../config/assets/icons/control-center.svg" + "../../config/assets/icons/misc/control-center.svg" ), ), ) @@ -146,9 +146,9 @@ class Panel(Window): if self.tray_revealer.child_revealed: self.chevron_button.get_child().set_from_file( - get_relative_path("../../config/assets/icons/chevron-left.svg") + get_relative_path("../../config/assets/icons/misc/chevron-left.svg") ) else: self.chevron_button.get_child().set_from_file( - get_relative_path("../../config/assets/icons/chevron-right.svg") + get_relative_path("../../config/assets/icons/misc/chevron-right.svg") )