From 6fc103cf2421a854e2e557aa7eea4518381e59bd Mon Sep 17 00:00:00 2001 From: lucy Date: Tue, 2 Jun 2026 21:02:42 +0200 Subject: [PATCH] make dwm-like setup with 10 workspaces per monitor --- 2 | 62 +++++++++++++++++++++++++ Colors.qml | 32 ++++++------- modules/bar/Ws.qml | 107 +++++++++++++++++++++++++------------------- settings/Config.qml | 4 +- 4 files changed, 141 insertions(+), 64 deletions(-) create mode 100644 2 diff --git a/2 b/2 new file mode 100644 index 0000000..3894f9a --- /dev/null +++ b/2 @@ -0,0 +1,62 @@ +pragma ComponentBehavior: Bound +import Quickshell +import Quickshell.Hyprland +import Quickshell.Widgets +import QtQuick +import QtQuick.Layouts +import qs +import qs.widgets +import qs.settings + +Rectangle { + id: root + required property ShellScreen barScreen + required property double moduleHeight + property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) + radius: Config.rounding + color: 'transparent' + implicitWidth: wsLayout.implicitWidth + implicitHeight: moduleHeight + + RowLayout { + id: wsLayout + anchors.centerIn: root + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Repeater { + id: wsRepeater + model: 11 + delegate: Rectangle { + id: wsWrapper + implicitHeight: root.moduleHeight + implicitWidth: 16 + parent: wsLayout + color: 'transparent' + radius: Config.rounding + visible: Hyprland.workspaces?.values[modelData].monitor == root.hyprBarScreen + required property var modelData + StyledText { + anchors.centerIn: parent + text: wsWrapper.modelData + color: Hyprland.workspaces?.values[modelData].active ? Colors.base0D : Colors.base04 + opacity: parent.modelData.active ? 1.0 : 0.5 + } + Behavior on implicitWidth { + NumberAnimation { + easing.type: Easing.InOutBack + easing.amplitude: 2 + duration: 400 + easing.overshoot: 2 + } + } + MouseArea { + id: clickHandler + anchors.fill: parent + acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor + onClicked: parent.modelData.activate() + } + } + } + } +} diff --git a/Colors.qml b/Colors.qml index c23b961..c2c3ae2 100644 --- a/Colors.qml +++ b/Colors.qml @@ -3,24 +3,24 @@ import QtQuick QtObject { // --- The Backgrounds (Darkest to Lightest) --- - readonly property color base00: "#1d2021" // Default Background - readonly property color base01: "#3c3836" // Lighter Background (Status bars, panels) - readonly property color base02: "#504945" // Selection Background - readonly property color base03: "#665c54" // Comments, Invisibles, line highlighting + readonly property color base00: "#1e1e2e" // Default Background + readonly property color base01: "#181825" // Lighter Background (Status bars, panels) + readonly property color base02: "#313244" // Selection Background + readonly property color base03: "#45475a" // Comments, Invisibles, line highlighting // --- The Foregrounds (Darkest to Lightest) --- - readonly property color base04: "#bdae93" // Dark Foreground (Used for status bars) - readonly property color base05: "#d5c4a1" // Default Foreground, Caret - readonly property color base06: "#ebdbb2" // Light Foreground (Rarely used) - readonly property color base07: "#fbf1c7" // Lightest Foreground + readonly property color base04: "#585b70" // Dark Foreground (Used for status bars) + readonly property color base05: "#cdd6f4" // Default Foreground, Caret + readonly property color base06: "#f5e0dc" // Light Foreground (Rarely used) + readonly property color base07: "#b4befe" // Lightest Foreground // --- The Accent Colors --- - readonly property color base08: "#fb4934" // Red (Variables, errors) - readonly property color base09: "#fe8019" // Orange (Integers, booleans, constants) - readonly property color base0A: "#fabd2f" // Yellow (Classes, search text bg, warnings) - readonly property color base0B: "#b8bb26" // Green (Strings, success states) - readonly property color base0C: "#8ec07c" // Cyan (Support, regex, escape chars) - readonly property color base0D: "#83a598" // Blue (Functions, methods, headings) - readonly property color base0E: "#d3869b" // Purple/Mauve (Keywords, storage, selectors) - readonly property color base0F: "#d65d0e" // Brown/Flamingo (Deprecated, embedded tags) + readonly property color base08: "#f38ba8" // Red (Variables, errors) + readonly property color base09: "#fab387" // Orange (Integers, booleans, constants) + readonly property color base0A: "#f9e2af" // Yellow (Classes, search text bg, warnings) + readonly property color base0B: "#a6e3a1" // Green (Strings, success states) + readonly property color base0C: "#94e2d5" // Cyan (Support, regex, escape chars) + readonly property color base0D: "#89b4fa" // Blue (Functions, methods, headings) + readonly property color base0E: "#cba6f7" // Purple/Mauve (Keywords, storage, selectors) + readonly property color base0F: "#f2cdcd" // Brown/Flamingo (Deprecated, embedded tags) } diff --git a/modules/bar/Ws.qml b/modules/bar/Ws.qml index 6d44db4..0de8769 100644 --- a/modules/bar/Ws.qml +++ b/modules/bar/Ws.qml @@ -9,54 +9,67 @@ import qs.widgets import qs.settings Rectangle { - id: root - required property ShellScreen barScreen - required property double moduleHeight - property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) - radius: Config.rounding - color: 'transparent' - implicitWidth: wsLayout.implicitWidth - implicitHeight: moduleHeight + id: root + required property ShellScreen barScreen + required property double moduleHeight + property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) - RowLayout { - id: wsLayout - anchors.centerIn: root - anchors.horizontalCenter: parent.horizontalCenter - spacing: 0 - Repeater { - id: wsRepeater - model: Hyprland.workspaces - delegate: Rectangle { - id: wsWrapper - implicitHeight: root.moduleHeight - implicitWidth: 16 - parent: wsLayout - color: 'transparent' - radius: Config.rounding - visible: modelData.monitor == root.hyprBarScreen - required property var modelData - StyledText { - anchors.centerIn: parent - text: wsWrapper.modelData.id - color: parent.modelData.active ? Colors.base0D : Colors.base04 - opacity: parent.modelData.active ? 1.0 : 0.5 + // split-monitor-workspaces numbering: each monitor owns `count` (10) + // workspaces. eDP-1 -> ids 1..10, DP-2 -> ids 11..20. The offset is the + // first id on this monitor, minus 1. + property int wsIdOffset: root.barScreen.name != Config.primaryMon ? 10 : 0 + + radius: Config.rounding + color: 'transparent' + implicitWidth: wsLayout.implicitWidth + implicitHeight: moduleHeight + + RowLayout { + id: wsLayout + anchors.centerIn: root + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Repeater { + id: wsRepeater + model: 10 + delegate: Rectangle { + id: wsWrapper + required property var modelData + + property int wsId: root.wsIdOffset + modelData + 1 + + property var ws: { + const vals = Hyprland.workspaces.values; + for (let i = 0; i < vals.length; ++i) { + if (vals[i].id === wsWrapper.wsId) + return vals[i]; + } + return null; + } + + property bool active: wsWrapper.ws ? wsWrapper.ws.active : false + property bool vacant: !wsWrapper.ws || wsWrapper.ws.toplevels.values.length === 0 + + implicitHeight: root.moduleHeight + implicitWidth: 16 + parent: wsLayout + color: 'transparent' + radius: Config.rounding + + StyledText { + anchors.centerIn: parent + text: wsWrapper.modelData + 1 + color: wsWrapper.active ? Colors.base0D : Colors.base05 + opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0 + } + MouseArea { + id: clickHandler + anchors.fill: parent + acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor + onClicked: Hyprland.dispatch("workspace " + wsWrapper.wsId) + } + } } - Behavior on implicitWidth { - NumberAnimation { - easing.type: Easing.InOutBack - easing.amplitude: 2 - duration: 400 - easing.overshoot: 2 - } - } - MouseArea { - id: clickHandler - anchors.fill: parent - acceptedButtons: Qt.LeftButton - cursorShape: Qt.PointingHandCursor - onClicked: parent.modelData.activate() - } - } } - } } diff --git a/settings/Config.qml b/settings/Config.qml index aeca640..2dcee41 100644 --- a/settings/Config.qml +++ b/settings/Config.qml @@ -9,10 +9,11 @@ Singleton { property int fontSize: 12 property int iconSize: 14 property int barHeight: 30 - property int rounding: 0 + property int rounding: 16 property url wallpaper: "file:///home/lucy/.walls/frierensuff.png" property bool floating: false property double opacity: 1.0 + property string primaryMon: "DP-2" Settings { location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini") @@ -22,5 +23,6 @@ Singleton { property alias roudning: root.rounding property alias wallpaper: root.wallpaper property alias opacity: root.opacity + property string primaryMon: root.primaryMon } }