diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-27 13:08:31 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-27 13:08:31 +0100 |
| commit | 583ac2e98c3ff4fa379194b2eb4e7530c07b275d (patch) | |
| tree | 73edd610bc767082a8671be1155dd7e78f74a713 /games/shell.qml | |
| parent | a35688e2e3a4e94d0f43f2548dfa6384a1bf1276 (diff) | |
| download | quickshell-583ac2e98c3ff4fa379194b2eb4e7530c07b275d.tar.gz quickshell-583ac2e98c3ff4fa379194b2eb4e7530c07b275d.zip | |
games: route every Steam-launched window to workspace 8
Hyprland's class rules only catch Proton games (steam_app_N) and
whatever else is listed by name, so a non-Steam shortcut, here a GOG
Ren'Py build with its own class, opened on the current workspace.
Steam sets SteamGameId in the environment of everything it launches,
native, Proton and shortcuts alike, so on openwindow the shell looks up
the window's pid and moves it when /proc/<pid>/environ carries that
variable. Checked with the shortcut that motivated it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'games/shell.qml')
| -rw-r--r-- | games/shell.qml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/games/shell.qml b/games/shell.qml index c667ec4..f6ca8b3 100644 --- a/games/shell.qml +++ b/games/shell.qml @@ -10,11 +10,29 @@ // GNU General Public License for more details. import Quickshell +import Quickshell.Hyprland import Quickshell.Io +import QtQuick ShellRoot { Games { id: games } + // Every game Steam starts, native, Proton or a non-Steam shortcut, + // inherits SteamGameId; class rules miss the ones naming themselves + // (a Ren'Py shortcut did), so route on the window's environment. + Connections { + target: Hyprland + function onRawEvent(event) { + if (event.name !== "openwindow") return; + const addr = "0x" + event.data.split(",")[0]; + Quickshell.execDetached(["sh", "-c", + 'pid=$(hyprctl clients -j | jq -r --arg a "$1" \'.[] | select(.address == $a) | .pid\') && ' + + 'grep -qz "^SteamGameId=" "/proc/$pid/environ" && ' + + 'hyprctl dispatch "hl.dsp.window.move({ workspace = \\"8\\", window = \\"address:$1\\" })"', + "sh", addr]); + } + } + // `qs -p <this dir> ipc call games toggle` IpcHandler { target: "games" |
