diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Bar.qml')
| -rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Bar.qml | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml new file mode 100644 index 00000000..54ac2d3c --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | import Quickshell | ||
| 2 | import Quickshell.Wayland | ||
| 3 | import QtQuick | ||
| 4 | import qs.Services | ||
| 5 | |||
| 6 | PanelWindow { | ||
| 7 | id: bar | ||
| 8 | |||
| 9 | WlrLayershell.namespace: "bar" | ||
| 10 | |||
| 11 | property bool haveMaximizedWindow: { | ||
| 12 | let currWindowId = Array.from(NiriService.workspaces).find(ws => { | ||
| 13 | return ws.output === bar.screen.name && ws.is_active; | ||
| 14 | })?.active_window_id; | ||
| 15 | let activeWindowTileSize = Array.from(NiriService.windows).find(win => win.id == currWindowId)?.layout?.tile_size; | ||
| 16 | |||
| 17 | if (!activeWindowTileSize) | ||
| 18 | return false; | ||
| 19 | return activeWindowTileSize[0] >= bar.screen.width && activeWindowTileSize[1] >= bar.screen.height - bar.height; | ||
| 20 | } | ||
| 21 | |||
| 22 | anchors { | ||
| 23 | top: true | ||
| 24 | left: true | ||
| 25 | right: true | ||
| 26 | } | ||
| 27 | margins { | ||
| 28 | left: bar.haveMaximizedWindow ? 0 : 26 + 8 | ||
| 29 | right: bar.haveMaximizedWindow ? 0 : 26 + 8 | ||
| 30 | } | ||
| 31 | |||
| 32 | implicitHeight: 21 | ||
| 33 | color: "transparent" | ||
| 34 | |||
| 35 | Rectangle { | ||
| 36 | color: bar.haveMaximizedWindow ? "black" : Qt.rgba(0, 0, 0, 0.75) | ||
| 37 | anchors.fill: parent | ||
| 38 | // bottomLeftRadius: 8 | ||
| 39 | // bottomRightRadius: 8 | ||
| 40 | } | ||
| 41 | |||
| 42 | Row { | ||
| 43 | id: left | ||
| 44 | |||
| 45 | height: parent.height | ||
| 46 | width: childrenRect.width | ||
| 47 | anchors.left: parent.left | ||
| 48 | anchors.leftMargin: 8 | ||
| 49 | anchors.verticalCenter: parent.verticalCenter | ||
| 50 | spacing: 8 | ||
| 51 | |||
| 52 | WorkspaceSwitcher { | ||
| 53 | screen: bar.screen | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | Row { | ||
| 58 | id: center | ||
| 59 | |||
| 60 | height: parent.height | ||
| 61 | width: childrenRect.width | ||
| 62 | anchors.centerIn: parent | ||
| 63 | spacing: 5 | ||
| 64 | |||
| 65 | ActiveWindowDisplay { | ||
| 66 | screen: bar.screen | ||
| 67 | maxWidth: bar.width - 2*Math.max(left.width, right.width) - 2*8 | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | Row { | ||
| 72 | id: right | ||
| 73 | |||
| 74 | height: parent.height | ||
| 75 | width: childrenRect.width | ||
| 76 | anchors.right: parent.right | ||
| 77 | anchors.rightMargin: 8 | ||
| 78 | anchors.verticalCenter: parent.verticalCenter | ||
| 79 | spacing: 0 | ||
| 80 | |||
| 81 | WorktimeWidget {} | ||
| 82 | |||
| 83 | KeyboardLayout {} | ||
| 84 | |||
| 85 | Item { | ||
| 86 | visible: privacy.visible | ||
| 87 | height: parent.height | ||
| 88 | width: 8 - 4 | ||
| 89 | } | ||
| 90 | |||
| 91 | PrivacyWidget { | ||
| 92 | id: privacy | ||
| 93 | } | ||
| 94 | |||
| 95 | Item { | ||
| 96 | visible: privacy.visible | ||
| 97 | height: parent.height | ||
| 98 | width: 8 - 4 | ||
| 99 | } | ||
| 100 | |||
| 101 | SystemTray {} | ||
| 102 | |||
| 103 | PipewireWidget {} | ||
| 104 | |||
| 105 | BrightnessWidget {} | ||
| 106 | |||
| 107 | BatteryWidget {} | ||
| 108 | |||
| 109 | WaylandInhibitorWidget { | ||
| 110 | window: bar | ||
| 111 | } | ||
| 112 | |||
| 113 | NotificationInhibitorWidget {} | ||
| 114 | |||
| 115 | LidSwitchInhibitorWidget {} | ||
| 116 | |||
| 117 | Item { | ||
| 118 | height: parent.height | ||
| 119 | width: 8 - 4 | ||
| 120 | } | ||
| 121 | |||
| 122 | Clock {} | ||
| 123 | } | ||
| 124 | } \ No newline at end of file | ||
