🔧 config, dock: update dock position, remove pinned apps from config

This commit is contained in:
sankalp committed 2025-06-11 16:28:51 +05:45
1 parent 20dced51fb
commit 924b46fb89
9 files changed
+158 -162

No files matched your search

+14 -14
View File
@@ -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)
+28 -22
View File
@@ -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
-5
View File
@@ -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