dots-hyprland
dots-hyprland copied to clipboard
Waybar module does not revert to default state after video player closes
I have read the Usage and Troubleshooting pages of the wiki:
https://end-4.github.io/dots-hyprland-wiki/en/i-i/03troubleshooting/
I have made sure that both my config and system packages are up to date
Linux distro:
Arch Linux
The issue
When watching videos in a browser, my Waybar module displays the video title and pause/play state. However, when the video is closed or the player vanishes, the Waybar does not return to its previous state (e.g., showing CPU information), and the space reserved for the video details remains empty, resulting in the layout being stuck.
Steps to Reproduce:
- Play a video in a browser.
- Observe that the video details are displayed on Waybar.
- Close the video or the browser.
- Notice that the Waybar does not return to its original state, leaving an empty space.
Proposed Solution:
The issue can be resolved by ensuring the Waybar module properly resets to the previous state when the player vanishes. Specifically:
- Modify the
clear_outputfunction to restore the previous module (e.g., CPU information) instead of writing an empty string. - Update the
on_player_vanishedfunction to check if there are no active players, and if so, call theclear_outputto restore the default view.
Code changes:
File
.config/waybar/scripts/mediaplayer.py
-
Update
clear_outputto display CPU data:def clear_output(self): output = {"text": "CPU: <cpu_data>", "class": "default", "alt": "CPU"} sys.stdout.write(json.dumps(output) + "\n") sys.stdout.flush() -
Modify
on_player_vanishedto check for active players and reset if none exist:def on_player_vanished(self, _, player): logger.info(f"Player {player.props.player_name} has vanished") if len(self.get_players()) == 0: self.clear_output() else: self.show_most_important_player()
This resolves the issue by resetting the Waybar module back to its previous state when no players are active.
the dotfiles use ags as the bar and not waybar, I think you mistook this repo as someone's else?
bro u need to sleep