diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-13 16:40:14 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-13 16:40:14 +0800 |
| commit | 8127908623a6f1737537a7b53d479bf9039a4afd (patch) | |
| tree | 739df679343db82aeb8c06445a286ebc3f20965a /bar/Workspace.qml | |
| parent | f5462c3274d008c1bb509cfac4eab8492d822cf5 (diff) | |
margin implicit width not cool
Diffstat (limited to 'bar/Workspace.qml')
| -rw-r--r-- | bar/Workspace.qml | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/bar/Workspace.qml b/bar/Workspace.qml index 6155bb5..27acf03 100644 --- a/bar/Workspace.qml +++ b/bar/Workspace.qml @@ -2,12 +2,16 @@ import QtQuick.Layouts import QtQuick import Quickshell import Quickshell.Hyprland +import Quickshell.Wayland import qs.config as Config import qs.components Item { id: root + // required property ShellScreen screen // multi monitor + + // readonly property HyprlandMonitor monitor: Hyprland.monitorFor(screen) // multi monitor property list<bool> workspaceOccupied: [] function updateWorkspaceOccupied() { @@ -23,11 +27,20 @@ Item { // dont work no more for some reason function isActive(index: int): bool { return Hyprland.focusedWorkspace?.id === (index + 1); + // return monitor.activeWorkspace.id === (index + 1); // multi monitor } function isOccupied(index: int): bool { return workspaceOccupied[index] === true; } + // TODO: allow specific index after tl can do that + // function isEmpty(): bool { + // for (let i of ToplevelManager.toplevels.values) + // if (i.activated) + // return false; + // return true; + // } + Connections { target: Hyprland.workspaces function onValuesChanged() { @@ -37,6 +50,8 @@ Item { Component.onCompleted: updateWorkspaceOccupied() + implicitWidth: layout.implicitWidth + RowLayout { id: layout implicitWidth: childrenRect.width @@ -54,18 +69,16 @@ Item { 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 + opacity: !isOccupied(index) ? 0 : 1 // less contrast + // opacity: isActive(index) ? Config.Bar.workspaceActiveOpacity : isOccupied(index) ? Config.Bar.workspaceOpacity : Config.Bar.workspaceEmptyOpacity } + color: isOccupied(index) ? Config.Colors.alt : Config.Colors.foreground opacity: isActive(index) ? Config.Bar.workspaceActiveOpacity : isOccupied(index) ? Config.Bar.workspaceOpacity : Config.Bar.workspaceEmptyOpacity } |
