✨ feat(applications-dock): add cross-section drag functionality for pinning and unpinning apps
This commit is contained in:
1 file changed
+16
-3
@@ -456,12 +456,17 @@ class Applications(Box):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# Check if we're dragging from unpinned to pinned section
|
# Check if we're dragging from unpinned to pinned section
|
||||||
cross_section_drag = separator_index != -1 and (
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
# If dragging from unpinned to pinned, add to pinned apps
|
# If dragging from unpinned to pinned, add to pinned apps
|
||||||
if cross_section_drag:
|
if cross_section_drag_to_pin:
|
||||||
source_widget = children[source_index]
|
source_widget = children[source_index]
|
||||||
app_identifier = source_widget.app_identifier
|
app_identifier = source_widget.app_identifier
|
||||||
|
|
||||||
@@ -482,6 +487,14 @@ class Applications(Box):
|
|||||||
self.config["pinned_apps"] = self.pinned
|
self.config["pinned_apps"] = self.pinned
|
||||||
self.update_pinned_apps_file()
|
self.update_pinned_apps_file()
|
||||||
self.update_applications()
|
self.update_applications()
|
||||||
|
# If dragging from pinned to unpinned, remove from pinned apps
|
||||||
|
elif cross_section_drag_to_unpin:
|
||||||
|
# Remove from pinned apps
|
||||||
|
if source_index < len(self.pinned):
|
||||||
|
self.pinned.pop(source_index)
|
||||||
|
self.config["pinned_apps"] = self.pinned
|
||||||
|
self.update_pinned_apps_file()
|
||||||
|
self.update_applications()
|
||||||
else:
|
else:
|
||||||
# Regular reordering within the same section
|
# Regular reordering within the same section
|
||||||
if source_index < separator_index and target_index < separator_index:
|
if source_index < separator_index and target_index < separator_index:
|
||||||
|
|||||||
Reference in new issue
Block a user