diff options
| author | Laurens Duin <85798751+Laurens256@users.noreply.github.com> | 2025-08-13 06:31:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-13 14:31:48 +1000 |
| commit | 3710df29f588c2aa430d9797a36afa1cbd85b128 (patch) | |
| tree | 5f804118369ab2db0dbffbbd604b4ddc33af93ed /modules/bar/components/workspaces | |
| parent | nix: add home manager module (#402) (diff) | |
| download | caelestia-shell-3710df29f588c2aa430d9797a36afa1cbd85b128.tar.gz caelestia-shell-3710df29f588c2aa430d9797a36afa1cbd85b128.tar.bz2 caelestia-shell-3710df29f588c2aa430d9797a36afa1cbd85b128.zip | |
bar: allow hiding items and reordering (#379)
* feat: reorder bar, no popout yet
* chore: cleanup
* refactor: use DelegateChooser
* feat: popouts
* chore: cleanup
* better popout check + fix async stuff + bar interaction
+ a bunch of other fixes
* fix activewindow and bar vertical padding
* readme: add config opt
* bar: fix top/bottom padding
* bar: better wheel behaviour
---------
Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Diffstat (limited to 'modules/bar/components/workspaces')
| -rw-r--r-- | modules/bar/components/workspaces/Workspaces.qml | 90 |
1 files changed, 50 insertions, 40 deletions
diff --git a/modules/bar/components/workspaces/Workspaces.qml b/modules/bar/components/workspaces/Workspaces.qml index 0a806f7..fb6201d 100644 --- a/modules/bar/components/workspaces/Workspaces.qml +++ b/modules/bar/components/workspaces/Workspaces.qml @@ -2,10 +2,11 @@ pragma ComponentBehavior: Bound import qs.services import qs.config +import qs.components import QtQuick import QtQuick.Layouts -Item { +StyledRect { id: root readonly property list<Workspace> workspaces: layout.children.filter(c => c.isWorkspace).sort((w1, w2) => w1.ws - w2.ws) @@ -15,60 +16,69 @@ Item { }, {}) readonly property int groupOffset: Math.floor((Hyprland.activeWsId - 1) / Config.bar.workspaces.shown) * Config.bar.workspaces.shown - implicitWidth: layout.implicitWidth - implicitHeight: layout.implicitHeight + implicitWidth: layout.implicitWidth + Appearance.padding.small * 2 + implicitHeight: layout.implicitHeight + Appearance.padding.small * 2 + color: Colours.tPalette.m3surfaceContainer + radius: Appearance.rounding.full - ColumnLayout { - id: layout + Item { + id: inner - spacing: 0 - layer.enabled: true - layer.smooth: true + anchors.fill: parent + anchors.margins: Appearance.padding.small - Repeater { - model: Config.bar.workspaces.shown + ColumnLayout { + id: layout - Workspace { - occupied: root.occupied - groupOffset: root.groupOffset + spacing: 0 + layer.enabled: true + layer.smooth: true + + Repeater { + model: Config.bar.workspaces.shown + + Workspace { + occupied: root.occupied + groupOffset: root.groupOffset + } } } - } - Loader { - active: Config.bar.workspaces.occupiedBg - asynchronous: true + Loader { + active: Config.bar.workspaces.occupiedBg + asynchronous: true - z: -1 - anchors.fill: parent + z: -1 + anchors.fill: parent - sourceComponent: OccupiedBg { - workspaces: root.workspaces - occupied: root.occupied - groupOffset: root.groupOffset + sourceComponent: OccupiedBg { + workspaces: root.workspaces + occupied: root.occupied + groupOffset: root.groupOffset + } } - } - Loader { - active: Config.bar.workspaces.activeIndicator - asynchronous: true + Loader { + active: Config.bar.workspaces.activeIndicator + asynchronous: true - sourceComponent: ActiveIndicator { - workspaces: root.workspaces - mask: layout - maskWidth: root.width - maskHeight: root.height - groupOffset: root.groupOffset + sourceComponent: ActiveIndicator { + workspaces: root.workspaces + mask: layout + maskWidth: inner.width + maskHeight: inner.height + groupOffset: root.groupOffset + } } - } - MouseArea { - anchors.fill: parent + MouseArea { + anchors.fill: parent - onPressed: event => { - const ws = layout.childAt(event.x, event.y).index + root.groupOffset + 1; - if (Hyprland.activeWsId !== ws) - Hyprland.dispatch(`workspace ${ws}`); + onPressed: event => { + const ws = layout.childAt(event.x, event.y).index + root.groupOffset + 1; + if (Hyprland.activeWsId !== ws) + Hyprland.dispatch(`workspace ${ws}`); + } } } } |