diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell')
16 files changed, 307 insertions, 105 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml b/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml index 883f9001..dcc23279 100644 --- a/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml +++ b/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml | |||
| @@ -149,16 +149,22 @@ Item { | |||
| 149 | hoverEnabled: true | 149 | hoverEnabled: true |
| 150 | enabled: true | 150 | enabled: true |
| 151 | 151 | ||
| 152 | anchors.centerIn: parent | 152 | anchors.fill: parent |
| 153 | 153 | ||
| 154 | Text { | 154 | Item { |
| 155 | id: widgetTooltipText | 155 | anchors.fill: parent |
| 156 | 156 | ||
| 157 | font.pointSize: 10 | 157 | Text { |
| 158 | font.family: "Fira Mono" | 158 | id: widgetTooltipText |
| 159 | color: "white" | 159 | |
| 160 | anchors.centerIn: parent | ||
| 160 | 161 | ||
| 161 | text: JSON.stringify(Object.assign({}, activeWindowDisplay.activeWindow), null, 2) | 162 | font.pointSize: 10 |
| 163 | font.family: "Fira Mono" | ||
| 164 | color: "white" | ||
| 165 | |||
| 166 | text: JSON.stringify(Object.assign({}, activeWindowDisplay.activeWindow), null, 2) | ||
| 167 | } | ||
| 162 | } | 168 | } |
| 163 | } | 169 | } |
| 164 | } | 170 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index f8092604..7f97bd75 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | import Quickshell | 1 | import Quickshell |
| 2 | import Quickshell.Wayland | ||
| 2 | import QtQuick | 3 | import QtQuick |
| 3 | 4 | ||
| 4 | PanelWindow { | 5 | PanelWindow { |
| @@ -6,6 +7,8 @@ PanelWindow { | |||
| 6 | 7 | ||
| 7 | required property var screen | 8 | required property var screen |
| 8 | 9 | ||
| 10 | WlrLayershell.namespace: "bar" | ||
| 11 | |||
| 9 | anchors { | 12 | anchors { |
| 10 | top: true | 13 | top: true |
| 11 | left: true | 14 | left: true |
| @@ -63,6 +66,10 @@ PanelWindow { | |||
| 63 | anchors.verticalCenter: parent.verticalCenter | 66 | anchors.verticalCenter: parent.verticalCenter |
| 64 | spacing: 0 | 67 | spacing: 0 |
| 65 | 68 | ||
| 69 | WorktimeWidget { command: "time"; } | ||
| 70 | |||
| 71 | WorktimeWidget { command: "today"; } | ||
| 72 | |||
| 66 | KeyboardLayout {} | 73 | KeyboardLayout {} |
| 67 | 74 | ||
| 68 | Item { | 75 | Item { |
diff --git a/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml b/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml index fd031627..da17df2a 100644 --- a/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml | |||
| @@ -87,42 +87,48 @@ Item { | |||
| 87 | hoverEnabled: true | 87 | hoverEnabled: true |
| 88 | enabled: true | 88 | enabled: true |
| 89 | 89 | ||
| 90 | anchors.centerIn: parent | 90 | anchors.fill: parent |
| 91 | |||
| 92 | Text { | ||
| 93 | id: widgetTooltipText | ||
| 94 | |||
| 95 | font.pointSize: 10 | ||
| 96 | font.family: "Fira Sans" | ||
| 97 | color: "white" | ||
| 98 | 91 | ||
| 99 | text: { | 92 | Item { |
| 100 | const stateStr = UPowerDeviceState.toString(root.batteryDevice.state); | 93 | anchors.fill: parent |
| 101 | var outStr = stateStr; | 94 | |
| 102 | if (root.batteryDevice.state != UPowerDeviceState.FullyCharged) | 95 | Text { |
| 103 | outStr += ` ${Math.round(root.batteryDevice.percentage * 100)}%`; | 96 | id: widgetTooltipText |
| 104 | 97 | ||
| 105 | function formatTime(t) { | 98 | anchors.centerIn: parent |
| 106 | var res = ""; | 99 | |
| 107 | for (const unit of [{ "s": "h", "v": 3600 }, { "s": "m", "v": 60 }, { "s": "s", "v": 1 }]) { | 100 | font.pointSize: 10 |
| 108 | if (t < unit.v) | 101 | font.family: "Fira Sans" |
| 109 | continue; | 102 | color: "white" |
| 110 | res += Math.floor(t / unit.v) + unit.s; | 103 | |
| 111 | t %= unit.v; | 104 | text: { |
| 105 | const stateStr = UPowerDeviceState.toString(root.batteryDevice.state); | ||
| 106 | var outStr = stateStr; | ||
| 107 | if (root.batteryDevice.state != UPowerDeviceState.FullyCharged) | ||
| 108 | outStr += ` ${Math.round(root.batteryDevice.percentage * 100)}%`; | ||
| 109 | |||
| 110 | function formatTime(t) { | ||
| 111 | var res = ""; | ||
| 112 | for (const unit of [{ "s": "h", "v": 3600 }, { "s": "m", "v": 60 }, { "s": "s", "v": 1 }]) { | ||
| 113 | if (t < unit.v) | ||
| 114 | continue; | ||
| 115 | res += Math.floor(t / unit.v) + unit.s; | ||
| 116 | t %= unit.v; | ||
| 117 | } | ||
| 118 | return res; | ||
| 119 | } | ||
| 120 | if (root.batteryDevice.timeToEmpty != 0) { | ||
| 121 | const tStr = formatTime(Math.floor(root.batteryDevice.timeToEmpty / 60) * 60); | ||
| 122 | if (tStr) | ||
| 123 | outStr += " " + tStr; | ||
| 124 | } else if (root.batteryDevice.timeToFull != 0) { | ||
| 125 | const tStr = formatTime(Math.ceil(root.batteryDevice.timeToFull / 60) * 60); | ||
| 126 | if (tStr) | ||
| 127 | outStr += " " + tStr; | ||
| 112 | } | 128 | } |
| 113 | return res; | ||
| 114 | } | ||
| 115 | if (root.batteryDevice.timeToEmpty != 0) { | ||
| 116 | const tStr = formatTime(Math.floor(root.batteryDevice.timeToEmpty / 60) * 60); | ||
| 117 | if (tStr) | ||
| 118 | outStr += " " + tStr; | ||
| 119 | } else if (root.batteryDevice.timeToFull != 0) { | ||
| 120 | const tStr = formatTime(Math.ceil(root.batteryDevice.timeToFull / 60) * 60); | ||
| 121 | if (tStr) | ||
| 122 | outStr += " " + tStr; | ||
| 123 | } | ||
| 124 | 129 | ||
| 125 | return outStr; | 130 | return outStr; |
| 131 | } | ||
| 126 | } | 132 | } |
| 127 | } | 133 | } |
| 128 | } | 134 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml index 7f9c1ad0..3bb5a80e 100644 --- a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml | |||
| @@ -62,16 +62,22 @@ Item { | |||
| 62 | hoverEnabled: true | 62 | hoverEnabled: true |
| 63 | enabled: true | 63 | enabled: true |
| 64 | 64 | ||
| 65 | anchors.centerIn: parent | 65 | anchors.fill: parent |
| 66 | |||
| 67 | Item { | ||
| 68 | anchors.fill: parent | ||
| 69 | |||
| 70 | Text { | ||
| 71 | id: widgetTooltipText | ||
| 66 | 72 | ||
| 67 | Text { | 73 | anchors.centerIn: parent |
| 68 | id: widgetTooltipText | ||
| 69 | 74 | ||
| 70 | font.pointSize: 10 | 75 | font.pointSize: 10 |
| 71 | font.family: "Fira Sans" | 76 | font.family: "Fira Sans" |
| 72 | color: "white" | 77 | color: "white" |
| 73 | 78 | ||
| 74 | text: `${Math.round(Brightness.currBrightness * 100)}%` | 79 | text: `${Math.round(Brightness.currBrightness * 100)}%` |
| 80 | } | ||
| 75 | } | 81 | } |
| 76 | } | 82 | } |
| 77 | } | 83 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index bb618f6a..b7004528 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml | |||
| @@ -80,8 +80,8 @@ Item { | |||
| 80 | } | 80 | } |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | implicitWidth: clockTooltipContent.width | 83 | implicitWidth: tooltipLayout.childrenRect.width + 16 |
| 84 | implicitHeight: clockTooltipContent.height | 84 | implicitHeight: tooltipLayout.childrenRect.height + 16 |
| 85 | color: "black" | 85 | color: "black" |
| 86 | 86 | ||
| 87 | onVisibleChanged: { | 87 | onVisibleChanged: { |
| @@ -99,13 +99,20 @@ Item { | |||
| 99 | 99 | ||
| 100 | anchors.fill: parent | 100 | anchors.fill: parent |
| 101 | 101 | ||
| 102 | WrapperItem { | 102 | Item { |
| 103 | id: clockTooltipContent | 103 | id: clockTooltipContent |
| 104 | 104 | ||
| 105 | margin: 8 | 105 | anchors.fill: parent |
| 106 | 106 | ||
| 107 | ColumnLayout { | 107 | ColumnLayout { |
| 108 | anchors.centerIn: parent | 108 | id: tooltipLayout |
| 109 | |||
| 110 | anchors { | ||
| 111 | left: parent.left | ||
| 112 | top: parent.top | ||
| 113 | leftMargin: 8 | ||
| 114 | topMargin: 8 | ||
| 115 | } | ||
| 109 | 116 | ||
| 110 | Text { | 117 | Text { |
| 111 | id: yearLabel | 118 | id: yearLabel |
diff --git a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml index bc3750f9..46302e54 100644 --- a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml +++ b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml | |||
| @@ -87,18 +87,24 @@ Item { | |||
| 87 | hoverEnabled: true | 87 | hoverEnabled: true |
| 88 | enabled: true | 88 | enabled: true |
| 89 | 89 | ||
| 90 | anchors.centerIn: parent | 90 | anchors.fill: parent |
| 91 | 91 | ||
| 92 | Text { | 92 | Item { |
| 93 | id: kbdTooltipText | 93 | anchors.fill: parent |
| 94 | 94 | ||
| 95 | font.pointSize: 10 | 95 | Text { |
| 96 | font.family: "Fira Sans" | 96 | id: kbdTooltipText |
| 97 | color: "white" | ||
| 98 | 97 | ||
| 99 | text: { | 98 | anchors.centerIn: parent |
| 100 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | 99 | |
| 101 | return currentLayout || ""; | 100 | font.pointSize: 10 |
| 101 | font.family: "Fira Sans" | ||
| 102 | color: "white" | ||
| 103 | |||
| 104 | text: { | ||
| 105 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | ||
| 106 | return currentLayout || ""; | ||
| 107 | } | ||
| 102 | } | 108 | } |
| 103 | } | 109 | } |
| 104 | } | 110 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml b/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml index 2be0692a..8410dcda 100644 --- a/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml | |||
| @@ -16,6 +16,7 @@ Item { | |||
| 16 | anchors.fill: parent | 16 | anchors.fill: parent |
| 17 | 17 | ||
| 18 | hoverEnabled: true | 18 | hoverEnabled: true |
| 19 | cursorShape: Qt.PointingHandCursor | ||
| 19 | 20 | ||
| 20 | onClicked: InhibitorState.lidSwitchInhibited = !InhibitorState.lidSwitchInhibited | 21 | onClicked: InhibitorState.lidSwitchInhibited = !InhibitorState.lidSwitchInhibited |
| 21 | 22 | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml index 456baa98..f983388c 100644 --- a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml +++ b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml | |||
| @@ -70,11 +70,6 @@ Scope { | |||
| 70 | mode: Custom.SystemdInhibitorParams.Delay | 70 | mode: Custom.SystemdInhibitorParams.Delay |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | Scope { | ||
| 74 | id: mprisProxy | ||
| 75 | property list<var> players: Mpris.players.values | ||
| 76 | } | ||
| 77 | |||
| 78 | WlSessionLock { | 73 | WlSessionLock { |
| 79 | id: lock | 74 | id: lock |
| 80 | 75 | ||
| @@ -85,7 +80,7 @@ Scope { | |||
| 85 | if (locked) { | 80 | if (locked) { |
| 86 | NiriService.sendCommand({ "Action": { "PowerOffMonitors": {} } }); | 81 | NiriService.sendCommand({ "Action": { "PowerOffMonitors": {} } }); |
| 87 | Custom.KeePassXC.lockAllDatabases(); | 82 | Custom.KeePassXC.lockAllDatabases(); |
| 88 | Array.from(mprisProxy.players).forEach(player => { | 83 | Array.from(MprisProxy.players).forEach(player => { |
| 89 | if (player.canPause && player.isPlaying) | 84 | if (player.canPause && player.isPlaying) |
| 90 | player.pause(); | 85 | player.pause(); |
| 91 | }); | 86 | }); |
diff --git a/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml b/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml index 3e0b8fd9..9c6b65a4 100644 --- a/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml | |||
| @@ -272,16 +272,22 @@ Item { | |||
| 272 | 272 | ||
| 273 | onWheel: event => defaultSinkMouseArea.scrollVolume(event); | 273 | onWheel: event => defaultSinkMouseArea.scrollVolume(event); |
| 274 | 274 | ||
| 275 | anchors.centerIn: parent | 275 | anchors.fill: parent |
| 276 | |||
| 277 | Item { | ||
| 278 | anchors.fill: parent | ||
| 276 | 279 | ||
| 277 | Text { | 280 | Text { |
| 278 | id: volumeTooltipText | 281 | id: volumeTooltipText |
| 279 | 282 | ||
| 280 | font.pointSize: 10 | 283 | anchors.centerIn: parent |
| 281 | font.family: "Fira Sans" | ||
| 282 | color: "white" | ||
| 283 | 284 | ||
| 284 | text: `${Math.round(defaultSinkItem.modelData?.audio?.volume * 100)}%` | 285 | font.pointSize: 10 |
| 286 | font.family: "Fira Sans" | ||
| 287 | color: "white" | ||
| 288 | |||
| 289 | text: `${Math.round(defaultSinkItem.modelData?.audio?.volume * 100)}%` | ||
| 290 | } | ||
| 285 | } | 291 | } |
| 286 | } | 292 | } |
| 287 | } | 293 | } |
| @@ -391,16 +397,22 @@ Item { | |||
| 391 | 397 | ||
| 392 | onWheel: event => defaultSourceMouseArea.scrollVolume(event); | 398 | onWheel: event => defaultSourceMouseArea.scrollVolume(event); |
| 393 | 399 | ||
| 394 | anchors.centerIn: parent | 400 | anchors.fill: parent |
| 401 | |||
| 402 | Item { | ||
| 403 | anchors.fill: parent | ||
| 395 | 404 | ||
| 396 | Text { | 405 | Text { |
| 397 | id: volumeTooltipText | 406 | id: volumeTooltipText |
| 398 | 407 | ||
| 399 | font.pointSize: 10 | 408 | anchors.centerIn: parent |
| 400 | font.family: "Fira Sans" | ||
| 401 | color: "white" | ||
| 402 | 409 | ||
| 403 | text: `${Math.round(defaultSourceItem.modelData?.audio?.volume * 100)}%` | 410 | font.pointSize: 10 |
| 411 | font.family: "Fira Sans" | ||
| 412 | color: "white" | ||
| 413 | |||
| 414 | text: `${Math.round(defaultSourceItem.modelData?.audio?.volume * 100)}%` | ||
| 415 | } | ||
| 404 | } | 416 | } |
| 405 | } | 417 | } |
| 406 | } | 418 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/Services/MprisProxy.qml b/accounts/gkleen@sif/shell/quickshell/Services/MprisProxy.qml new file mode 100644 index 00000000..e3ab9755 --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/Services/MprisProxy.qml | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | pragma Singleton | ||
| 2 | |||
| 3 | import Quickshell | ||
| 4 | import Quickshell.Services.Mpris | ||
| 5 | |||
| 6 | Scope { | ||
| 7 | property list<var> players: Mpris.players.values | ||
| 8 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml index 351e74ee..f7b4ed96 100644 --- a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml +++ b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml | |||
| @@ -155,32 +155,39 @@ Item { | |||
| 155 | hoverEnabled: true | 155 | hoverEnabled: true |
| 156 | enabled: true | 156 | enabled: true |
| 157 | 157 | ||
| 158 | margin: 8 | 158 | margin: 4 |
| 159 | 159 | ||
| 160 | Column { | 160 | anchors.fill: parent |
| 161 | Text { | ||
| 162 | id: tooltipTitle | ||
| 163 | 161 | ||
| 164 | enabled: trayItem.tooltipTitle | 162 | Item { |
| 163 | anchors.fill: parent | ||
| 165 | 164 | ||
| 166 | font.pointSize: 10 | 165 | Column { |
| 167 | font.family: "Fira Sans" | 166 | anchors.centerIn: parent |
| 168 | font.bold: true | 167 | Text { |
| 169 | color: "white" | 168 | id: tooltipTitle |
| 170 | 169 | ||
| 171 | text: trayItem.tooltipTitle | 170 | enabled: trayItem.tooltipTitle |
| 172 | } | ||
| 173 | 171 | ||
| 174 | Text { | 172 | font.pointSize: 10 |
| 175 | id: tooltipDescription | 173 | font.family: "Fira Sans" |
| 174 | font.bold: true | ||
| 175 | color: "white" | ||
| 176 | 176 | ||
| 177 | enabled: trayItem.tooltipDescription | 177 | text: trayItem.tooltipTitle |
| 178 | } | ||
| 179 | |||
| 180 | Text { | ||
| 181 | id: tooltipDescription | ||
| 178 | 182 | ||
| 179 | font.pointSize: 10 | 183 | enabled: trayItem.tooltipDescription |
| 180 | font.family: "Fira Sans" | ||
| 181 | color: "white" | ||
| 182 | 184 | ||
| 183 | text: trayItem.tooltipDescription | 185 | font.pointSize: 10 |
| 186 | font.family: "Fira Sans" | ||
| 187 | color: "white" | ||
| 188 | |||
| 189 | text: trayItem.tooltipDescription | ||
| 190 | } | ||
| 184 | } | 191 | } |
| 185 | } | 192 | } |
| 186 | } | 193 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml index 742ef4f5..e7b7b673 100644 --- a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml +++ b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | import Quickshell | 1 | import Quickshell |
| 2 | import Quickshell.Io | 2 | import Quickshell.Io |
| 3 | import Quickshell.Services.Pipewire | 3 | import Quickshell.Services.Pipewire |
| 4 | import Quickshell.Services.Mpris | ||
| 4 | import qs.Services | 5 | import qs.Services |
| 6 | import Custom as Custom | ||
| 5 | 7 | ||
| 6 | Scope { | 8 | Scope { |
| 7 | id: root | 9 | id: root |
| @@ -19,6 +21,14 @@ Scope { | |||
| 19 | root.onCommandVolume(command.Volume); | 21 | root.onCommandVolume(command.Volume); |
| 20 | else if (command.Brightness) | 22 | else if (command.Brightness) |
| 21 | root.onCommandBrightness(command.Brightness); | 23 | root.onCommandBrightness(command.Brightness); |
| 24 | else if (command.LockSession) | ||
| 25 | Custom.Systemd.lockSession(); | ||
| 26 | else if (command.Suspend) | ||
| 27 | Custom.Systemd.suspend(); | ||
| 28 | else if (command.Hibernate) | ||
| 29 | Custom.Systemd.hibernate(); | ||
| 30 | else if (command.Mpris) | ||
| 31 | root.onCommandMpris(command.Mpris); | ||
| 22 | else | 32 | else |
| 23 | console.warn("UnixIPC: Command not handled:", JSON.stringify(command)); | 33 | console.warn("UnixIPC: Command not handled:", JSON.stringify(command)); |
| 24 | } catch (e) { | 34 | } catch (e) { |
| @@ -56,4 +66,12 @@ Scope { | |||
| 56 | if (command === "down") | 66 | if (command === "down") |
| 57 | Brightness.currBrightness -= 0.02 | 67 | Brightness.currBrightness -= 0.02 |
| 58 | } | 68 | } |
| 69 | |||
| 70 | function onCommandMpris(command) { | ||
| 71 | if (command.PauseAll) | ||
| 72 | Array.from(MprisProxy.players).forEach(player => { | ||
| 73 | if (player.canPause && player.isPlaying) | ||
| 74 | player.pause(); | ||
| 75 | }); | ||
| 76 | } | ||
| 59 | } | 77 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml b/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml index 0633f350..0512ff51 100644 --- a/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml | |||
| @@ -25,6 +25,7 @@ Item { | |||
| 25 | anchors.fill: parent | 25 | anchors.fill: parent |
| 26 | 26 | ||
| 27 | hoverEnabled: true | 27 | hoverEnabled: true |
| 28 | cursorShape: Qt.PointingHandCursor | ||
| 28 | 29 | ||
| 29 | onClicked: InhibitorState.waylandIdleInhibited = !InhibitorState.waylandIdleInhibited | 30 | onClicked: InhibitorState.waylandIdleInhibited = !InhibitorState.waylandIdleInhibited |
| 30 | 31 | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml index 4cbebcc9..2d3aca1b 100644 --- a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml +++ b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml | |||
| @@ -149,6 +149,8 @@ Row { | |||
| 149 | WrapperMouseArea { | 149 | WrapperMouseArea { |
| 150 | id: windowMouseArea | 150 | id: windowMouseArea |
| 151 | 151 | ||
| 152 | required property int index | ||
| 153 | required property var modelData | ||
| 152 | property var windowData: modelData | 154 | property var windowData: modelData |
| 153 | 155 | ||
| 154 | hoverEnabled: true | 156 | hoverEnabled: true |
| @@ -164,12 +166,11 @@ Row { | |||
| 164 | WrapperRectangle { | 166 | WrapperRectangle { |
| 165 | color: windowMouseArea.containsMouse ? "#33808080" : "transparent"; | 167 | color: windowMouseArea.containsMouse ? "#33808080" : "transparent"; |
| 166 | 168 | ||
| 167 | anchors.fill: parent | ||
| 168 | |||
| 169 | WrapperItem { | 169 | WrapperItem { |
| 170 | anchors.fill: parent | 170 | rightMargin: 8 |
| 171 | 171 | leftMargin: 8 | |
| 172 | margin: 4 | 172 | topMargin: windowMouseArea.index == 0 ? 8 : 4 |
| 173 | bottomMargin: windowMouseArea.index == windowsModel.values.length - 1 ? 8 : 4 | ||
| 173 | 174 | ||
| 174 | Text { | 175 | Text { |
| 175 | id: windowLabel | 176 | id: windowLabel |
diff --git a/accounts/gkleen@sif/shell/quickshell/WorktimeWidget.qml b/accounts/gkleen@sif/shell/quickshell/WorktimeWidget.qml new file mode 100644 index 00000000..04bcc581 --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/WorktimeWidget.qml | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | import QtQml | ||
| 2 | import Quickshell | ||
| 3 | import Quickshell.Io | ||
| 4 | import QtQuick | ||
| 5 | import Quickshell.Widgets | ||
| 6 | |||
| 7 | Item { | ||
| 8 | id: root | ||
| 9 | |||
| 10 | required property string command | ||
| 11 | property var state: null | ||
| 12 | |||
| 13 | height: parent.height | ||
| 14 | width: label.contentWidth + 8 | ||
| 15 | anchors.verticalCenter: parent.verticalCenter | ||
| 16 | |||
| 17 | Process { | ||
| 18 | id: process | ||
| 19 | running: true | ||
| 20 | command: [ @worktime@, root.command, "--waybar" ] | ||
| 21 | stdout: StdioCollector { | ||
| 22 | id: processCollector | ||
| 23 | onStreamFinished: { | ||
| 24 | try { | ||
| 25 | root.state = JSON.parse(processCollector.text); | ||
| 26 | } catch (e) { | ||
| 27 | console.warn("Worktime: Failed to parse output:", processCollector.text, e); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | Timer { | ||
| 34 | running: true | ||
| 35 | interval: 60 | ||
| 36 | repeat: true | ||
| 37 | onTriggered: process.running = true | ||
| 38 | } | ||
| 39 | |||
| 40 | WrapperMouseArea { | ||
| 41 | id: mouseArea | ||
| 42 | |||
| 43 | anchors.fill: parent | ||
| 44 | |||
| 45 | enabled: true | ||
| 46 | hoverEnabled: true | ||
| 47 | |||
| 48 | Item { | ||
| 49 | anchors.fill: parent | ||
| 50 | |||
| 51 | Text { | ||
| 52 | id: label | ||
| 53 | |||
| 54 | anchors.centerIn: parent | ||
| 55 | |||
| 56 | visible: root.state?.text ?? false | ||
| 57 | text: root.state?.text ?? "" | ||
| 58 | |||
| 59 | font.pointSize: 10 | ||
| 60 | font.family: "Fira Sans" | ||
| 61 | color: { | ||
| 62 | if (root.state?.class == "running") | ||
| 63 | return "white"; | ||
| 64 | if (root.state?.class == "over") | ||
| 65 | return "#f28a21"; | ||
| 66 | return "#555"; | ||
| 67 | } | ||
| 68 | } | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | PopupWindow { | ||
| 73 | id: tooltip | ||
| 74 | |||
| 75 | property bool nextVisible: Boolean(root.state?.tooltip ?? false) && (mouseArea.containsMouse || tooltipMouseArea.containsMouse) | ||
| 76 | |||
| 77 | anchor { | ||
| 78 | item: mouseArea | ||
| 79 | edges: Edges.Bottom | Edges.Left | ||
| 80 | } | ||
| 81 | visible: false | ||
| 82 | |||
| 83 | onNextVisibleChanged: hangTimer.restart() | ||
| 84 | |||
| 85 | Timer { | ||
| 86 | id: hangTimer | ||
| 87 | interval: 100 | ||
| 88 | onTriggered: tooltip.visible = tooltip.nextVisible | ||
| 89 | } | ||
| 90 | |||
| 91 | implicitWidth: tooltipText.contentWidth + 16 | ||
| 92 | implicitHeight: tooltipText.contentHeight + 16 | ||
| 93 | color: "black" | ||
| 94 | |||
| 95 | WrapperMouseArea { | ||
| 96 | id: tooltipMouseArea | ||
| 97 | |||
| 98 | enabled: true | ||
| 99 | hoverEnabled: true | ||
| 100 | |||
| 101 | anchors.fill: parent | ||
| 102 | |||
| 103 | Item { | ||
| 104 | anchors.fill: parent | ||
| 105 | |||
| 106 | Text { | ||
| 107 | id: tooltipText | ||
| 108 | |||
| 109 | anchors.centerIn: parent | ||
| 110 | |||
| 111 | font.pointSize: 10 | ||
| 112 | font.family: "Fira Sans" | ||
| 113 | color: "white" | ||
| 114 | |||
| 115 | text: root.state?.tooltip ?? "" | ||
| 116 | } | ||
| 117 | } | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/shell.qml b/accounts/gkleen@sif/shell/quickshell/shell.qml index 693d741f..10c2eff6 100644 --- a/accounts/gkleen@sif/shell/quickshell/shell.qml +++ b/accounts/gkleen@sif/shell/quickshell/shell.qml | |||
| @@ -20,7 +20,8 @@ ShellRoot { | |||
| 20 | screen: screenScope.modelData | 20 | screen: screenScope.modelData |
| 21 | 21 | ||
| 22 | WlrLayershell.layer: WlrLayer.Background | 22 | WlrLayershell.layer: WlrLayer.Background |
| 23 | WlrLayershell.exclusionMode: ExclusionMode.Ignore | 23 | WlrLayershell.namespace: "background" |
| 24 | exclusionMode: ExclusionMode.Ignore | ||
| 24 | 25 | ||
| 25 | anchors.top: true | 26 | anchors.top: true |
| 26 | anchors.bottom: true | 27 | anchors.bottom: true |
