end-4 / dots-hyprland

i hate minimalism so...
https://end-4.github.io/dots-hyprland-wiki/en/
GNU General Public License v3.0
3.94k stars 267 forks source link

Waybar module does not revert to default state after video player closes #825

Open ozgilik opened 1 week ago

ozgilik commented 1 week ago

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:

  1. Play a video in a browser.
  2. Observe that the video details are displayed on Waybar.
  3. Close the video or the browser.
  4. 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:

Code changes:

File

.config/waybar/scripts/mediaplayer.py

  1. Update clear_output to 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()
  2. Modify on_player_vanished to 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.

shinyPy commented 1 week ago

the dotfiles use ags as the bar and not waybar, I think you mistook this repo as someone's else?