feat: vertical bar actually works!!!

This commit is contained in:
2 * r + 2 * t 2025-05-01 18:30:53 +10:00
parent 2809db1506
commit f98036a303
8 changed files with 31 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import QtQuick
Singleton { Singleton {
id: root id: root
property bool vertical: false property bool vertical: true
property Preset preset: presets.pills property Preset preset: presets.pills
readonly property Sizes sizes: preset.sizes readonly property Sizes sizes: preset.sizes
@ -26,9 +26,9 @@ Singleton {
} }
component Workspaces: QtObject { component Workspaces: QtObject {
property int shown: 10 property int shown: root.vertical ? 5 : 10
property bool rounded: true property bool rounded: true
property bool occupiedBg: true property bool occupiedBg: false
property bool showWindows: true property bool showWindows: true
property bool activeTrail: !showWindows // Doesn't work well with variable sized workspaces property bool activeTrail: !showWindows // Doesn't work well with variable sized workspaces
property string label: " " property string label: " "

View file

@ -19,7 +19,8 @@ Variants {
anchors.top: true anchors.top: true
anchors.left: true anchors.left: true
anchors.right: true // anchors.right: true
anchors.bottom: true
// Connections { // Connections {
// target: BarConfig // target: BarConfig

View file

@ -12,6 +12,7 @@ StyledRect {
return BarConfig.vertical ? vert : horiz; return BarConfig.vertical ? vert : horiz;
} }
vertical: BarConfig.vertical
color: Appearance.alpha(Appearance.colours.m3surface, false) color: Appearance.alpha(Appearance.colours.m3surface, false)
anchors.fill: parent anchors.fill: parent
@ -92,6 +93,8 @@ StyledRect {
Power { Power {
x: (BarConfig.sizes.height - width) / 2 x: (BarConfig.sizes.height - width) / 2
y: (BarConfig.sizes.height - height) / 2
color: Appearance.colours.m3onError color: Appearance.colours.m3onError
anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter) anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)

View file

@ -12,6 +12,7 @@ BoxLayout {
return BarConfig.vertical ? vert : horiz; return BarConfig.vertical ? vert : horiz;
} }
vertical: BarConfig.vertical
spacing: Appearance.padding.large spacing: Appearance.padding.large
anchors.fill: parent anchors.fill: parent
@ -98,6 +99,7 @@ BoxLayout {
Power { Power {
// Center in pill // Center in pill
x: (BarConfig.sizes.height - width) / 2 x: (BarConfig.sizes.height - width) / 2
y: (BarConfig.sizes.height - height) / 2
anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter) anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
anchors.verticalCenter: root.get(parent.verticalCenter, undefined) anchors.verticalCenter: root.get(parent.verticalCenter, undefined)

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import "root:/widgets" import "root:/widgets"
import "root:/services" import "root:/services"
import "root:/utils" import "root:/utils"
@ -18,16 +20,28 @@ StyledRect {
animate: true animate: true
text: Icons.getAppCategoryIcon(Hyprland.activeClient?.wmClass, "desktop_windows") text: Icons.getAppCategoryIcon(Hyprland.activeClient?.wmClass, "desktop_windows")
color: root.colour color: root.colour
anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
} }
AnchorText { AnchorText {
id: text
prevAnchor: icon prevAnchor: icon
text: metrics.elidedText text: metrics.elidedText
font.pointSize: metrics.font.pointSize font.pointSize: metrics.font.pointSize
font.family: metrics.font.family font.family: metrics.font.family
color: root.colour color: root.colour
rotation: vertical ? 90 : 0
transform: Rotation {
angle: vertical ? 90 : 0
origin.x: text.implicitHeight / 2
origin.y: text.implicitHeight / 2
}
width: vertical ? implicitHeight : implicitWidth
height: vertical ? implicitWidth : implicitHeight
} }
TextMetrics { TextMetrics {

View file

@ -13,6 +13,8 @@ StyledRect {
text: "calendar_month" text: "calendar_month"
color: root.colour color: root.colour
anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
} }
AnchorText { AnchorText {

View file

@ -20,6 +20,8 @@ StyledRect {
animate: true animate: true
text: Icons.getNetworkIcon(Network.active?.strength ?? 0) text: Icons.getNetworkIcon(Network.active?.strength ?? 0)
color: root.colour color: root.colour
anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
} }
AnchorText { AnchorText {

View file

@ -52,6 +52,8 @@ Item {
anchors.horizontalCenter: root.vertical ? indicator.horizontalCenter : undefined anchors.horizontalCenter: root.vertical ? indicator.horizontalCenter : undefined
sourceComponent: Box { sourceComponent: Box {
vertical: root.vertical
Repeater { Repeater {
model: ScriptModel { model: ScriptModel {
values: Hyprland.clients.filter(c => c.workspace?.id === root.ws) values: Hyprland.clients.filter(c => c.workspace?.id === root.ws)