Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar example widget disappears on hyprctl dispatch dpms off #56

Open
garlicxd opened this issue Nov 21, 2024 · 6 comments
Open

Bar example widget disappears on hyprctl dispatch dpms off #56

garlicxd opened this issue Nov 21, 2024 · 6 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@garlicxd
Copy link

I have a Hyprland setup with my fabric bar called with exec = python ~/.garden/fabric/bar.py. Whenever hypridle runs on-timeout = hyprctl dispatch dpms off and then on-resume = hyprctl dispatch dpms on, the example bar disappears.

I have a workaround to add this to the bar, but id rather have the widget showing by itself:

def refresh():
    BAR_SCRIPT_PATH = __file__
    # Find and terminate the existing bar process
    for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
        # print(proc.info)
        if "python" in proc.info['name'] and BAR_SCRIPT_PATH in (proc.info['cmdline'] or []):
            os.kill(proc.info['pid'], signal.SIGTERM)
    
    # Restart the bar
    os.system(f"python3 {BAR_SCRIPT_PATH} &")

if __name__ == "__main__":
    refresh()
@its-darsh its-darsh added good first issue Good for newcomers help wanted Extra attention is needed labels Nov 21, 2024
@Axenide
Copy link
Contributor

Axenide commented Nov 22, 2024

Interesting, I just started using hypridle and I'm not having issues with Fabric. I tested the example bar and everything seems fine. Both with main and other branches.

Could you share your hypridle.conf? Does this happen with any other widgets/bar? With any of the examples besides the bar?

@garlicxd
Copy link
Author

garlicxd commented Nov 22, 2024

nothing crazy. i tried systemctl suspend and that didnt make the bar disappear. Also i installed the aur package. im not working with venvs. quick question about that. is it really worth to create a venv for fabric?

general {
    lock_cmd = pidof hyprlock || hyprlock       # avoid starting multiple hyprlock instances.
    before_sleep_cmd = loginctl lock-session    # lock before suspend.
    after_sleep_cmd = hyprctl dispatch dpms on  # to avoid having to press a key twice to turn on the display.
}

listener {
    timeout = 600                               # 5 mins
    on-timeout = hyprctl dispatch dpms off      # screen off when timeout has passed
    on-resume = hyprctl dispatch dpms on        # screen on when activity is detected after timeout has fired.
}

listener {
    timeout = 3600                              # 30 mins
    on-timeout = systemctl suspend              # suspend pc
}

@muhchaudhary
Copy link
Contributor

muhchaudhary commented Nov 22, 2024

Manged to replicate this after leaving my PC for a while:

(run_fabric.py:11091): Gtk-CRITICAL **: 01:24:14.102: gtk_box_reorder_child: assertion 'old_link != NULL' failed

My app launcher still appears when using my keybind from the same script

@muhchaudhary
Copy link
Contributor

In the code, the only thing I can think of that would result in this issue is the hyprland widget:

    def reorder_buttons(self):
        for _, child in sorted(self._buttons.items(), key=lambda i: i[0]):
            self._container.reorder_child(child, (child.id - 1))
        return

@muhchaudhary
Copy link
Contributor

Further testing, removing the hyprland widgets will get rid of that error, but the bar will still disappear... seems like we are losing the children of widgets?

$ python -m fabric evaluate fabric-bar "bar.children"                                                                     
result: []

@Axenide
Copy link
Contributor

Axenide commented Nov 22, 2024

nothing crazy. i tried systemctl suspend and that didnt make the bar disappear. Also i installed the aur package. im not working with venvs. quick question about that. is it really worth to create a venv for fabric?

general {
    lock_cmd = pidof hyprlock || hyprlock       # avoid starting multiple hyprlock instances.
    before_sleep_cmd = loginctl lock-session    # lock before suspend.
    after_sleep_cmd = hyprctl dispatch dpms on  # to avoid having to press a key twice to turn on the display.
}

listener {
    timeout = 600                               # 5 mins
    on-timeout = hyprctl dispatch dpms off      # screen off when timeout has passed
    on-resume = hyprctl dispatch dpms on        # screen on when activity is detected after timeout has fired.
}

listener {
    timeout = 3600                              # 30 mins
    on-timeout = systemctl suspend              # suspend pc
}

We have the same hypridle.conf, I wonder why this behavior is so inconsistent.

Regarding your question about AUR and venvs, There is not much difference besides how you will start your config.
I used AUR for a long time, now I'm using a venv to test other branches besides main, and I start the config calling the venv's Python binary from my Hyprland config. Everything else is called from within Fabric and fabric-cli, so basically it is based on your preference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants