bar shenanigan
This commit is contained in:
parent
0e869abffd
commit
32fec08a4e
6 changed files with 172 additions and 7 deletions
|
|
@ -3,4 +3,5 @@
|
|||
|
||||
hl.on("hyprland.start", function()
|
||||
hl.exec_cmd("systemctl --user start hyprpolkitagent")
|
||||
hl.exec_cmd("qs")
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
-- 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
|
||||
1
.config/quickshell/.qmlls.ini
Symbolic link
1
.config/quickshell/.qmlls.ini
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/run/user/1000/quickshell/vfs/cc942306bb82098c297252ee08d6cc3d/.qmlls.ini
|
||||
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
|
|
@ -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/
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -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"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue