waybar: pin the bar to the main monitor of the active profile
The previous fix listed both profiles' primaries, "output": ["eDP-1",
"DP-1"] -- but DP-1 is the laptop's second monitor too, so the laptop
would have got a bar on it as well as on eDP-1. No static list can express
"the main monitor" when the two machines share an output name.
Resolve it at launch instead. hypr/scripts/bar asks Hyprland for the
monitor at position 0x0 -- the main monitor in both profiles -- writes
{"output": "<name>"} to ~/.cache/waybar-output.jsonc, and execs waybar;
waybar/config.jsonc includes that fragment. autostart/services, the
bar_reload bind and the performance script all go through the wrapper, so
a reload re-resolves after docking. Signals still target the waybar
process, not the wrapper.
Verified all three paths on mainPC: the fragment pins the bar to DP-1
only, an empty fragment falls back to a bar on every output, and a
fragment naming a disconnected output maps nothing (the failure mode this
started from). Config parses on both profiles.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StGBghPW9Dm7z7uj2VNWHr
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
-- Was: configs/default_apps.conf
|
||||
|
||||
local bar = "waybar"
|
||||
-- The bar is launched through a wrapper that pins it to this machine's main
|
||||
-- monitor (see hypr/scripts/bar); signals still go to the waybar process.
|
||||
local bar = os.getenv("HOME") .. "/.config/hypr/scripts/bar"
|
||||
local bar_proc = "waybar"
|
||||
local notifications = "swaync-client"
|
||||
local terminal = "kitty"
|
||||
|
||||
@@ -8,8 +11,8 @@ return {
|
||||
launcher = "rofi -show drun",
|
||||
|
||||
bar = bar,
|
||||
bar_toggle = "killall -SIGUSR1 " .. bar,
|
||||
bar_reload = "killall " .. bar .. "; " .. bar,
|
||||
bar_toggle = "killall -SIGUSR1 " .. bar_proc,
|
||||
bar_reload = "killall " .. bar_proc .. "; " .. bar,
|
||||
|
||||
notifications = notifications,
|
||||
notifications_read = notifications .. " -C",
|
||||
|
||||
Reference in New Issue
Block a user