Merge branch 'main' into module/wifi
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 17s
JS/TS / lint (pull_request) Successful in 16s
Python / fmt (pull_request) Successful in 31s
Python / lint (pull_request) Successful in 41s
Python / test (pull_request) Successful in 1m5s
Python / typecheck (pull_request) Successful in 1m15s
Rust / clippy (pull_request) Failing after 12m43s
Rust / fmt (pull_request) Failing after 12m57s
Rust / build (pull_request) Failing after 13m33s
Python / buildcheck (pull_request) Failing after 13m45s
C++ / clang-tidy (pull_request) Failing after 14m23s
C++ / build (pull_request) Failing after 14m25s
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 17s
JS/TS / lint (pull_request) Successful in 16s
Python / fmt (pull_request) Successful in 31s
Python / lint (pull_request) Successful in 41s
Python / test (pull_request) Successful in 1m5s
Python / typecheck (pull_request) Successful in 1m15s
Rust / clippy (pull_request) Failing after 12m43s
Rust / fmt (pull_request) Failing after 12m57s
Rust / build (pull_request) Failing after 13m33s
Python / buildcheck (pull_request) Failing after 13m45s
C++ / clang-tidy (pull_request) Failing after 14m23s
C++ / build (pull_request) Failing after 14m25s
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Helpers
|
||||
import qs.Modules.SysTray.Widgets
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomClippingRect {
|
||||
id: root
|
||||
|
||||
readonly property int firstPresent: {
|
||||
const values = model.values;
|
||||
for (let i = 0; i < values.length; i++)
|
||||
if (!collapsed(values[i]))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Index of the first/last entry that isn't collapsed, for edge margin gating
|
||||
readonly property alias items: row
|
||||
readonly property int lastPresent: {
|
||||
const values = model.values;
|
||||
for (let i = values.length - 1; i >= 0; i--)
|
||||
if (!collapsed(values[i]))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
readonly property int spacing: Tokens.spacing.normal / 2
|
||||
|
||||
// Entries that can shrink to nothing, spacing included
|
||||
function collapsed(entry: var): bool {
|
||||
if (entry.id === "lockStatus")
|
||||
return !Hypr.capsLock && !Hypr.numLock;
|
||||
return false;
|
||||
}
|
||||
|
||||
bottomLeftRadius: Tokens.rounding.smallest / 2
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: row.implicitWidth + Tokens.padding.small * 2
|
||||
radius: Tokens.rounding.full
|
||||
topLeftRadius: Tokens.rounding.smallest / 2
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Tokens.padding.small
|
||||
anchors.rightMargin: Tokens.padding.small
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
id: model
|
||||
|
||||
values: Config.bar.tray.statusIcons.values.filter(e => e.enabled)
|
||||
}
|
||||
|
||||
DelegateChooser {
|
||||
role: "id"
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "audio"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
name: "audio"
|
||||
|
||||
AudioWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "microphone"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
name: "audio"
|
||||
|
||||
MicWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "bluetooth"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
name: "bluetooth"
|
||||
|
||||
BluetoothWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "network"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
name: "network"
|
||||
|
||||
NetworkWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "power"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
name: "upower"
|
||||
|
||||
UPowerWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component EntryWrapper: Item {
|
||||
required property int index
|
||||
default property Item item
|
||||
property real leftGap: present && index !== root.lastPresent ? margin : 0
|
||||
property int margin: root.spacing / 2
|
||||
required property var modelData
|
||||
property string name: modelData.id.toLowerCase()
|
||||
readonly property bool present: !root.collapsed(modelData)
|
||||
property real rightGap: present && index !== root.firstPresent ? margin : 0
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.leftMargin: Math.round(leftGap)
|
||||
Layout.rightMargin: Math.round(rightGap)
|
||||
children: item
|
||||
implicitHeight: item?.implicitHeight ?? 0
|
||||
implicitWidth: item?.implicitWidth ?? 0
|
||||
|
||||
Behavior on leftGap {
|
||||
Anim {
|
||||
type: Anim.SlowEffects
|
||||
}
|
||||
}
|
||||
Behavior on rightGap {
|
||||
Anim {
|
||||
type: Anim.SlowEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user