feat(panel): add Hyprland workspaces indicator with workspace filtering
This commit is contained in:
4 files changed
+29
-101
No files matched your search
@@ -1,44 +0,0 @@
|
||||
from fabric.hyprland.widgets import HyprlandWorkspaces, WorkspaceButton
|
||||
from fabric.widgets.box import Box
|
||||
import config.data as data
|
||||
from utils.functions import is_special_workspace_id
|
||||
|
||||
# TODO: Support Multi Monitor
|
||||
|
||||
|
||||
class WorkspaceIndicator(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(
|
||||
name="workspace-indicator", orientation="h", spacing=4, **kwargs
|
||||
)
|
||||
|
||||
# Create workspace widget with custom button factory if filtering is enabled
|
||||
if data.HIDE_SPECIAL_WORKSPACE:
|
||||
self.workspaces = HyprlandWorkspaces(
|
||||
name="workspaces",
|
||||
spacing=4,
|
||||
buttons_factory=self._create_filtered_button,
|
||||
)
|
||||
else:
|
||||
self.workspaces = HyprlandWorkspaces(
|
||||
name="workspaces",
|
||||
spacing=4,
|
||||
buttons_factory=lambda ws_id: WorkspaceButton(
|
||||
id=ws_id, label=str(ws_id)
|
||||
),
|
||||
)
|
||||
|
||||
self.add(self.workspaces)
|
||||
self.show_all()
|
||||
|
||||
def _is_special_workspace_id(self, ws_id):
|
||||
return is_special_workspace_id(ws_id)
|
||||
|
||||
def _create_filtered_button(self, ws_id):
|
||||
if data.HIDE_SPECIAL_WORKSPACE and self._is_special_workspace_id(ws_id):
|
||||
# Return None or an empty widget to hide special workspaces
|
||||
return None
|
||||
|
||||
return WorkspaceButton(id=ws_id, label=str(ws_id))
|
||||
|
||||
|
||||
+15
-8
@@ -1,3 +1,4 @@
|
||||
from fabric.hyprland.widgets import HyprlandWorkspaces, WorkspaceButton
|
||||
from fabric.system_tray.widgets import SystemTray
|
||||
from fabric.utils import get_relative_path
|
||||
from fabric.widgets.box import Box
|
||||
@@ -6,6 +7,8 @@ from fabric.widgets.centerbox import CenterBox
|
||||
from fabric.widgets.datetime import DateTime
|
||||
from fabric.widgets.revealer import Revealer
|
||||
from fabric.widgets.svg import Svg
|
||||
|
||||
import config.data as data
|
||||
from modules.controlcenter.main import ModusControlCenter
|
||||
from modules.notification.notification_center import NotificationCenter
|
||||
from modules.panel.components.enhanced_system_tray import apply_enhanced_system_tray
|
||||
@@ -16,12 +19,12 @@ from modules.panel.components.indicators import (
|
||||
)
|
||||
from modules.panel.components.menubar import MenuBar
|
||||
from modules.panel.components.recording_indicator import RecordingIndicator
|
||||
from modules.panel.components.workspace import WorkspaceIndicator
|
||||
from modules.todo.todo_widget import TodoListCapture
|
||||
from services.modus import notification_service
|
||||
from utils.functions import is_special_workspace_id
|
||||
from utils.roam import modus_service
|
||||
from widgets.mousecapture import MouseCapture
|
||||
from widgets.wayland import WaylandWindow as Window
|
||||
from services.modus import notification_service
|
||||
|
||||
# Apply enhanced system tray icon handling
|
||||
apply_enhanced_system_tray()
|
||||
@@ -41,6 +44,16 @@ class Panel(Window):
|
||||
self.launcher = kwargs.get("launcher", None)
|
||||
self.menubar = MenuBar(parent_window=self)
|
||||
|
||||
self.workspace_indicator = HyprlandWorkspaces(
|
||||
name="workspaces",
|
||||
spacing=4,
|
||||
buttons_factory=lambda ws_id: (
|
||||
None
|
||||
if data.HIDE_SPECIAL_WORKSPACE and is_special_workspace_id(ws_id)
|
||||
else WorkspaceButton(id=ws_id, label=str(ws_id))
|
||||
),
|
||||
)
|
||||
|
||||
self.imac = Button(
|
||||
name="panel-button",
|
||||
child=Svg(
|
||||
@@ -50,10 +63,7 @@ class Panel(Window):
|
||||
on_clicked=lambda *_: self.menubar.show_system_dropdown(self.imac),
|
||||
)
|
||||
|
||||
# DND indicator - REMOVED
|
||||
|
||||
self.tray = SystemTray(name="system-tray", spacing=4, icon_size=20)
|
||||
|
||||
self.tray_revealer = Revealer(
|
||||
name="tray-revealer",
|
||||
child=self.tray,
|
||||
@@ -140,9 +150,6 @@ class Panel(Window):
|
||||
|
||||
self.recording_indicator = RecordingIndicator()
|
||||
|
||||
# Workspace indicator
|
||||
self.workspace_indicator = WorkspaceIndicator()
|
||||
|
||||
self.children = CenterBox(
|
||||
name="panel",
|
||||
start_children=Box(
|
||||
|
||||
Reference in new issue
Block a user