summaryrefslogtreecommitdiff
path: root/bar
diff options
context:
space:
mode:
Diffstat (limited to 'bar')
-rw-r--r--bar/Bar.qml23
-rw-r--r--bar/Workspace.qml41
2 files changed, 43 insertions, 21 deletions
diff --git a/bar/Bar.qml b/bar/Bar.qml
index 0591152..a18ad06 100644
--- a/bar/Bar.qml
+++ b/bar/Bar.qml
@@ -36,23 +36,32 @@ Scope {
rightMargin: Bar.rightMargin
}
+ color: "transparent"
+
+ Rectangle {
+ id: barBackground
+ anchors {
+ left: parent.left
+ }
+ implicitWidth: workspace.width + mpris.width
+ implicitHeight: leftRow.height
+ color: Qt.rgba(Colors.r, Colors.g, Colors.b, Bar.bgTransparency)
+ radius: Bar.moduleRadius
+ }
+
RowLayout {
id: leftRow
+ anchors.left: parent.left
+ anchors.leftMargin: 20
implicitWidth: (child.width - centerRow.width) / 2
implicitHeight: child.height
Workspace {
id: workspace
- Layout.preferredWidth: 5
- Layout.fillHeight: true
- Layout.fillWidth: true
- Layout.maximumWidth: 400 // FIXME
+ Layout.minimumWidth: 400 // FIXME
}
Mpris {
id: mpris
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.preferredWidth: 1
}
Item {
Layout.fillWidth: true
diff --git a/bar/Workspace.qml b/bar/Workspace.qml
index 0b0c672..6155bb5 100644
--- a/bar/Workspace.qml
+++ b/bar/Workspace.qml
@@ -2,7 +2,8 @@ import QtQuick.Layouts
import QtQuick
import Quickshell
import Quickshell.Hyprland
-import qs.config
+import qs.config as Config
+import qs.components
Item {
id: root
@@ -14,13 +15,14 @@ Item {
// return Hyprland.workspaces.values.some(ws => ws.id === workspaceGroup * Config.options.bar.workspaces.shown + i + 1);
// })
workspaceOccupied = Array.from({
- length: Bar.workspaces
+ length: Config.Bar.workspaces
}, (_, i) => {
return Hyprland.workspaces.values.some(ws => ws?.id === (i + 1));
});
}
+ // dont work no more for some reason
function isActive(index: int): bool {
- Hyprland.focusedWorkspace?.id.toString() == (index + 1).toString();
+ return Hyprland.focusedWorkspace?.id === (index + 1);
}
function isOccupied(index: int): bool {
return workspaceOccupied[index] === true;
@@ -37,24 +39,35 @@ Item {
RowLayout {
id: layout
- implicitWidth: parent.width
+ implicitWidth: childrenRect.width
anchors.verticalCenter: parent.verticalCenter
- spacing: 0
+ spacing: Config.Bar.workspaceSpacing
Repeater {
- model: Bar.workspaces
+ model: Config.Bar.workspaces
Rectangle {
- Text {
- text: Hyprland.focusedWorkspace?.id.toString() == (index + 1).toString()
- // text: isActive(index)
+ id: workspaceRect
+ // text: Hyprland.focusedWorkspace?.id.toString() == (index + 1).toString()
+ // text: isActive(index)
+
+ implicitWidth: !isActive(index) ? Config.Bar.workspaceIconSize : Config.Bar.workspaceActiveIconSize
+ implicitHeight: Config.Bar.workspaceIconSize - 10
+ anchors {
+ topMargin: 20
+ }
+ radius: Config.Bar.workspaceRounding
+ Icons {
+ anchors.centerIn: parent
+ text: Config.Icons.ws[index + 1]
+ font.pixelSize: Config.Bar.workspaceIconSize / 1.9
+ color: Config.Colors.foreground // TODO make IText w/ ts default color
+ // opacity: !isOccupied(index) ? 0 : 1 // less contrast
+ opacity: isActive(index) ? Config.Bar.workspaceActiveOpacity : isOccupied(index) ? Config.Bar.workspaceOpacity : Config.Bar.workspaceEmptyOpacity
}
- implicitWidth: 10
- implicitHeight: 10
- opacity: !isOccupied(index) ? 0.2 : 1
- // color: isActive(index) ? "#00ff00" : "#ffffff"
- color: "#000000"
+ color: isOccupied(index) ? Config.Colors.alt : Config.Colors.foreground
+ opacity: isActive(index) ? Config.Bar.workspaceActiveOpacity : isOccupied(index) ? Config.Bar.workspaceOpacity : Config.Bar.workspaceEmptyOpacity
}
}
}