From 924b46fb893c3657a97bb91eea8267e1f5b776b7 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Wed, 11 Jun 2025 16:28:51 +0545 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20config,=20dock:=20update=20dock?= =?UTF-8?q?=20position,=20remove=20pinned=20apps=20from=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.json | 128 +++++++++++++++++------------------ config/dock.json | 17 +---- modules/dock/applications.py | 28 ++++---- modules/dock/components.py | 50 ++++++++------ modules/dock/main.py | 5 -- styles/components.css | 22 ++++-- styles/controls.css | 5 +- styles/dock.css | 4 ++ styles/indicators.css | 61 ++++++++--------- 9 files changed, 158 insertions(+), 162 deletions(-) diff --git a/config/config.json b/config/config.json index ea8cca1..02ed270 100644 --- a/config/config.json +++ b/config/config.json @@ -1,66 +1,64 @@ { - "prefix_restart": "SUPER ALT", - "suffix_restart": "B", - "prefix_axmsg": "SUPER", - "suffix_axmsg": "A", - "prefix_dash": "SUPER", - "suffix_dash": "D", - "prefix_bluetooth": "SUPER SHIFT", - "suffix_bluetooth": "B", - "prefix_pins": "SUPER", - "suffix_pins": "Q", - "prefix_kanban": "SUPER", - "suffix_kanban": "N", - "prefix_launcher": "SUPER", - "suffix_launcher": "R", - "prefix_tmux": "SUPER", - "suffix_tmux": "T", - "prefix_cliphist": "SUPER", - "suffix_cliphist": "V", - "prefix_toolbox": "SUPER", - "suffix_toolbox": "S", - "prefix_overview": "SUPER", - "suffix_overview": "TAB", - "prefix_wallpapers": "SUPER", - "suffix_wallpapers": "COMMA", - "prefix_randwall": "SUPER SHIFT", - "suffix_randwall": "COMMA", - "prefix_emoji": "SUPER", - "suffix_emoji": "PERIOD", - "prefix_power": "SUPER", - "suffix_power": "ESCAPE", - "prefix_caffeine": "SUPER SHIFT", - "suffix_caffeine": "M", - "prefix_css": "SUPER SHIFT", - "suffix_css": "B", - "prefix_restart_inspector": "SUPER CTRL ALT", - "suffix_restart_inspector": "B", - "wallpapers_dir": "/home/sankalp/Pictures/wallpapers", - "dock_position": "Left", - "vertical": true, - "dock_enabled": true, - "dock_auto_hide": true, - "dock_always_occluded": false, - "dock_icon_size": 20, - "terminal_command": "kitty -e", - "corners_visible": true, - "dock_theme": "Pills", - "notif_pos": "Top", - "dock_workspace_visible": true, - "dock_metrics_visible": true, - "dock_date_time_visible": true, - "dock_battery_visible": true, - "dock_controls_visible": true, - "dock_indicators_visible": true, - "dock_applications_visible": true, - "metrics_visible": { - "cpu": true, - "ram": true, - "swap": true, - "disk": false, - "gpu": false - }, - "metrics_disks": [ - "/" - ] -} \ No newline at end of file + "prefix_restart": "SUPER ALT", + "suffix_restart": "B", + "prefix_axmsg": "SUPER", + "suffix_axmsg": "A", + "prefix_dash": "SUPER", + "suffix_dash": "D", + "prefix_bluetooth": "SUPER SHIFT", + "suffix_bluetooth": "B", + "prefix_pins": "SUPER", + "suffix_pins": "Q", + "prefix_kanban": "SUPER", + "suffix_kanban": "N", + "prefix_launcher": "SUPER", + "suffix_launcher": "R", + "prefix_tmux": "SUPER", + "suffix_tmux": "T", + "prefix_cliphist": "SUPER", + "suffix_cliphist": "V", + "prefix_toolbox": "SUPER", + "suffix_toolbox": "S", + "prefix_overview": "SUPER", + "suffix_overview": "TAB", + "prefix_wallpapers": "SUPER", + "suffix_wallpapers": "COMMA", + "prefix_randwall": "SUPER SHIFT", + "suffix_randwall": "COMMA", + "prefix_emoji": "SUPER", + "suffix_emoji": "PERIOD", + "prefix_power": "SUPER", + "suffix_power": "ESCAPE", + "prefix_caffeine": "SUPER SHIFT", + "suffix_caffeine": "M", + "prefix_css": "SUPER SHIFT", + "suffix_css": "B", + "prefix_restart_inspector": "SUPER CTRL ALT", + "suffix_restart_inspector": "B", + "wallpapers_dir": "/home/sankalp/Pictures/wallpapers", + "dock_position": "Bottom", + "vertical": false, + "dock_enabled": true, + "dock_auto_hide": true, + "dock_always_occluded": false, + "dock_icon_size": 20, + "terminal_command": "kitty -e", + "corners_visible": true, + "dock_theme": "Pills", + "notif_pos": "Top", + "dock_workspace_visible": true, + "dock_metrics_visible": true, + "dock_date_time_visible": true, + "dock_battery_visible": true, + "dock_controls_visible": true, + "dock_indicators_visible": true, + "dock_applications_visible": true, + "metrics_visible": { + "cpu": true, + "ram": true, + "swap": true, + "disk": false, + "gpu": false + }, + "metrics_disks": ["/"] +} diff --git a/config/dock.json b/config/dock.json index 80767a6..7564bbf 100644 --- a/config/dock.json +++ b/config/dock.json @@ -1,18 +1,3 @@ { - "pinned_apps": [ - { - "name": "kitty", - "display_name": "kitty", - "window_class": null, - "executable": "kitty", - "command_line": "kitty" - }, - { - "name": "Visual Studio Code", - "display_name": "Visual Studio Code", - "window_class": "Code", - "executable": "/usr/bin/code", - "command_line": "/usr/bin/code %F" - } - ] + "pinned_apps": [] } \ No newline at end of file diff --git a/modules/dock/applications.py b/modules/dock/applications.py index 512d544..971fda5 100644 --- a/modules/dock/applications.py +++ b/modules/dock/applications.py @@ -69,10 +69,10 @@ class Applications(Box): super().__init__( name="applications-dock", orientation=orientation_val, spacing=4, **kwargs ) - + # Store reference to the dock instance self.dock_instance = dock_instance - + self.config = read_config() self.conn = get_hyprland_connection() self.icon_resolver = IconResolver() @@ -426,7 +426,7 @@ class Applications(Box): def on_drag_begin(self, widget, drag_context): self._drag_in_progress = True Gtk.drag_set_icon_surface(drag_context, createSurfaceFromWidget(widget)) - + # Prevent dock from hiding during drag if self.dock_instance: self.dock_instance.prevent_hiding(True) @@ -454,22 +454,22 @@ class Applications(Box): if child.get_name() == "dock-separator": separator_index = i break - + # Check if we're dragging from unpinned to pinned section cross_section_drag_to_pin = separator_index != -1 and ( - source_index > separator_index and target_index < separator_index + (source_index > separator_index and target_index < separator_index) ) - + # Check if we're dragging from pinned to unpinned section cross_section_drag_to_unpin = separator_index != -1 and ( - source_index < separator_index and target_index > separator_index + (source_index < separator_index and target_index > separator_index) ) - + # If dragging from unpinned to pinned, add to pinned apps if cross_section_drag_to_pin: source_widget = children[source_index] app_identifier = source_widget.app_identifier - + # Add to pinned apps if not already pinned if hasattr(source_widget, "desktop_app") and source_widget.desktop_app: app = source_widget.desktop_app @@ -483,7 +483,7 @@ class Applications(Box): self.pinned.insert(target_index, app_data_obj) else: self.pinned.insert(target_index, app_identifier) - + self.config["pinned_apps"] = self.pinned self.update_pinned_apps_file() self.update_applications() @@ -509,7 +509,7 @@ class Applications(Box): # since unpinned apps aren't stored in config child_to_move = children.pop(source_index) children.insert(target_index, child_to_move) - + # Update the UI for child in self.get_children(): self.remove(child) @@ -520,11 +520,11 @@ class Applications(Box): def on_drag_end(self, widget, drag_context): if not self._drag_in_progress: return - + # Process drag end... - + self._drag_in_progress = False - + # Allow dock to hide again if self.dock_instance: self.dock_instance.prevent_hiding(False) diff --git a/modules/dock/components.py b/modules/dock/components.py index 91d8eaa..b27b309 100644 --- a/modules/dock/components.py +++ b/modules/dock/components.py @@ -53,32 +53,36 @@ class DockComponents(Box): orientation="h" if not data.VERTICAL else "v", ) - # Add methods to connect drag signals - self.connect_drag_signals() - def connect_drag_signals(self): - # Method to connect drag signals from applications to parent - pass - - def set_drag_callback(self, on_drag_begin_cb, on_drag_end_cb): - """Set callbacks for drag operations from applications component""" - # Connect to applications drag signals - self.applications.connect( - "drag-begin", lambda widget, context: on_drag_begin_cb() - ) - self.applications.connect("drag-end", lambda widget, context: on_drag_end_cb()) - - self.add(self.workspaces) - self.add(self.metrics) - self.add(self.controls) - self.add(self.applications) - self.add(self.indicators) - self.add(self.battery) - self.add(self.date_time) - self.add(self.systray) + # Create list of components to add + self.themed_children = [ + self.workspaces, + self.metrics, + self.controls, + self.applications, + self.indicators, + self.battery, + self.date_time, + self.systray, + ] + + # Add each child individually + for child in self.themed_children: + self.add(child) # Apply initial visibility self.apply_component_props() + + if data.DOCK_THEME == "Dense" or data.DOCK_THEME == "Edge": + for child in self.themed_children: + if hasattr(child, "add_style_class"): + child.add_style_class("invert") + + # Apply invert style for Pills theme when dock is on left or right + if data.DOCK_THEME == "Pills" and (data.DOCK_POSITION == "Left" or data.DOCK_POSITION == "Right"): + for child in self.themed_children: + if hasattr(child, "add_style_class"): + child.add_style_class("invert") def apply_component_props(self): components = { @@ -136,3 +140,5 @@ class DockComponents(Box): return self.component_visibility[component_name] return None + + diff --git a/modules/dock/main.py b/modules/dock/main.py index d17fec2..0a86fa1 100644 --- a/modules/dock/main.py +++ b/modules/dock/main.py @@ -110,11 +110,6 @@ class Dock(Window): dock_instance=self ) - # Connect drag signals from applications component - self.components.set_drag_callback( - on_drag_begin_cb=self.on_app_drag_begin, - on_drag_end_cb=self.on_app_drag_end - ) # Add components based on position if self.actual_dock_is_horizontal: # Bottom dock diff --git a/styles/components.css b/styles/components.css index b811643..4fdd8aa 100644 --- a/styles/components.css +++ b/styles/components.css @@ -1,16 +1,23 @@ #workspaces { - padding: 8px; - border-radius: 12px; + min-width: 34px; background-color: var(--surface); - min-width: 18px; transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); } +#workspaces.invert { + min-height: 34px; + border-radius: 12px; +} + #battery { background-color: var(--surface); padding: 4px; } +#battery.invert { + border-radius: 12px; +} + #battery-circle { color: var(--surface-bright); border: 3px solid var(--primary); @@ -111,7 +118,9 @@ background-color: var(--surface); padding: 8px; } - +#date-time.vertical { + padding: 8px 0; +} #date-time.invert { background-color: var(--surface); border-radius: 12px; @@ -119,10 +128,13 @@ #tray { background-color: var(--surface); - border-radius: 12px; padding: 8px; } +#tray.invert { + border-radius: 12px; +} + menu { border: solid 1px; border-radius: 16px; diff --git a/styles/controls.css b/styles/controls.css index 604415a..c42022b 100644 --- a/styles/controls.css +++ b/styles/controls.css @@ -1,13 +1,11 @@ - - #control { padding: 4px; background-color: var(--surface); } #control.invert { - background-color: var(--surface); border-radius: 12px; + background-color: var(--surface); } #button-volume, @@ -33,4 +31,3 @@ #mic-label.muted { color: var(--outline); } - diff --git a/styles/dock.css b/styles/dock.css index 8a3f976..6b3259a 100644 --- a/styles/dock.css +++ b/styles/dock.css @@ -49,6 +49,10 @@ transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); } +#applications-dock.invert { + border-radius: 12px; +} + #dock.integrated { background-color: var(--shadow); padding: 4px; diff --git a/styles/indicators.css b/styles/indicators.css index 6b9f995..e313ee0 100644 --- a/styles/indicators.css +++ b/styles/indicators.css @@ -1,32 +1,31 @@ #indicator { - padding: 4px; - background-color: var(--surface); - } - - #indicator.invert { - background-color: var(--surface); - border-radius: 12px; - } - - #button-network, - #button-bluetooth { - color: var(--surface-bright); - border: 3px solid var(--primary); - } - - #button-network.muted, - #button-bluetooth.muted { - color: var(--surface-bright); - border: 3px solid var(--outline); - } - - #network-label, - #bluetooth-label { - font-size: 20px; - } - - #network-label.muted, - #bluetooth-label.muted { - color: var(--outline); - } - \ No newline at end of file + padding: 4px; + background-color: var(--surface); +} + +#indicator.invert { + background-color: var(--surface); + border-radius: 12px; +} + +#button-network, +#button-bluetooth { + color: var(--surface-bright); + border: 3px solid var(--primary); +} + +#button-network.muted, +#button-bluetooth.muted { + color: var(--surface-bright); + border: 3px solid var(--outline); +} + +#network-label, +#bluetooth-label { + font-size: 20px; +} + +#network-label.muted, +#bluetooth-label.muted { + color: var(--outline); +}