From f6955608ede3e4a688a63457b2ffe9829e558d27 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 2 Sep 2025 12:42:34 +0200 Subject: ... --- accounts/gkleen@sif/shell/quickshell/Clock.qml | 22 ++-- .../shell/quickshell/WorkspaceSwitcher.qml | 117 +++++++++++++++++++++ 2 files changed, 132 insertions(+), 7 deletions(-) (limited to 'accounts/gkleen@sif') 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 { Layout.column: 1 Layout.fillWidth: true - delegate: Text { + delegate: WrapperItem { required property string shortName - font.pointSize: 10 - font.family: "Fira Mono" + width: dowLabel.contentWidth + 6 - text: shortName - color: "#ffcc66" + Text { + id: dowLabel - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter + anchors.fill: parent + + font.pointSize: 10 + font.family: "Fira Sans" + + text: parent.shortName + color: "#ffcc66" + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } } } 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 import QtQuick import qs.Services import Quickshell.Widgets +import QtQuick.Layouts Row { id: workspaces @@ -79,6 +80,122 @@ Row { } } } + + PopupWindow { + id: tooltip + + property bool nextVisible: (mouseArea.containsMouse || tooltipMouseArea.containsMouse) && [...windowsModel.values].length > 0 + + anchor { + item: mouseArea + edges: Edges.Bottom | Edges.Left + } + visible: false + + onNextVisibleChanged: hangTimer.restart() + + Timer { + id: hangTimer + interval: 100 + onTriggered: tooltip.visible = tooltip.nextVisible + } + + implicitWidth: tooltipContent.implicitWidth + implicitHeight: tooltipContent.implicitHeight + color: "black" + + WrapperMouseArea { + id: tooltipMouseArea + + hoverEnabled: true + enabled: true + + anchors.fill: parent + + WrapperItem { + id: tooltipContent + + margin: 0 + + ColumnLayout { + spacing: 0 + + Repeater { + model: ScriptModel { + id: windowsModel + + values: { + let currWindows = Array.from(NiriService.windows).filter(win => win.workspace_id == wsItem.workspaceData.id); + currWindows.sort((a, b) => { + if (a.is_floating !== b.is_floating) + return b.is_floating - a.is_floating; + if (a.layout.tile_pos_in_workspace_view?.[0] !== b.layout.tile_pos_in_workspace_view?.[0]) + return a.layout.tile_pos_in_workspace_view?.[0] - b.layout.tile_pos_in_workspace_view?.[0] + if (a.layout.tile_pos_in_workspace_view?.[1] !== b.layout.tile_pos_in_workspace_view?.[1]) + return a.layout.tile_pos_in_workspace_view?.[1] - b.layout.tile_pos_in_workspace_view?.[1] + if (a.layout.pos_in_scrolling_layout?.[0] !== b.layout.pos_in_scrolling_layout?.[0]) + return a.layout.pos_in_scrolling_layout?.[0] - b.layout.pos_in_scrolling_layout?.[0] + if (a.layout.pos_in_scrolling_layout?.[1] !== b.layout.pos_in_scrolling_layout?.[1]) + return a.layout.pos_in_scrolling_layout?.[1] - b.layout.pos_in_scrolling_layout?.[1] + if (a.app_id !== b.app_id) + return a.app_id.localeCompare(b.app_id); + + return a.title.localeCompare(b.title); + }); + return currWindows; + } + } + + WrapperMouseArea { + id: windowMouseArea + + property var windowData: modelData + + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + enabled: true + + Layout.fillWidth: true + + onClicked: { + NiriService.sendCommand({ "Action": { "FocusWindow": { "id": windowData.id } } }, _ => {}) + } + + WrapperRectangle { + color: windowMouseArea.containsMouse ? "#33808080" : "transparent"; + + anchors.fill: parent + + WrapperItem { + anchors.fill: parent + + margin: 4 + + Text { + id: windowLabel + + font.pointSize: 10 + font.family: "Fira Sans" + color: { + if (windowData.is_focused) + return "#23fd00"; + if (NiriService.workspaces.find(ws => ws.id == windowData.workspace_id)?.active_window_id == windowData.id) + return "white"; + return "#555"; + } + + text: windowData.title + + horizontalAlignment: Text.AlignLeft + } + } + } + } + } + } + } + } + } } } } -- cgit v1.2.3