From 32fec08a4e821c6294c7ef0894a43e279e058455 Mon Sep 17 00:00:00 2001 From: Tsuzura Date: Tue, 2 Jun 2026 10:26:57 -0400 Subject: [PATCH] bar shenanigan --- .config/hypr/modules/autostart.lua | 1 + .config/hypr/modules/monitors.lua | 12 +-- .config/quickshell/.qmlls.ini | 1 + .config/quickshell/shell.qml | 136 +++++++++++++++++++++++++++++ .gitignore | 25 ++++++ .vscode/settings.json | 4 +- 6 files changed, 172 insertions(+), 7 deletions(-) mode change 100644 => 120000 .config/quickshell/.qmlls.ini create mode 100644 .gitignore diff --git a/.config/hypr/modules/autostart.lua b/.config/hypr/modules/autostart.lua index e136a45..07da765 100644 --- a/.config/hypr/modules/autostart.lua +++ b/.config/hypr/modules/autostart.lua @@ -3,4 +3,5 @@ hl.on("hyprland.start", function() hl.exec_cmd("systemctl --user start hyprpolkitagent") + hl.exec_cmd("qs") end) diff --git a/.config/hypr/modules/monitors.lua b/.config/hypr/modules/monitors.lua index 4e2bade..6ad346e 100644 --- a/.config/hypr/modules/monitors.lua +++ b/.config/hypr/modules/monitors.lua @@ -4,14 +4,14 @@ hl.monitor({ output = "DP-2", mode = "1920x1080@60", position = "0x0", scale = 1 }) hl.monitor({ output = "DP-3", mode = "1920x1080@165", position = "1920x0", scale = 1, supports_hdr = 1 }) --- Workspaces 1-5 → DP-2 (165Hz, main), 6-10 → DP-1 (60Hz, secondary) +-- Workspaces 1-5 → DP-3 (165Hz, main), 6-10 → DP-2 (60Hz, secondary) local monitor_map = { ["DP-3"] = {1, 2, 3, 4, 5}, ["DP-2"] = {6, 7, 8, 9, 10}, } -for monitor, workspaces in pairs(monitor_map) do - for _, ws in ipairs(workspaces) do - hl.workspace_rule({ workspace = tostring(ws), monitor = monitor, persistent = true }) - end -end \ No newline at end of file +-- for monitor, workspaces in pairs(monitor_map) do +-- for _, ws in ipairs(workspaces) do +-- hl.workspace_rule({ workspace = tostring(ws), monitor = monitor, persistent = true }) +-- end +-- end \ No newline at end of file diff --git a/.config/quickshell/.qmlls.ini b/.config/quickshell/.qmlls.ini deleted file mode 100644 index e69de29..0000000 diff --git a/.config/quickshell/.qmlls.ini b/.config/quickshell/.qmlls.ini new file mode 120000 index 0000000..f38bd63 --- /dev/null +++ b/.config/quickshell/.qmlls.ini @@ -0,0 +1 @@ +/run/user/1000/quickshell/vfs/cc942306bb82098c297252ee08d6cc3d/.qmlls.ini \ No newline at end of file diff --git a/.config/quickshell/shell.qml b/.config/quickshell/shell.qml index e69de29..f2268dc 100644 --- a/.config/quickshell/shell.qml +++ b/.config/quickshell/shell.qml @@ -0,0 +1,136 @@ +// qmllint disable uncreatable-type +pragma ComponentBehavior: Bound +import Quickshell +import Quickshell.Wayland +import Quickshell.Hyprland +import Quickshell.Io +import QtQuick +import QtQuick.Layouts + + +ShellRoot { + Variants { + model: Quickshell.screens + + PanelWindow { + id: root + required property var modelData + screen: modelData + + property int wsCount: 5 + property int wsOffset: { + const sorted = [...Quickshell.screens].sort((a, b) => + b.name.localeCompare(a.name)) + return sorted.indexOf(modelData) * wsCount + } + + // Theme - Define once, use everywhere + property color colbg: "#1a1b26" + property color colCyan: "#0db9d7" + property color colBlue: "#7aa2f7" + property color colYellow: "#e0af68" + property string fontFamily: "JetBrainMono Nerd Font" + + property int cpuUsage: 0 + property var lastCpuIdle: 0 + property var lastCpuTotal: 0 + + Process { + id: cpuProc + command: ["sh", "-c", "while true; do awk 'NR==1{print; exit}' /proc/stat; sleep 2; done"] + stdout: SplitParser { + onRead: data => { + if (!data) return + const p = data.trim().split(/\s+/) + const idle = parseInt(p[4]) + parseInt(p[5]) + const total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0) + if (root.lastCpuTotal > 0) { + root.cpuUsage = Math.round(100 * (1 - (idle - root.lastCpuIdle) / (total - root.lastCpuTotal))) + } + root.lastCpuTotal = total + root.lastCpuIdle = idle + } + } + Component.onCompleted: running = true + + } + + SystemClock { + id: clock + precision: SystemClock.Minutes + } + + + anchors { + top: true + left: true + right: true + } + + implicitHeight: 30 + color: colbg + + RowLayout { + anchors { + fill: parent + margins: 8 + } + + + + // Repeter creates 5 copies, each gets an index (0-4) + Repeater { + model: root.wsCount + + Item { + required property int index + + Layout.preferredWidth: 12 + Layout.preferredHeight: 12 + property bool hovered: false + // live data from hyprland + property int wsId: root.wsOffset + index + 1 + property var ws: Hyprland.workspaces.values.find(w => w.id === wsId) + property bool isActive: ws ? ws.active : false + + Text { + anchors.centerIn: parent + text: parent.wsId + color: parent.isActive ? root.colCyan + : parent.hovered ? Qt.lighter(parent.ws ? root.colBlue : "#444b6a", 1.5) + : root.colBlue + Behavior on color { ColorAnimation { duration: 80 } } + font { pixelSize: 12; bold: true } + } + + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: parent.hovered = true + onExited: parent.hovered = false + onClicked: if (parent.ws) parent.ws.activate() + } + } + } + + Item { Layout.fillWidth: true } + + Text { + text: Qt.formatTime(clock.date, "hh:mm") + color: root.colCyan + font { family: root.fontFamily; pixelSize: 14; bold: true } + } + + Item { Layout.fillWidth: true } // left spacer + + Text { + text: "CPU " + root.cpuUsage + "%" + color: root.colYellow + font { family: root.fontFamily; pixelSize: 12; bold:true } + } + } + + } + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..64a956c --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Quickshell LSP (system-specific, auto-generated) +**/.qmlls.ini + +# Editor cruft +.vscode/settings.json # if you don't want to track editor settings +**/.DS_Store # if you ever touch a Mac + +# Compiled / cache +__pycache__/ +*.pyc +*.o +*.so + +# Shell history / sensitive files +.env +.secrets +*_history +.bash_history +.zsh_history + +# Logs +*.log + +# Package manager leftovers +node_modules/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 25c8ddf..30cc8f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,7 @@ { "Lua.workspace.library": [ "/usr/share/hypr/stubs" - ] + ], + "qt-qml.qmlls.useQmlImportPathEnvVar": true, + "qt-qml.qmlls.customExePath": "/usr/lib/qt6/bin/qmlls" } \ No newline at end of file