🔧 chore(workspaces): update Workspaces and WorkspaceButton instances, remove Hyprland import

This commit is contained in:
sankalp committed 2025-06-22 18:47:25 +05:45
1 parent 822672c399
commit 8b4d829681
8 files changed
+219 -467

No files matched your search

+6 -21
View File
@@ -1,22 +1,19 @@
from fabric.widgets.box import Box
from fabric.widgets.button import Button
from fabric.widgets.label import Label
from fabric.widgets.overlay import Overlay
from fabric.widgets.circularprogressbar import CircularProgressBar
import config.data as data
import utils.icons as icons
from services.network import NetworkClient
from fabric.bluetooth import BluetoothClient
from fabric.widgets.box import Box
from fabric.widgets.button import Button
from fabric.widgets.circularprogressbar import CircularProgressBar
from fabric.widgets.label import Label
from fabric.widgets.overlay import Overlay
from services.network import NetworkClient
class WifiIndicator(Button):
def __init__(self, **kwargs):
super().__init__(name="button-bar-network", **kwargs)
# Initialize NetworkClient
self.network = NetworkClient()
# Create progress bar and wifi label
self.progress_bar = CircularProgressBar(
name="button-network",
size=28,
@@ -26,13 +23,10 @@ class WifiIndicator(Button):
)
self.wifi_label = Label(name="network-label", markup=icons.loader)
# Create overlay with progress bar and label
self.add(Overlay(child=self.progress_bar, overlays=self.wifi_label))
# Connect signals
self.network.connect("ready", self.on_network_ready)
# If already ready, set up signals immediately
if self.network.is_ready:
self.setup_signals()
@@ -40,27 +34,23 @@ class WifiIndicator(Button):
self.setup_signals()
def setup_signals(self):
# Connect to NetworkClient signals
self.network.connect("changed", self.on_network_changed)
self.network.connect("wifi-device-added", self.on_wifi_device_added)
self.network.connect("wifi-device-removed", self.on_wifi_device_removed)
self.network.connect("ethernet-device-added", self.on_ethernet_device_added)
self.network.connect("ethernet-device-removed", self.on_ethernet_device_removed)
# Connect to WiFi device if available
if self.network.wifi_device:
self.network.wifi_device.connect("changed", self.on_wifi_changed)
self.network.wifi_device.connect("ap-added", self.on_wifi_changed)
self.network.wifi_device.connect("ap-removed", self.on_wifi_changed)
# Connect to Ethernet device if available
if self.network.ethernet_device:
self.network.ethernet_device.connect("changed", self.on_ethernet_changed)
self.update_state()
def update_state(self):
# Check ethernet first
if (
self.network.ethernet_device
and self.network.ethernet_device.state == "activated"
@@ -71,7 +61,6 @@ class WifiIndicator(Button):
self.set_tooltip_text(tooltip)
return
# Then check wifi
if not self.network.wifi_device:
self.wifi_label.set_markup(icons.cloud_off)
self.progress_bar.value = 0
@@ -132,19 +121,15 @@ class BluetoothIndicator(Button):
def __init__(self, **kwargs):
super().__init__(name="button-bar-bluetooth", **kwargs)
# Initialize BluetoothClient
self.bluetooth = BluetoothClient()
# Create bluetooth label
self.bt_label = Label(name="bluetooth-label", markup=icons.loader)
self.add(self.bt_label)
# Connect signals
self.bluetooth.connect("changed", self.on_bluetooth_changed)
self.bluetooth.connect("device-added", self.on_device_added)
self.bluetooth.connect("device-removed", self.on_device_removed)
# Initial state update
self.update_state()
def update_state(self):