aboutsummaryrefslogtreecommitdiffstats
path: root/home/quickshell/bar/Bar.qml
diff options
context:
space:
mode:
authorPetri Hienonen <petri.hienonen@gmail.com>2024-05-23 13:56:00 +0300
committerPetri Hienonen <petri.hienonen@gmail.com>2025-11-30 12:29:57 +0200
commit08297376a85a1719518507e54fca9de954d2376a (patch)
tree3b9c58304b40248533bbb2bb5b7bad2da9da1ff0 /home/quickshell/bar/Bar.qml
parent75c2af4aedd2ac5c2cfc74b346625fa4b265541d (diff)
downloadnixos-08297376a85a1719518507e54fca9de954d2376a.tar.zst
Agenix configuration
Diffstat (limited to 'home/quickshell/bar/Bar.qml')
-rw-r--r--home/quickshell/bar/Bar.qml115
1 files changed, 115 insertions, 0 deletions
diff --git a/home/quickshell/bar/Bar.qml b/home/quickshell/bar/Bar.qml
new file mode 100644
index 0000000..5f5cae8
--- /dev/null
+++ b/home/quickshell/bar/Bar.qml
@@ -0,0 +1,115 @@
+import Quickshell
+import Quickshell.Io
+import Quickshell.Hyprland
+import QtQuick
+import QtQuick.Layouts
+import "blocks" as Blocks
+import "root:/"
+
+Scope {
+ IpcHandler {
+ target: "bar"
+
+ function toggleVis(): void {
+ // Toggle visibility of all bar instances
+ for (let i = 0; i < Quickshell.screens.length; i++) {
+ barInstances[i].visible = !barInstances[i].visible;
+ }
+ }
+ }
+
+ property var barInstances: []
+
+ Variants {
+ model: Quickshell.screens
+
+ PanelWindow {
+ id: bar
+ property var modelData
+ screen: modelData
+
+ Component.onCompleted: {
+ barInstances.push(bar);
+ }
+
+ color: "transparent"
+
+ Rectangle {
+ id: highlight
+ anchors.fill: parent
+ color: Theme.get.barBgColor
+ }
+
+ height: 30
+
+ visible: true
+
+ anchors {
+ top: Theme.get.onTop
+ bottom: !Theme.get.onTop
+ left: true
+ right: true
+ }
+
+ RowLayout {
+ id: allBlocks
+ spacing: 0
+ anchors.fill: parent
+
+ // Left side
+ RowLayout {
+ id: leftBlocks
+ spacing: 10
+ Layout.alignment: Qt.AlignLeft
+ Layout.fillWidth: true
+
+ //Blocks.Icon {}
+ Blocks.Workspaces {}
+ }
+
+ Blocks.ActiveWorkspace {
+ id: activeWorkspace
+ Layout.leftMargin: 10
+ anchors.centerIn: undefined
+
+ chopLength: {
+ var space = Math.floor(bar.width - (rightBlocks.implicitWidth + leftBlocks.implicitWidth))
+ return space * 0.08;
+ }
+
+ text: {
+ var str = activeWindowTitle
+ return str.length > chopLength ? str.slice(0, chopLength) + '...' : str;
+ }
+
+ color: {
+ return Hyprland.focusedMonitor == Hyprland.monitorFor(screen)
+ ? "#FFFFFF" : "#CCCCCC"
+ }
+ }
+
+ // Without this filler item, the active window block will be centered
+ // despite setting left alignment
+ Item {
+ Layout.fillWidth: true
+ }
+
+ // Right side
+ RowLayout {
+ id: rightBlocks
+ spacing: 0
+ Layout.alignment: Qt.AlignRight
+ Layout.fillWidth: true
+
+ Blocks.SystemTray {}
+ Blocks.Memory {}
+ Blocks.Sound {}
+ Blocks.Battery {}
+ Blocks.Date {}
+ Blocks.Time {}
+ }
+ }
+ }
+ }
+}
+