diff options
Diffstat (limited to 'accounts/gkleen@skadhi/shell/quickshell/Bar.qml')
| -rw-r--r-- | accounts/gkleen@skadhi/shell/quickshell/Bar.qml | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/accounts/gkleen@skadhi/shell/quickshell/Bar.qml b/accounts/gkleen@skadhi/shell/quickshell/Bar.qml new file mode 100644 index 00000000..fdaa8f56 --- /dev/null +++ b/accounts/gkleen@skadhi/shell/quickshell/Bar.qml | |||
| @@ -0,0 +1,138 @@ | |||
| 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 : 8 + 2 | ||
| 29 | right: bar.haveMaximizedWindow ? 0 : 8 + 2 | ||
| 30 | } | ||
| 31 | |||
| 32 | implicitHeight: 21 | ||
| 33 | color: "transparent" | ||
| 34 | |||
| 35 | property bool haveScreenshare: Array.from(NiriService.casts).some(cast => cast.target.Output?.name == bar.screen.name) | ||
| 36 | |||
| 37 | Rectangle { | ||
| 38 | color: Qt.rgba(bar.haveScreenshare ? 0.2 : 0, 0, 0, bar.haveMaximizedWindow ? 1 : 0.75) | ||
| 39 | anchors.fill: parent | ||
| 40 | // bottomLeftRadius: 8 | ||
| 41 | // bottomRightRadius: 8 | ||
| 42 | } | ||
| 43 | |||
| 44 | Row { | ||
| 45 | id: left | ||
| 46 | |||
| 47 | height: parent.height | ||
| 48 | width: childrenRect.width | ||
| 49 | anchors.left: parent.left | ||
| 50 | anchors.leftMargin: 8 | ||
| 51 | anchors.verticalCenter: parent.verticalCenter | ||
| 52 | spacing: 8 | ||
| 53 | |||
| 54 | WorkspaceSwitcher { | ||
| 55 | screen: bar.screen | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | Row { | ||
| 60 | id: center | ||
| 61 | |||
| 62 | height: parent.height | ||
| 63 | width: childrenRect.width | ||
| 64 | anchors.centerIn: parent | ||
| 65 | spacing: 5 | ||
| 66 | |||
| 67 | ActiveWindowDisplay { | ||
| 68 | screen: bar.screen | ||
| 69 | maxWidth: bar.width - 2*Math.max(left.width, right.width) - 2*8 | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | Row { | ||
| 74 | id: right | ||
| 75 | |||
| 76 | height: parent.height | ||
| 77 | width: childrenRect.width | ||
| 78 | anchors.right: parent.right | ||
| 79 | anchors.rightMargin: 8 | ||
| 80 | anchors.verticalCenter: parent.verticalCenter | ||
| 81 | spacing: 0 | ||
| 82 | |||
| 83 | WorktimeWidget {} | ||
| 84 | |||
| 85 | KeyboardLayout {} | ||
| 86 | |||
| 87 | Item { | ||
| 88 | visible: privacy.visible || ytDlp.visible | ||
| 89 | height: parent.height | ||
| 90 | width: 8 - 4 | ||
| 91 | } | ||
| 92 | |||
| 93 | PrivacyWidget { | ||
| 94 | id: privacy | ||
| 95 | } | ||
| 96 | |||
| 97 | Item { | ||
| 98 | visible: privacy.visible && ytDlp.visible | ||
| 99 | height: parent.height | ||
| 100 | width: 8 - 4 | ||
| 101 | } | ||
| 102 | |||
| 103 | YtDlpWidget { | ||
| 104 | id: ytDlp | ||
| 105 | } | ||
| 106 | |||
| 107 | Item { | ||
| 108 | visible: privacy.visible || ytDlp.visible | ||
| 109 | height: parent.height | ||
| 110 | width: 8 - 4 | ||
| 111 | } | ||
| 112 | |||
| 113 | SystemTray {} | ||
| 114 | |||
| 115 | PipewireWidget {} | ||
| 116 | |||
| 117 | BrightnessWidget {} | ||
| 118 | |||
| 119 | BatteryWidget {} | ||
| 120 | |||
| 121 | LockscreenInhibitorWidget {} | ||
| 122 | |||
| 123 | WaylandInhibitorWidget { | ||
| 124 | window: bar | ||
| 125 | } | ||
| 126 | |||
| 127 | LidSwitchInhibitorWidget {} | ||
| 128 | |||
| 129 | NotificationInhibitorWidget {} | ||
| 130 | |||
| 131 | Item { | ||
| 132 | height: parent.height | ||
| 133 | width: 8 - 4 | ||
| 134 | } | ||
| 135 | |||
| 136 | Clock {} | ||
| 137 | } | ||
| 138 | } \ No newline at end of file | ||
