✨ feat: add dock module with drag and drop pinning and instance management

This commit is contained in:
sankalp committed 2025-08-07 06:01:54 +05:45
1 parent 82a0886c74
commit 8ba98e33d3
3 files changed
+1028 -30

No files matched your search

+7 -15
View File
@@ -350,7 +350,6 @@ class PlayerBoxStack(Box):
self._update_all_player_buttons()
def on_new_player(self, mpris_manager, player):
# if player_name in self.config.get("ignore", []):
# return
@@ -740,7 +739,8 @@ class PlayerBox(Box):
orientation="horizontal",
children=[
self.image, # Album art on left (fixed width)
self.track_info, # Contains title, artist, seek bar AND controls (expands)
# Contains title, artist, seek bar AND controls (expands)
self.track_info,
],
)
self.inner_box = Box(
@@ -764,7 +764,8 @@ class PlayerBox(Box):
h_align="fill", # Fill available space
children=[
self.inner_box, # Track info and controls
self.stack_buttons_box, # Compact switcher in corner (fixed width)
# Compact switcher in corner (fixed width)
self.stack_buttons_box,
],
)
@@ -776,7 +777,6 @@ class PlayerBox(Box):
{
"exit": self._on_player_exit,
"notify::playback-status": self._on_playback_change,
"notify::shuffle": self._on_shuffle_update,
"notify::metadata": self._on_metadata,
},
)
@@ -829,7 +829,9 @@ class PlayerBox(Box):
def update_buttons(self, player_buttons, show_buttons):
"""Update the stack switcher buttons in this player box"""
logger.info(
f"[PlayerBox] update_buttons called: show_buttons={show_buttons}, num_buttons={len(player_buttons)}"
f"[PlayerBox] update_buttons called: show_buttons={
show_buttons
}, num_buttons={len(player_buttons)}"
)
# Clear existing buttons
@@ -923,16 +925,6 @@ class PlayerBox(Box):
def _on_player_prev(self, *_):
self.player.previous()
def _on_shuffle_update(self, *_):
if self.player.shuffle is None:
return
if self.player.shuffle is True:
self.shuffle_icon.style_classes = []
self.shuffle_icon.add_style_class("shuffle-on")
else:
self.shuffle_icon.style_classes = []
self.shuffle_icon.add_style_class("shuffle-off")
def _on_playback_change(self, player, status):
status = player.get_property("playback-status")
+11 -15
View File
@@ -247,7 +247,9 @@ class PlayerBoxStack(Box):
playing_index = self._find_playing_player_index()
if playing_index is not None and playing_index != self.current_stack_pos:
logger.info(
f"[PlayerBoxStack] Auto-switching to playing player at index {playing_index}"
f"[PlayerBoxStack] Auto-switching to playing player at index {
playing_index
}"
)
self.on_player_clicked_by_index(playing_index)
@@ -260,7 +262,9 @@ class PlayerBoxStack(Box):
if pb == player_box:
if i != self.current_stack_pos:
logger.info(
f"[PlayerBoxStack] Switching to playing player: {player_box.player.player_name}"
f"[PlayerBoxStack] Switching to playing player: {
player_box.player.player_name
}"
)
self.on_player_clicked_by_index(i)
break
@@ -286,7 +290,9 @@ class PlayerBoxStack(Box):
# set new active button
if self.player_buttons and self.current_stack_pos < len(self.player_buttons):
print(
f"[PlayerBoxStack] Switching to player at index {self.current_stack_pos}"
f"[PlayerBoxStack] Switching to player at index {
self.current_stack_pos
}"
)
self.player_buttons[self.current_stack_pos].add_style_class("active")
self.player_stack.set_visible_child(
@@ -469,7 +475,8 @@ class PlayerBox(Box):
self.fallback_cover_path = f"{data.HOME_DIR}/.current.wall"
# Add controls_box attribute early for compatibility
self.controls_box = Box(name="temp-controls-box") # Temporary placeholder
# Temporary placeholder
self.controls_box = Box(name="temp-controls-box")
self.image_size = 50
self.icon_size = 15
@@ -668,7 +675,6 @@ class PlayerBox(Box):
{
"exit": self._on_player_exit,
"notify::playback-status": self._on_playback_change,
"notify::shuffle": self._on_shuffle_update,
"notify::metadata": self._on_metadata,
},
)
@@ -754,16 +760,6 @@ class PlayerBox(Box):
def _on_player_prev(self, *_):
self.player.previous()
def _on_shuffle_update(self, *_):
if self.player.shuffle is None:
return
if self.player.shuffle is True:
self.shuffle_icon.style_classes = []
self.shuffle_icon.add_style_class("shuffle-on")
else:
self.shuffle_icon.style_classes = []
self.shuffle_icon.add_style_class("shuffle-off")
def _on_playback_change(self, player, status):
status = player.get_property("playback-status")
File diff suppressed because it is too large. Load diff