| 1 | pragma Singleton |
| 2 | import QtQuick |
| 3 | import Quickshell |
| 4 | |
| 5 | // Compositor actions. Your waybar config uses the new Lua-style dispatchers |
| 6 | // (hl.dsp.focus{...}), so that is the default; flip luaSyntax for older Hyprland. |
| 7 | Singleton { |
| 8 | property bool luaSyntax: true |
| 9 | |
| 10 | function workspace(arg) { |
| 11 | if (luaSyntax) |
| 12 | Quickshell.execDetached(["hyprctl", "dispatch", 'hl.dsp.focus({workspace="' + arg + '"})']) |
| 13 | else |
| 14 | Quickshell.execDetached(["hyprctl", "dispatch", "workspace", String(arg)]) |
| 15 | } |
| 16 | |
| 17 | // compositor-agnostic logout |
| 18 | function logout() { Quickshell.execDetached(["sh", "-c", 'loginctl terminate-user "$USER"']) } |
| 19 | } |