me like nix
1import QtQuick
2import Quickshell
3import Quickshell.Widgets
4import Quickshell.Io
5import "../../../config" as Config
6import "../../../components"
7
8Item {
9 id: trayItem
10
11 required property var modelData
12
13 width: 22
14 height: 22
15
16 Rectangle {
17 anchors.centerIn: parent
18 width: parent.width + 4
19 height: parent.height + 4
20 radius: Config.Appearance.rounding.normal
21 color: trayMouse.containsMouse
22 ? Qt.rgba(Config.Colours.text.r, Config.Colours.text.g, Config.Colours.text.b, 0.1)
23 : "transparent"
24 Behavior on color { CAnim {} }
25 }
26
27 IconImage {
28 implicitSize: 16
29 anchors.centerIn: parent
30 source: Quickshell.iconPath(trayItem.modelData.icon, true) || trayItem.modelData.icon
31 }
32
33 MouseArea {
34 id: trayMouse
35 anchors.fill: parent
36 anchors.margins: -2
37 acceptedButtons: Qt.LeftButton | Qt.RightButton
38 hoverEnabled: true
39 cursorShape: Qt.PointingHandCursor
40 onClicked: mouse => {
41 if (mouse.button === Qt.RightButton) {
42 if (trayItem.modelData.hasMenu) {
43 trayItem.modelData.display(trayItem.Window.window, trayItem.width, trayItem.height / 2)
44 }
45 } else {
46 if (trayItem.modelData.id.toLowerCase().indexOf("steam") !== -1) {
47 steamProc.running = true
48 } else {
49 trayItem.modelData.activate()
50 }
51 }
52 }
53 }
54
55 Process {
56 id: steamProc
57 command: ["sh", "-c", "WID=$(niri msg --json windows | jq -r '.[] | select(.app_id | test(\"steam\"; \"i\")) | .id' | head -n1); if [ -n \"$WID\" ]; then niri msg action focus-window --id \"$WID\"; else steam steam://open/games; fi"]
58 }
59}