diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-01 15:12:09 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-01 15:12:09 +0200 |
| commit | 85bf62eaa2fd71eb15ef401e537457fb9098a540 (patch) | |
| tree | 707e7f4ea5b0d55992eae062ad7ed4795c1105c8 /accounts/gkleen@sif | |
| parent | c9b4c6834e390f051e3137a6a45882ea8608ee9d (diff) | |
| download | nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar.gz nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar.bz2 nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar.xz nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.zip | |
...
Diffstat (limited to 'accounts/gkleen@sif')
4 files changed, 102 insertions, 76 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index 55fabd1c..d645cfa7 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml | |||
| @@ -7,6 +7,8 @@ import QtQuick.Layouts | |||
| 7 | import Quickshell.Widgets | 7 | import Quickshell.Widgets |
| 8 | 8 | ||
| 9 | Item { | 9 | Item { |
| 10 | id: clockItem | ||
| 11 | |||
| 10 | width: clock.contentWidth | 12 | width: clock.contentWidth |
| 11 | height: parent.height | 13 | height: parent.height |
| 12 | anchors.verticalCenter: parent.verticalCenter | 14 | anchors.verticalCenter: parent.verticalCenter |
| @@ -30,22 +32,26 @@ Item { | |||
| 30 | 32 | ||
| 31 | onWheel: event => scrollYear(event) | 33 | onWheel: event => scrollYear(event) |
| 32 | 34 | ||
| 33 | Text { | 35 | Item { |
| 34 | id: clock | 36 | anchors.fill: parent |
| 35 | color: "white" | ||
| 36 | 37 | ||
| 37 | anchors.verticalCenter: parent.verticalCenter | 38 | Text { |
| 39 | id: clock | ||
| 40 | color: "white" | ||
| 38 | 41 | ||
| 39 | Custom.Chrono { | 42 | anchors.verticalCenter: parent.verticalCenter |
| 40 | id: chrono | ||
| 41 | format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}" | ||
| 42 | } | ||
| 43 | 43 | ||
| 44 | text: chrono.date | 44 | Custom.Chrono { |
| 45 | id: chrono | ||
| 46 | format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}" | ||
| 47 | } | ||
| 48 | |||
| 49 | text: chrono.date | ||
| 45 | 50 | ||
| 46 | font.pointSize: 10 | 51 | font.pointSize: 10 |
| 47 | font.family: "Fira Sans" | 52 | font.family: "Fira Sans" |
| 48 | font.features: { "tnum": 1 } | 53 | font.features: { "tnum": 1 } |
| 54 | } | ||
| 49 | } | 55 | } |
| 50 | } | 56 | } |
| 51 | 57 | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml index 4a6b8390..bc3750f9 100644 --- a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml +++ b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml | |||
| @@ -3,18 +3,8 @@ import QtQuick | |||
| 3 | import qs.Services | 3 | import qs.Services |
| 4 | import Quickshell.Widgets | 4 | import Quickshell.Widgets |
| 5 | 5 | ||
| 6 | Rectangle { | 6 | Item { |
| 7 | id: kbdWidget | ||
| 8 | |||
| 9 | property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } | ||
| 10 | |||
| 11 | width: kbdLabel.contentWidth + 8 | 7 | width: kbdLabel.contentWidth + 8 |
| 12 | color: { | ||
| 13 | if (kbdMouseArea.containsMouse) { | ||
| 14 | return "#33808080"; | ||
| 15 | } | ||
| 16 | return "transparent"; | ||
| 17 | } | ||
| 18 | height: parent.height | 8 | height: parent.height |
| 19 | anchors.verticalCenter: parent.verticalCenter | 9 | anchors.verticalCenter: parent.verticalCenter |
| 20 | 10 | ||
| @@ -22,6 +12,7 @@ Rectangle { | |||
| 22 | id: kbdMouseArea | 12 | id: kbdMouseArea |
| 23 | 13 | ||
| 24 | anchors.fill: parent | 14 | anchors.fill: parent |
| 15 | |||
| 25 | hoverEnabled: true | 16 | hoverEnabled: true |
| 26 | cursorShape: Qt.PointingHandCursor | 17 | cursorShape: Qt.PointingHandCursor |
| 27 | enabled: true | 18 | enabled: true |
| @@ -32,23 +23,37 @@ Rectangle { | |||
| 32 | NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) | 23 | NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) |
| 33 | } | 24 | } |
| 34 | 25 | ||
| 35 | Text { | 26 | Rectangle { |
| 36 | id: kbdLabel | 27 | id: kbdWidget |
| 37 | 28 | ||
| 38 | font.pointSize: 10 | 29 | property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } |
| 39 | font.family: "Fira Sans" | 30 | |
| 31 | anchors.fill: parent | ||
| 40 | color: { | 32 | color: { |
| 41 | if (NiriService.keyboardLayouts?.current_idx === 0) | 33 | if (kbdMouseArea.containsMouse) { |
| 42 | return "#555"; | 34 | return "#33808080"; |
| 43 | return "white"; | 35 | } |
| 36 | return "transparent"; | ||
| 44 | } | 37 | } |
| 45 | anchors.centerIn: parent | ||
| 46 | 38 | ||
| 47 | text: { | 39 | Text { |
| 48 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | 40 | id: kbdLabel |
| 49 | if (!currentLayout) | 41 | |
| 50 | return ""; | 42 | font.pointSize: 10 |
| 51 | return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; | 43 | font.family: "Fira Sans" |
| 44 | color: { | ||
| 45 | if (NiriService.keyboardLayouts?.current_idx === 0) | ||
| 46 | return "#555"; | ||
| 47 | return "white"; | ||
| 48 | } | ||
| 49 | anchors.centerIn: parent | ||
| 50 | |||
| 51 | text: { | ||
| 52 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | ||
| 53 | if (!currentLayout) | ||
| 54 | return ""; | ||
| 55 | return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; | ||
| 56 | } | ||
| 52 | } | 57 | } |
| 53 | } | 58 | } |
| 54 | } | 59 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml index 024026a3..55b1690e 100644 --- a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml +++ b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml | |||
| @@ -17,10 +17,12 @@ Item { | |||
| 17 | spacing: 0 | 17 | spacing: 0 |
| 18 | 18 | ||
| 19 | Repeater { | 19 | Repeater { |
| 20 | model: { | 20 | model: ScriptModel { |
| 21 | var trayItems = Array.from(SystemTray.items.values).filter(item => item.status !== Status.Passive); | 21 | values: { |
| 22 | trayItems.sort((a, b) => a.category !== b.category ? b.category - a.category : a.id.localeCompare(b.id)) | 22 | var trayItems = Array.from(SystemTray.items.values).filter(item => item.status !== Status.Passive); |
| 23 | return trayItems; | 23 | trayItems.sort((a, b) => a.category !== b.category ? b.category - a.category : a.id.localeCompare(b.id)) |
| 24 | return trayItems; | ||
| 25 | } | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | delegate: Item { | 28 | delegate: Item { |
diff --git a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml index 153c56bb..9546abb4 100644 --- a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml +++ b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | import Quickshell | ||
| 1 | import QtQuick | 2 | import QtQuick |
| 2 | import qs.Services | 3 | import qs.Services |
| 4 | import Quickshell.Widgets | ||
| 3 | 5 | ||
| 4 | Row { | 6 | Row { |
| 5 | id: workspaces | 7 | id: workspaces |
| @@ -11,61 +13,72 @@ Row { | |||
| 11 | spacing: 0 | 13 | spacing: 0 |
| 12 | 14 | ||
| 13 | Repeater { | 15 | Repeater { |
| 14 | model: { | 16 | model: ScriptModel { |
| 15 | let currWorkspaces = NiriService.workspaces; | 17 | values: { |
| 16 | const ignoreWorkspaces = Array.from(workspaces.ignoreWorkspaces); | 18 | let currWorkspaces = NiriService.workspaces; |
| 17 | currWorkspaces = currWorkspaces.filter(ws => ws.is_active || ignoreWorkspaces.every(iws => iws !== ws.name)); | 19 | const ignoreWorkspaces = Array.from(workspaces.ignoreWorkspaces); |
| 18 | currWorkspaces.sort((a, b) => { | 20 | currWorkspaces = currWorkspaces.filter(ws => ws.is_active || ignoreWorkspaces.every(iws => iws !== ws.name)); |
| 19 | if (NiriService.outputs?.[a.output]?.logical?.x !== NiriService.outputs?.[b.output]?.logical?.x) | 21 | currWorkspaces.sort((a, b) => { |
| 20 | return NiriService.outputs?.[a.output]?.logical?.x - NiriService.outputs?.[b.output]?.logical?.x | 22 | if (NiriService.outputs?.[a.output]?.logical?.x !== NiriService.outputs?.[b.output]?.logical?.x) |
| 21 | if (NiriService.outputs?.[a.output]?.logical?.y !== NiriService.outputs?.[b.output]?.logical?.y) | 23 | return NiriService.outputs?.[a.output]?.logical?.x - NiriService.outputs?.[b.output]?.logical?.x |
| 22 | return NiriService.outputs?.[a.output]?.logical?.y - NiriService.outputs?.[b.output]?.logical?.y | 24 | if (NiriService.outputs?.[a.output]?.logical?.y !== NiriService.outputs?.[b.output]?.logical?.y) |
| 23 | return a.idx - b.idx; | 25 | return NiriService.outputs?.[a.output]?.logical?.y - NiriService.outputs?.[b.output]?.logical?.y |
| 24 | }); | 26 | return a.idx - b.idx; |
| 25 | return currWorkspaces; | 27 | }); |
| 28 | return currWorkspaces; | ||
| 29 | } | ||
| 26 | } | 30 | } |
| 27 | 31 | ||
| 28 | Rectangle { | 32 | Item { |
| 33 | id: wsItem | ||
| 34 | |||
| 29 | property var workspaceData: modelData | 35 | property var workspaceData: modelData |
| 30 | 36 | ||
| 31 | width: wsLabel.contentWidth + 8 | 37 | width: wsLabel.contentWidth + 8 |
| 32 | color: { | ||
| 33 | if (mouseArea.containsMouse) { | ||
| 34 | return "#33808080"; | ||
| 35 | } | ||
| 36 | return "transparent"; | ||
| 37 | } | ||
| 38 | height: parent.height | 38 | height: parent.height |
| 39 | anchors.verticalCenter: parent.verticalCenter | 39 | anchors.verticalCenter: parent.verticalCenter |
| 40 | 40 | ||
| 41 | MouseArea { | 41 | WrapperMouseArea { |
| 42 | id: mouseArea | 42 | id: mouseArea |
| 43 | 43 | ||
| 44 | anchors.fill: parent | 44 | anchors.fill: parent |
| 45 | |||
| 45 | hoverEnabled: true | 46 | hoverEnabled: true |
| 46 | cursorShape: Qt.PointingHandCursor | 47 | cursorShape: Qt.PointingHandCursor |
| 47 | enabled: true | 48 | enabled: true |
| 48 | onClicked: { | 49 | onClicked: { |
| 49 | NiriService.sendCommand({ "Action": { "FocusWorkspace": { "reference": { "Id": workspaceData.id } } } }, _ => {}) | 50 | NiriService.sendCommand({ "Action": { "FocusWorkspace": { "reference": { "Id": workspaceData.id } } } }, _ => {}) |
| 50 | } | 51 | } |
| 51 | } | ||
| 52 | 52 | ||
| 53 | Text { | 53 | Rectangle { |
| 54 | id: wsLabel | 54 | anchors.fill: parent |
| 55 | 55 | ||
| 56 | font.pointSize: 10 | 56 | color: { |
| 57 | font.family: "Fira Sans" | 57 | if (mouseArea.containsMouse) { |
| 58 | color: { | 58 | return "#33808080"; |
| 59 | if (workspaceData.is_active) | 59 | } |
| 60 | return "#23fd00"; | 60 | return "transparent"; |
| 61 | if (workspaceData.active_window_id === null) | 61 | } |
| 62 | return "#555"; | 62 | |
| 63 | return "white"; | 63 | Text { |
| 64 | } | 64 | id: wsLabel |
| 65 | anchors.centerIn: parent | ||
| 66 | 65 | ||
| 67 | text: workspaceData.name ? workspaceData.name : workspaceData.idx | 66 | anchors.centerIn: parent |
| 67 | |||
| 68 | font.pointSize: 10 | ||
| 69 | font.family: "Fira Sans" | ||
| 70 | color: { | ||
| 71 | if (workspaceData.is_active) | ||
| 72 | return "#23fd00"; | ||
| 73 | if (workspaceData.active_window_id === null) | ||
| 74 | return "#555"; | ||
| 75 | return "white"; | ||
| 76 | } | ||
| 77 | |||
| 78 | text: workspaceData.name ? workspaceData.name : workspaceData.idx | ||
| 79 | } | ||
| 80 | } | ||
| 68 | } | 81 | } |
| 69 | } | 82 | } |
| 70 | } | 83 | } |
| 71 | } \ No newline at end of file | 84 | } |
