pyprland icon indicating copy to clipboard operation
pyprland copied to clipboard

[FEAT] Hyprpanel support

Open SpyrosPsarras opened this issue 8 months ago • 3 comments

Pyprland version

[~/.config/hypr]$ pypr version          
2.4.3-16

Describe the bug I have set up pypr to initialize hyprpanel. I have three monitor setup and my requirement is to show the bar (hyprpanel) only on one monitor. I often require to unplug my laptop from the dock station and I was expecting that pypr menubar could help me reload the hyprpanel and place it on my only monitor. Instead, I am able to see hyprpanel on all monitors (check bar.layout).

To Reproduce Steps to reproduce the behavior: use configuration with more than one monitor, change the monitors array in the menubar and plug/unplug monitor

Expected behavior Hyprpanel would spawn on one monitor, the best.

Configuration (provide following files/samples when relevant):

  • pyprland.toml
[pyprland]
plugins = [
    "menubar",
]

[menubar]
command = "hyprpanel"
monitors = ["DP-10", "eDP-1"]
  • .config/hypr/hyprland.conf:
source=~/.config/hypr/monitors.conf
exec-once = /usr/bin/pypr
  • .config/hypr/monitors.conf
monitor=eDP-1,[email protected],4000x784,1.0
monitor=DP-9,[email protected],0x0,1.0
monitor=DP-9,transform,1
monitor=DP-10,[email protected],1440x544,1.0
  • .config/hyprpanel/config.json
  "bar.layouts": {
    "*": {
      "left": [
        "cava",
        "dashboard",
        "workspaces",
        "cpu",
        "cputemp",
        "ram",
        "netstat"
      ],
      "middle": [
        "media",
        "clock"
      ],
      "right": [
        "hyprsunset",
        "hypridle",
        "updates",
        "systray",
        "volume",
        "network",
        "bluetooth",
        "battery",
        "kbinput",
        "notifications",
        "power"
      ]
    }
  },

Additional context Add any other context about the problem here.

SpyrosPsarras avatar Mar 02 '25 14:03 SpyrosPsarras

Hello :) So this is the git version, where I indeed started to refactor "gbar" plugin to be more generic, I'm also using hyprpanel... but there are few catches here:

  • gBar was able to specific a preferred screen, not ags/hyprpanel - so this feature can't work
  • the "auto restart in case of crash" (which happens when I plug/unplug monitors) doesn't work well with hyprpanel (at least using uwsm) and I didn't take time to investigate it yet

With Hyprpanel, changing the "bar" layout/display requires changing the configuration file: https://hyprpanel.com/configuration/panel.html

I can help writing a pypr plugin that updates this file according to some rules/monitor preferences, I would also use it. But I don't think the generic "menubar" can do this job, I initially just wanted some kind of watchdog for unstable bars to restart them, but it's probably better to have one plugin per "bar" so we can fit specific features on each of them.

I may rename "menubar" to "menu_gbar" and add a "menu_hyprpanel" based on it but handling the configuration file updates....

fdev31 avatar Mar 04 '25 10:03 fdev31

Thank you for your answer! You may then change the tag of bug, since it is not a bug but rather a future feature.

I may try to dig into this and play around that a bit myself if I have time.

I am not using uwsm and i am daily plugging and unplugging my laptop from dock and with hyprpanel i do not see any crash.

I will remove pypr for now as it will not be something that will happen with menubar.

SpyrosPsarras avatar Mar 04 '25 13:03 SpyrosPsarras

I am thinking this could be a new plugin, say hyprpanel_monitor.

  • would run and track hyprpanel process
  • would allow altering Hyprpanel's options.json according to monitor preferences

In my case, I'm mostly interested in changing the layout of the bar depending on the monitor ( "bar.layouts" ). Technically it could look like:

[hyprpanel_monitor]
preferences  = ["eDPI", "HDMI-A-1", "VGA"] 
[hyprpanel_monitor.eDPI]
json_patch = """
"bar.layouts": {
    "1": {
      "left": [
        "dashboard",
        "workspaces",
        "windowtitle"
      ],
      "middle": [
        "media"
      ],
      "right": [
        "volume",
        "clock",
        "notifications"
      ]
    },
    "0": {
      "left": [
        "dashboard",
        "workspaces",
        "windowtitle"
      ],
      "middle": [
        "media"
      ],
      "right": [
        "volume",
        "network",
        "bluetooth",
        "battery",
        "systray",
        "clock",
        "notifications"
      ]
    },
    "2": {
      "left": [
        "dashboard",
        "workspaces",
        "windowtitle"
      ],
      "middle": [
        "media"
      ],
      "right": [
        "volume",
        "clock",
        "notifications"
      ]
    }
  }
"""

That would "apply" this configuration snippet when "eDPI" is plugged (because it's the "best" monitor of the list), and restart hyprpanel.

That would be very generic even though a bit verbose, but it could be a path to a JSON file too... . Would that work for your use case too?

fdev31 avatar Mar 24 '25 21:03 fdev31