initial quickshell config

This commit is contained in:
veneficium 2025-11-10 19:38:38 +01:00
parent 288c35032e
commit b72bbb4120
2 changed files with 167 additions and 0 deletions

View file

@ -20,6 +20,14 @@
settings = builtins.fromJSON (builtins.readFile ./swaylock.json); settings = builtins.fromJSON (builtins.readFile ./swaylock.json);
}; };
programs.quickshell = {
enable = true;
configs = {
"default" = ./shell.qml;
};
activeConfig = "default";
};
services.mako = { services.mako = {
enable = true; enable = true;
settings = { settings = {

159
modules/home/niri/shell.qml Normal file
View file

@ -0,0 +1,159 @@
import Quickshell
import QtQuick
import QtQuick.Layouts
import Quickshell.Widgets
import Quickshell.Services.SystemTray
import Quickshell.Services.Pipewire
import Quickshell.Io
PanelWindow {
component Pill: Rectangle {
default property alias data: inner.data
color: Qt.rgba(0.6,0.6,0.6,0.4)
radius: height / 2.0 - 2.0
implicitWidth: inner.implicitWidth + 8.0 * 2
implicitHeight: inner.implicitHeight + 3.0 * 2
Item {
id: inner
anchors.centerIn: parent
implicitWidth: inner.childrenRect.width
implicitHeight: inner.childrenRect.height
}
}
component Tray: WrapperItem {
implicitWidth: inner.implicitWidth
implicitHeight: inner.implicitHeight
RowLayout {
id: inner
Repeater {
model: SystemTray.items.values
IconImage {
id: tray_item
required property SystemTrayItem modelData
source: modelData.icon
visible: !modelData.icon.includes("?path=")
implicitSize: 22.5
PopupWindow {
id: label
visible: hover_handler.hovered && hover_text.width
implicitWidth: hover_text.width
implicitHeight: hover_text.height + 2.0
anchor.item: tray_item
anchor.rect.y: tray_item.height + 2.0
anchor.rect.x: (tray_item.width - this.width) / 2.0
color: "black"
Text {
id: hover_text
text: tray_item.modelData.tooltipTitle || tray_item.modelData.title
color: "white"
}
}
HoverHandler {
id: hover_handler
}
TapHandler {
onTapped: (eventPoint, button) => {
if (button == 1) {
tray_item.modelData.activate();
} else {
tray_item.modelData.display(label, 0, 0);
}
}
}
}
}
}
}
anchors {
top: true
left: true
right: true
}
implicitHeight: 35
color: "transparent"
Rectangle {
color: Qt.rgba(0.3,0.3,0.3,0.5)
anchors.fill: parent
anchors.leftMargin: 11
anchors.rightMargin: 11
radius: 11
}
SystemClock {
id: clock
precision: SystemClock.Seconds
}
Pill {
Text {
text: Qt.formatDateTime(clock.date, "hh:mm dd-MM")
color: "white"
}
anchors.centerIn: parent
}
Pill {
anchors.horizontalCenter: parent.left
anchors.horizontalCenterOffset: (width / 2.0) + 30.0
anchors.verticalCenter: parent.verticalCenter
Text {
text: "left"
color: "white"
}
}
Item {
anchors.horizontalCenter: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenterOffset: -((width / 2.0) + 30.0)
RowLayout {
id: right_row
anchors.centerIn: parent
anchors.horizontalCenterOffset: -(width / 2.0)
PwObjectTracker {objects: [Pipewire.defaultAudioSink]}
FileView {
id: batteryFile
path: "/sys/class/power_supply/BAT1/capacity"
watchChanges: true
onFileChanged: this.reload()
blockLoading: true
}
Pill {
Text {
color: "white"
text: `bat: ${batteryFile.text().slice(0,2)}%`
}
}
Pill {
Text {
text: `vol: ${Math.round(Pipewire.defaultAudioSink.audio.volume * 100)}%`
color: "white"
}
}
Pill {
Text {
color: "white"
text: Pipewire.defaultAudioSink.description.slice(0, 15)
}
}
Pill {
Tray {}
}
}
}
}