diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-02 12:42:34 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-02 12:42:34 +0200 |
commit | f6955608ede3e4a688a63457b2ffe9829e558d27 (patch) | |
tree | 3c1842c59a422dd89b97a3d93714d1743e67c5d4 /accounts | |
parent | a4e9116570c5bc6fee8368d9ce16a24547026cba (diff) | |
download | nixos-f6955608ede3e4a688a63457b2ffe9829e558d27.tar nixos-f6955608ede3e4a688a63457b2ffe9829e558d27.tar.gz nixos-f6955608ede3e4a688a63457b2ffe9829e558d27.tar.bz2 nixos-f6955608ede3e4a688a63457b2ffe9829e558d27.tar.xz nixos-f6955608ede3e4a688a63457b2ffe9829e558d27.zip |
...
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Clock.qml | 22 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml | 117 |
2 files changed, 132 insertions, 7 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index a1872ff5..edce57e3 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml | |||
@@ -162,17 +162,25 @@ Item { | |||
162 | Layout.column: 1 | 162 | Layout.column: 1 |
163 | Layout.fillWidth: true | 163 | Layout.fillWidth: true |
164 | 164 | ||
165 | delegate: Text { | 165 | delegate: WrapperItem { |
166 | required property string shortName | 166 | required property string shortName |
167 | 167 | ||
168 | font.pointSize: 10 | 168 | width: dowLabel.contentWidth + 6 |
169 | font.family: "Fira Mono" | ||
170 | 169 | ||
171 | text: shortName | 170 | Text { |
172 | color: "#ffcc66" | 171 | id: dowLabel |
173 | 172 | ||
174 | horizontalAlignment: Text.AlignRight | 173 | anchors.fill: parent |
175 | verticalAlignment: Text.AlignVCenter | 174 | |
175 | font.pointSize: 10 | ||
176 | font.family: "Fira Sans" | ||
177 | |||
178 | text: parent.shortName | ||
179 | color: "#ffcc66" | ||
180 | |||
181 | horizontalAlignment: Text.AlignHCenter | ||
182 | verticalAlignment: Text.AlignVCenter | ||
183 | } | ||
176 | } | 184 | } |
177 | } | 185 | } |
178 | 186 | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml index 9546abb4..c8c017c3 100644 --- a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml +++ b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml | |||
@@ -2,6 +2,7 @@ import Quickshell | |||
2 | import QtQuick | 2 | import QtQuick |
3 | import qs.Services | 3 | import qs.Services |
4 | import Quickshell.Widgets | 4 | import Quickshell.Widgets |
5 | import QtQuick.Layouts | ||
5 | 6 | ||
6 | Row { | 7 | Row { |
7 | id: workspaces | 8 | id: workspaces |
@@ -79,6 +80,122 @@ Row { | |||
79 | } | 80 | } |
80 | } | 81 | } |
81 | } | 82 | } |
83 | |||
84 | PopupWindow { | ||
85 | id: tooltip | ||
86 | |||
87 | property bool nextVisible: (mouseArea.containsMouse || tooltipMouseArea.containsMouse) && [...windowsModel.values].length > 0 | ||
88 | |||
89 | anchor { | ||
90 | item: mouseArea | ||
91 | edges: Edges.Bottom | Edges.Left | ||
92 | } | ||
93 | visible: false | ||
94 | |||
95 | onNextVisibleChanged: hangTimer.restart() | ||
96 | |||
97 | Timer { | ||
98 | id: hangTimer | ||
99 | interval: 100 | ||
100 | onTriggered: tooltip.visible = tooltip.nextVisible | ||
101 | } | ||
102 | |||
103 | implicitWidth: tooltipContent.implicitWidth | ||
104 | implicitHeight: tooltipContent.implicitHeight | ||
105 | color: "black" | ||
106 | |||
107 | WrapperMouseArea { | ||
108 | id: tooltipMouseArea | ||
109 | |||
110 | hoverEnabled: true | ||
111 | enabled: true | ||
112 | |||
113 | anchors.fill: parent | ||
114 | |||
115 | WrapperItem { | ||
116 | id: tooltipContent | ||
117 | |||
118 | margin: 0 | ||
119 | |||
120 | ColumnLayout { | ||
121 | spacing: 0 | ||
122 | |||
123 | Repeater { | ||
124 | model: ScriptModel { | ||
125 | id: windowsModel | ||
126 | |||
127 | values: { | ||
128 | let currWindows = Array.from(NiriService.windows).filter(win => win.workspace_id == wsItem.workspaceData.id); | ||
129 | currWindows.sort((a, b) => { | ||
130 | if (a.is_floating !== b.is_floating) | ||
131 | return b.is_floating - a.is_floating; | ||
132 | if (a.layout.tile_pos_in_workspace_view?.[0] !== b.layout.tile_pos_in_workspace_view?.[0]) | ||
133 | return a.layout.tile_pos_in_workspace_view?.[0] - b.layout.tile_pos_in_workspace_view?.[0] | ||
134 | if (a.layout.tile_pos_in_workspace_view?.[1] !== b.layout.tile_pos_in_workspace_view?.[1]) | ||
135 | return a.layout.tile_pos_in_workspace_view?.[1] - b.layout.tile_pos_in_workspace_view?.[1] | ||
136 | if (a.layout.pos_in_scrolling_layout?.[0] !== b.layout.pos_in_scrolling_layout?.[0]) | ||
137 | return a.layout.pos_in_scrolling_layout?.[0] - b.layout.pos_in_scrolling_layout?.[0] | ||
138 | if (a.layout.pos_in_scrolling_layout?.[1] !== b.layout.pos_in_scrolling_layout?.[1]) | ||
139 | return a.layout.pos_in_scrolling_layout?.[1] - b.layout.pos_in_scrolling_layout?.[1] | ||
140 | if (a.app_id !== b.app_id) | ||
141 | return a.app_id.localeCompare(b.app_id); | ||
142 | |||
143 | return a.title.localeCompare(b.title); | ||
144 | }); | ||
145 | return currWindows; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | WrapperMouseArea { | ||
150 | id: windowMouseArea | ||
151 | |||
152 | property var windowData: modelData | ||
153 | |||
154 | hoverEnabled: true | ||
155 | cursorShape: Qt.PointingHandCursor | ||
156 | enabled: true | ||
157 | |||
158 | Layout.fillWidth: true | ||
159 | |||
160 | onClicked: { | ||
161 | NiriService.sendCommand({ "Action": { "FocusWindow": { "id": windowData.id } } }, _ => {}) | ||
162 | } | ||
163 | |||
164 | WrapperRectangle { | ||
165 | color: windowMouseArea.containsMouse ? "#33808080" : "transparent"; | ||
166 | |||
167 | anchors.fill: parent | ||
168 | |||
169 | WrapperItem { | ||
170 | anchors.fill: parent | ||
171 | |||
172 | margin: 4 | ||
173 | |||
174 | Text { | ||
175 | id: windowLabel | ||
176 | |||
177 | font.pointSize: 10 | ||
178 | font.family: "Fira Sans" | ||
179 | color: { | ||
180 | if (windowData.is_focused) | ||
181 | return "#23fd00"; | ||
182 | if (NiriService.workspaces.find(ws => ws.id == windowData.workspace_id)?.active_window_id == windowData.id) | ||
183 | return "white"; | ||
184 | return "#555"; | ||
185 | } | ||
186 | |||
187 | text: windowData.title | ||
188 | |||
189 | horizontalAlignment: Text.AlignLeft | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | } | ||
82 | } | 199 | } |
83 | } | 200 | } |
84 | } | 201 | } |