quickshell: fix tray click via hyprctl eval for Lua mode

Use a shell script to find the window address and focus it via
hl.dispatch(hl.dsp.focus()) since hyprctl dispatch syntax changed
in Hyprland 0.55+ Lua mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-06-04 14:32:14 +01:00
parent 166280fa33
commit 8510ea5c4f

View file

@ -490,6 +490,10 @@ in
'';
nmcli = "${pkgs.networkmanager}/bin/nmcli";
powerprofilesctl = "${pkgs.power-profiles-daemon}/bin/powerprofilesctl";
focusTrayWindow = pkgs.writeShellScript "focus-tray-window" ''
addr=$(hyprctl clients -j | ${pkgs.jq}/bin/jq -r '.[] | select(.class=="steam_app_0" and .title!="") | .address' | head -1)
[ -n "$addr" ] && hyprctl eval "hl.dispatch(hl.dsp.focus({window = \"address:$addr\"}))"
'';
in {
"quickshell/qmldir" = {
onChange = qsRestart;
@ -1151,6 +1155,11 @@ in
color: Theme.base05
}
Process {
id: trayFocusProc
command: ["${focusTrayWindow}"]
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
@ -1204,7 +1213,7 @@ in
} else {
modelData.activate();
if (!modelData.hasMenu) {
Hyprland.dispatch("focuswindow class:steam_app_0 title:Battle.net");
trayFocusProc.running = true;
}
}
}