Quickshell modularization

This commit is contained in:
xbazzi 2025-08-09 12:19:39 -06:00
parent 4948d71006
commit 6fda1ca083
2 changed files with 59 additions and 52 deletions

View File

@ -3,62 +3,17 @@
{
home.packages = [ pkgs.quickshell ];
home.file.".config/quickshell" = {
source = ./quickshell;
recursive = true;
};
# start it when Hyprland starts
wayland.windowManager.hyprland.settings.exec-once = [
"quickshell -c default"
];
# write the Quickshell config
xdg.configFile."quickshell/default/shell.qml".text = ''
import Quickshell
import Quickshell.Io
import QtQuick
// one window per screen
Variants {
model: Quickshell.screens
delegate: Component {
PanelWindow {
required property var modelData
screen: modelData
// top bar, full width
anchors.top: true
anchors.left: true
anchors.right: true
implicitHeight: 30 // tweak height if yuh want
Rectangle {
anchors.fill: parent
color: "#1a1a1a"
opacity: 0.92
}
// center clock
Text {
id: clock
anchors.centerIn: parent
font.pixelSize: 13
color: "#e6e6e6"
}
// update clock every second using `date`
Process {
id: dateProc
command: [ "date", "+%a %b %d %H:%M:%S" ]
running: true
stdout: StdioCollector {
onStreamFinished: clock.text = this.text.trim()
}
}
Timer {
interval: 1000
running: true
repeat: true
onTriggered: dateProc.running = true
}
}
}
}
'';
# xdg.configFile."quickshell/default/shell.qml".text = ''
# '';
}

52
home/quickshell/shell.qml Normal file
View File

@ -0,0 +1,52 @@
import Quickshell
import Quickshell.Io
import QtQuick
// one window per screen
Variants {
model: Quickshell.screens
delegate: Component {
PanelWindow {
required property var modelData
screen: modelData
// top bar, full width
anchors.top: true
anchors.left: true
anchors.right: true
implicitHeight: 30 // tweak height if yuh want
Rectangle {
anchors.fill: parent
color: "#1a1a1a"
opacity: 0.5
}
// center clock
Text {
id: clock
//anchors.centerIn: parent
anchors.top: true
anchors.left: true
font.pixelSize: 13
color: "#e6e6e6"
}
// update clock every second using `date`
Process {
id: dateProc
command: [ "date", "+%a %b %d %H:%M:%S" ]
running: true
stdout: StdioCollector {
onStreamFinished: clock.text = this.text.trim()
}
}
Timer {
interval: 1000
running: true
repeat: true
onTriggered: dateProc.running = true
}
}
}
}