blob: 5f5cae801908c25170caa2493dd7393588233a81 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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 {}
}
}
}
}
}
|