Merge branch 'main' into feat/fullscreen-reveal-bar
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 19s
Python / fmt (pull_request) Successful in 31s
Python / lint (pull_request) Successful in 34s
Python / test (pull_request) Successful in 56s
Python / typecheck (pull_request) Successful in 1m23s
Rust / fmt (pull_request) Successful in 41s
C++ / build (pull_request) Successful in 2m35s
Rust / build (pull_request) Successful in 1m49s
Rust / clippy (pull_request) Successful in 59s
Python / buildcheck (pull_request) Successful in 2m19s
C++ / clang-tidy (pull_request) Successful in 6m2s
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 19s
Python / fmt (pull_request) Successful in 31s
Python / lint (pull_request) Successful in 34s
Python / test (pull_request) Successful in 56s
Python / typecheck (pull_request) Successful in 1m23s
Rust / fmt (pull_request) Successful in 41s
C++ / build (pull_request) Successful in 2m35s
Rust / build (pull_request) Successful in 1m49s
Rust / clippy (pull_request) Successful in 59s
Python / buildcheck (pull_request) Successful in 2m19s
C++ / clang-tidy (pull_request) Successful in 6m2s
This commit is contained in:
+41
-22
@@ -3,16 +3,15 @@ pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Modules
|
||||
import ZShell.Config
|
||||
import qs.Modules.SysTray
|
||||
import qs.Modules.Network
|
||||
import qs.Modules.Updates
|
||||
import qs.Modules.Bar.Components
|
||||
import qs.Modules.Bar.Popouts
|
||||
|
||||
RowLayout {
|
||||
GridLayout {
|
||||
id: root
|
||||
|
||||
required property bool fullscreen
|
||||
required property bool horizontal
|
||||
required property bool isHovered
|
||||
required property Wrapper popouts
|
||||
required property ClipWrapper popoutsWrapper
|
||||
@@ -20,8 +19,13 @@ RowLayout {
|
||||
readonly property int vPadding: 6
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
function checkPopout(x: real): void {
|
||||
const ch = childAt(x, height / 2) as EntryWrapper;
|
||||
function axisCenterOf(item: Item): real {
|
||||
const c = item.mapToItem(root, item.implicitWidth / 2, item.implicitHeight / 2);
|
||||
return horizontal ? c.x : c.y;
|
||||
}
|
||||
|
||||
function checkPopout(pos: real): void {
|
||||
const ch = (horizontal ? childAt(pos, height / 2) : childAt(width / 2, pos)) as EntryWrapper;
|
||||
const id = ch?.entryId;
|
||||
|
||||
if (!ch || id === undefined) {
|
||||
@@ -35,26 +39,21 @@ RowLayout {
|
||||
|
||||
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
|
||||
const items = (ch.item as StatusIcons).items;
|
||||
const localX = mapToItem(items, x, 0).x;
|
||||
const icon = items.childAt(localX, items.height / 2);
|
||||
const icon = horizontal ? items.childAt(mapToItem(items, pos, 0).x, items.height / 2) : items.childAt(items.width / 2, mapToItem(items, 0, pos).y);
|
||||
if (icon) {
|
||||
popouts.currentName = icon.name;
|
||||
popouts.currentCenter = Qt.binding(() => icon.mapToItem(root, icon.implicitWidth / 2, 0).x);
|
||||
popouts.currentCenter = Qt.binding(() => axisCenterOf(icon));
|
||||
popouts.hasCurrent = true;
|
||||
}
|
||||
} else if (id === "tray" && Config.bar.popouts.tray && Config.bar.tray.showOnHover) {
|
||||
const tray = ch.item as TrayIcons;
|
||||
const layout = tray.layout;
|
||||
const localX = mapToItem(layout, x, 0).x;
|
||||
const trayItem = layout.childAt(localX, layout.height / 2);
|
||||
const trayItem = horizontal ? layout.childAt(mapToItem(layout, pos, 0).x, layout.height / 2) : layout.childAt(tray.width / 2, mapToItem(layout, 0, pos).y);
|
||||
|
||||
if (trayItem) {
|
||||
const idx = trayItem.index;
|
||||
popouts.currentName = `traymenu${idx}`;
|
||||
popouts.currentCenter = Qt.binding(() => {
|
||||
const it = tray.items.itemAt(idx);
|
||||
return it ? it.mapToItem(root, it.implicitWidth / 2, 0).x : popouts.currentCenter;
|
||||
});
|
||||
popouts.currentCenter = Qt.binding(() => axisCenterOf(trayItem));
|
||||
popouts.hasCurrent = true;
|
||||
}
|
||||
|
||||
@@ -64,12 +63,19 @@ RowLayout {
|
||||
|
||||
if (id === "updates") {
|
||||
popouts.currentName = "updates";
|
||||
popouts.currentCenter = Qt.binding(() => ch.item.mapToItem(root, (ch.item as Item).implicitWidth / 2, 0).x);
|
||||
popouts.currentCenter = Qt.binding(() => axisCenterOf(ch.item as Item));
|
||||
popouts.hasCurrent = true;
|
||||
}
|
||||
}
|
||||
|
||||
spacing: Tokens.spacing.small
|
||||
function entryAt(pos: real): string {
|
||||
const ch = (horizontal ? childAt(pos, height / 2) : childAt(width / 2, pos)) as EntryWrapper;
|
||||
return ch?.entryId ?? "";
|
||||
}
|
||||
|
||||
columnSpacing: Tokens.spacing.small
|
||||
columns: horizontal ? -1 : 1
|
||||
rowSpacing: Tokens.spacing.small
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
@@ -86,6 +92,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
HyprsunsetWidget {
|
||||
horizontal: root.horizontal
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
}
|
||||
}
|
||||
@@ -95,7 +102,8 @@ RowLayout {
|
||||
roleValue: "spacer"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: !root.horizontal
|
||||
Layout.fillWidth: root.horizontal
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +112,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
Workspaces {
|
||||
horizontal: root.horizontal
|
||||
screen: root.screen
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
}
|
||||
@@ -115,6 +124,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
TrayIcons {
|
||||
horizontal: root.horizontal
|
||||
loader: root
|
||||
popouts: root.popouts
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
@@ -127,6 +137,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
StatusIcons {
|
||||
horizontal: root.horizontal
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,6 +147,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
Resources {
|
||||
horizontal: root.horizontal
|
||||
visibilities: root.visibilities
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
}
|
||||
@@ -147,6 +159,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
UpdatesWidget {
|
||||
horizontal: root.horizontal
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
}
|
||||
}
|
||||
@@ -157,6 +170,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
NotifBell {
|
||||
horizontal: root.horizontal
|
||||
popouts: root.popouts
|
||||
visibilities: root.visibilities
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
@@ -169,6 +183,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
Clock {
|
||||
horizontal: root.horizontal
|
||||
loader: root
|
||||
popouts: root.popouts
|
||||
visibilities: root.visibilities
|
||||
@@ -183,6 +198,7 @@ RowLayout {
|
||||
delegate: EntryWrapper {
|
||||
WindowTitle {
|
||||
bar: root
|
||||
horizontal: root.horizontal
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
}
|
||||
}
|
||||
@@ -202,6 +218,7 @@ RowLayout {
|
||||
|
||||
delegate: EntryWrapper {
|
||||
MediaWidget {
|
||||
horizontal: root.horizontal
|
||||
visible: !root.fullscreen || root.isHovered
|
||||
}
|
||||
}
|
||||
@@ -215,9 +232,11 @@ RowLayout {
|
||||
default property Item item
|
||||
required property var modelData
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.leftMargin: index === 0 ? root.vPadding : (entryId === "statusIcons") ? -root.spacing + Tokens.spacing.extraSmall : 0
|
||||
Layout.rightMargin: index === repeater.count - 1 ? root.vPadding : 0
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
Layout.bottomMargin: !root.horizontal && index === repeater.count - 1 ? root.vPadding : 0
|
||||
Layout.leftMargin: root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons" && root.horizontal) ? -root.rowSpacing + Tokens.spacing.extraSmall : 0
|
||||
Layout.rightMargin: root.horizontal && index === repeater.count - 1 ? root.vPadding : 0
|
||||
Layout.topMargin: !root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons" && !root.horizontal) ? -root.columnSpacing + Tokens.spacing.extraSmall : 0
|
||||
children: item
|
||||
implicitHeight: item?.implicitHeight ?? 0
|
||||
implicitWidth: item?.implicitWidth ?? 0
|
||||
|
||||
+26
-19
@@ -1,45 +1,48 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
import ZShell.Config
|
||||
import qs.Helpers
|
||||
import qs.Modules.SysTray
|
||||
import qs.Modules.SysTray.Widgets
|
||||
import qs.Modules.Network
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Components
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
readonly property int contentHeight: Config.bar.height + padding * 2
|
||||
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentHeight
|
||||
readonly property int clampedExtent: Math.max(Config.bar.border, extent)
|
||||
readonly property int contentThickness: Math.floor(Math.max(Config.bar.height, Tokens.bar.innerSize * (horizontal ? 1 : 1.5))) + padding * 2
|
||||
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness
|
||||
property real extent: fullscreen ? 0 : Config.bar.border
|
||||
required property bool fullscreen
|
||||
readonly property bool horizontal: position !== "left"
|
||||
property bool isHovered
|
||||
readonly property int padding: Math.max(Tokens.padding.smaller, Config.bar.border)
|
||||
required property Wrapper popouts
|
||||
required property ClipWrapper popoutsWrapper
|
||||
required property string position
|
||||
required property ShellScreen screen
|
||||
readonly property bool shouldBeVisible: (!fullscreen && (!Config.bar.autoHide || visibilities.bar)) || isHovered
|
||||
readonly property int vPadding: 6
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
function checkPopout(x: real): void {
|
||||
content.item?.checkPopout(x);
|
||||
function checkPopout(pos: real): void {
|
||||
(content.item as Bar)?.checkPopout(pos);
|
||||
}
|
||||
|
||||
implicitHeight: fullscreen ? 0 : Config.bar.border
|
||||
visible: height > Config.bar.border
|
||||
function entryAt(pos: real): string {
|
||||
return (content.item as Bar)?.entryAt(pos) ?? "";
|
||||
}
|
||||
|
||||
implicitHeight: extent
|
||||
implicitWidth: extent
|
||||
visible: extent > Config.bar.border
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: root.shouldBeVisible
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitHeight: root.contentHeight
|
||||
root.extent: root.contentThickness
|
||||
}
|
||||
}
|
||||
transitions: [
|
||||
@@ -48,7 +51,7 @@ Item {
|
||||
to: "visible"
|
||||
|
||||
Anim {
|
||||
property: "implicitHeight"
|
||||
property: "extent"
|
||||
target: root
|
||||
}
|
||||
},
|
||||
@@ -57,7 +60,7 @@ Item {
|
||||
to: ""
|
||||
|
||||
Anim {
|
||||
property: "implicitHeight"
|
||||
property: "extent"
|
||||
target: root
|
||||
}
|
||||
}
|
||||
@@ -67,13 +70,17 @@ Item {
|
||||
id: content
|
||||
|
||||
active: root.shouldBeVisible || root.visible
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: root.position !== "bottom" ? parent.bottom : undefined
|
||||
anchors.left: root.horizontal ? parent.left : undefined
|
||||
anchors.right: parent.right
|
||||
anchors.top: root.position !== "top" ? parent.top : undefined
|
||||
height: root.contentThickness
|
||||
width: root.contentThickness
|
||||
|
||||
sourceComponent: Bar {
|
||||
fullscreen: root.fullscreen
|
||||
height: root.contentHeight
|
||||
horizontal: root.horizontal
|
||||
isHovered: root.isHovered
|
||||
popouts: root.popouts
|
||||
popoutsWrapper: root.popoutsWrapper
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Helpers
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
readonly property color contentColor: visibilities.dashboard ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
readonly property string effectiveFormat: {
|
||||
let fmt = Config.general.dateFormat;
|
||||
if (!root.horizontal)
|
||||
fmt = fmt.replace("dddd", "ddd");
|
||||
return fmt;
|
||||
}
|
||||
readonly property var formatParts: {
|
||||
const segments = root.effectiveFormat.split(" - ");
|
||||
let datePart = "";
|
||||
let timePart = "";
|
||||
|
||||
if (segments.length > 1) {
|
||||
datePart = segments[0];
|
||||
timePart = segments[1];
|
||||
} else if (/[hms]/.test(segments[0])) {
|
||||
timePart = segments[0];
|
||||
} else {
|
||||
datePart = segments[0];
|
||||
}
|
||||
|
||||
const dateTokens = datePart.trim().length ? datePart.trim().split(/\s+/) : [];
|
||||
const timeTokens = timePart.trim().length ? timePart.trim().split(":") : [];
|
||||
|
||||
return {
|
||||
dateTokens: dateTokens,
|
||||
timeTokens: timeTokens
|
||||
};
|
||||
}
|
||||
required property GridLayout loader
|
||||
required property Wrapper popouts
|
||||
readonly property real size: horizontal ? timeText.contentWidth + Tokens.padding.normal * 2 : verticalColumn.implicitHeight + Tokens.padding.larger * 2
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
color: visibilities.dashboard ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: horizontal ? baseSize : size
|
||||
implicitWidth: horizontal ? size : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
CustomText {
|
||||
id: timeText
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: root.contentColor
|
||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
height: implicitHeight
|
||||
text: Time.dateStr
|
||||
visible: root.horizontal
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: verticalColumn
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: Tokens.padding.small ?? 2
|
||||
visible: !root.horizontal
|
||||
width: root.baseSize
|
||||
|
||||
Repeater {
|
||||
model: root.formatParts.dateTokens
|
||||
|
||||
CustomText {
|
||||
required property string modelData
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.contentColor
|
||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
text: Qt.formatDateTime(Time.date, modelData)
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.bottomMargin: Tokens.padding.small ?? 2
|
||||
Layout.topMargin: Tokens.padding.small ?? 2
|
||||
color: root.contentColor
|
||||
height: 1
|
||||
implicitWidth: root.baseSize * 0.5
|
||||
opacity: 0.4
|
||||
radius: 1
|
||||
visible: root.formatParts.dateTokens.length > 0 && root.formatParts.timeTokens.length > 0
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: root.formatParts.timeTokens
|
||||
|
||||
CustomText {
|
||||
required property string modelData
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.contentColor
|
||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
text: {
|
||||
if (modelData.includes("h"))
|
||||
return Time.hourStr;
|
||||
if (modelData.includes("m"))
|
||||
return Time.minuteStr;
|
||||
if (modelData.includes("s"))
|
||||
return Time.secondStr;
|
||||
return "";
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.contentColor
|
||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
text: Qt.formatDateTime(Time.date, "AP")
|
||||
visible: Config.services.useTwelveHourClock && root.formatParts.timeTokens.length > 0
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
color: root.contentColor
|
||||
|
||||
onClicked: {
|
||||
root.visibilities.dashboard = !root.visibilities.dashboard;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
readonly property int baseSize: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : Math.max(Config.bar.height, Math.floor(Tokens.bar.innerSize * 1.5))
|
||||
required property bool horizontal
|
||||
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: horizontal ? baseSize : width
|
||||
implicitWidth: horizontal ? height : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
property bool tempEnabled: Hyprsunset.enabled
|
||||
|
||||
color: root.tempEnabled ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
StateLayer {
|
||||
@@ -26,6 +25,7 @@ CustomRect {
|
||||
animate: true
|
||||
color: root.tempEnabled ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
fill: root.tempEnabled ? 1 : 0
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: root.tempEnabled ? "lightbulb" : "light_off"
|
||||
|
||||
Behavior on fill {
|
||||
@@ -0,0 +1,92 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
readonly property string currentMedia: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
||||
readonly property int textWidth: Math.min(metrics.width, 200)
|
||||
|
||||
implicitHeight: horizontal ? baseSize : layout.implicitHeight + Tokens.padding.normal * 2
|
||||
implicitWidth: horizontal ? layout.implicitWidth + Tokens.padding.normal * 2 : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
Behavior on implicitHeight {
|
||||
enabled: !root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: metrics
|
||||
|
||||
font: mediatext.font
|
||||
text: mediatext.text
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: layout
|
||||
|
||||
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.normal
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: root.horizontal ? Tokens.padding.normal : 0
|
||||
anchors.rightMargin: root.horizontal ? Tokens.padding.normal : 0
|
||||
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.normal
|
||||
columns: root.horizontal ? -1 : 1
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
animate: true
|
||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: Players.active?.isPlaying ? "music_note" : "music_off"
|
||||
}
|
||||
|
||||
MarqueeText {
|
||||
id: mediatext
|
||||
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
animate: true
|
||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
implicitHeight: root.horizontal ? root.implicitHeight : root.textWidth
|
||||
implicitWidth: root.horizontal ? root.textWidth : root.implicitWidth
|
||||
marqueeEnabled: false
|
||||
pauseMs: 4000
|
||||
text: root.currentMedia
|
||||
vertical: !root.horizontal
|
||||
}
|
||||
}
|
||||
|
||||
CustomMouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (!containsMouse) {
|
||||
mediatext.marqueeEnabled = false;
|
||||
} else {
|
||||
mediatext.marqueeEnabled = true;
|
||||
mediatext.anim.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
required property Wrapper popouts
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
color: visibilities.sidebar ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
MaterialIcon {
|
||||
@@ -22,7 +22,6 @@ CustomRect {
|
||||
anchors.centerIn: parent
|
||||
color: root.visibilities.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
fill: root.visibilities.sidebar ? 1 : 0
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: NotifServer.list.length ? "\uf4fe" : "\ue7f4"
|
||||
|
||||
@@ -5,13 +5,14 @@ import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
RowLayout {
|
||||
GridLayout {
|
||||
id: root
|
||||
|
||||
property color accentColor: warning ? Colors.palette.m3error : mainColor
|
||||
property real animatedPercentage: 0
|
||||
readonly property real arcStartAngle: 0.75 * Math.PI
|
||||
readonly property real arcSweep: 1.5 * Math.PI
|
||||
required property bool horizontal
|
||||
property string icon
|
||||
required property color iconColor
|
||||
required property color mainColor
|
||||
@@ -21,8 +22,9 @@ RowLayout {
|
||||
property bool warning: percentage * 100 >= warningThreshold
|
||||
property int warningThreshold: 80
|
||||
|
||||
columnSpacing: Tokens.spacing.smaller
|
||||
columns: horizontal ? -1 : 1
|
||||
percentage: 0
|
||||
spacing: Tokens.spacing.smaller
|
||||
|
||||
Behavior on animatedPercentage {
|
||||
Anim {
|
||||
@@ -47,8 +49,8 @@ RowLayout {
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
Layout.preferredHeight: root.height - Tokens.padding.small
|
||||
Layout.preferredWidth: 4
|
||||
Layout.preferredHeight: root.horizontal ? icon.implicitHeight - Tokens.padding.small : 4
|
||||
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
||||
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
@@ -57,9 +59,11 @@ RowLayout {
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.right: root.horizontal ? parent.right : undefined
|
||||
anchors.top: root.horizontal ? undefined : parent.top
|
||||
color: root.mainColor
|
||||
implicitHeight: Math.ceil(root.percentage * parent.height)
|
||||
implicitHeight: root.horizontal ? Math.ceil(root.percentage * parent.height) : 0
|
||||
implicitWidth: root.horizontal ? 0 : Math.ceil(root.percentage * parent.width)
|
||||
|
||||
// Behavior on implicitHeight {
|
||||
// Anim {
|
||||
@@ -6,18 +6,18 @@ import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import ZShell.Services
|
||||
import qs.Services
|
||||
import qs.Modules
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Components
|
||||
|
||||
CustomRect {
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
clip: true
|
||||
color: visibilities.resources ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: rowLayout.implicitWidth + Tokens.padding.larger * 2
|
||||
implicitHeight: horizontal ? baseSize : gridLayout.implicitHeight + Tokens.padding.normal * 2
|
||||
implicitWidth: horizontal ? gridLayout.implicitWidth + Tokens.padding.larger * 2 : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
StateLayer {
|
||||
@@ -26,13 +26,14 @@ CustomRect {
|
||||
onClicked: root.visibilities.resources = !root.visibilities.resources
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: rowLayout
|
||||
GridLayout {
|
||||
id: gridLayout
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: -2
|
||||
implicitHeight: root.implicitHeight
|
||||
spacing: Tokens.spacing.smaller
|
||||
anchors.horizontalCenterOffset: root.horizontal ? 0 : 1
|
||||
anchors.verticalCenterOffset: root.horizontal ? 0 : -3
|
||||
columnSpacing: Tokens.spacing.smaller
|
||||
columns: root.horizontal ? -1 : 1
|
||||
|
||||
ServiceRef {
|
||||
service: Gpu
|
||||
@@ -48,7 +49,9 @@ CustomRect {
|
||||
|
||||
Resource {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillHeight: true
|
||||
Layout.fillHeight: root.horizontal
|
||||
Layout.fillWidth: !root.horizontal
|
||||
horizontal: root.horizontal
|
||||
icon: "memory"
|
||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
||||
@@ -57,7 +60,9 @@ CustomRect {
|
||||
}
|
||||
|
||||
Resource {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillHeight: root.horizontal
|
||||
Layout.fillWidth: !root.horizontal
|
||||
horizontal: root.horizontal
|
||||
icon: "memory_alt"
|
||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3secondary
|
||||
@@ -66,7 +71,9 @@ CustomRect {
|
||||
}
|
||||
|
||||
Resource {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillHeight: root.horizontal
|
||||
Layout.fillWidth: !root.horizontal
|
||||
horizontal: root.horizontal
|
||||
icon: "gamepad"
|
||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3tertiary
|
||||
@@ -74,7 +81,9 @@ CustomRect {
|
||||
}
|
||||
|
||||
Resource {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillHeight: root.horizontal
|
||||
Layout.fillWidth: !root.horizontal
|
||||
horizontal: root.horizontal
|
||||
icon: "developer_board"
|
||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
||||
@@ -3,13 +3,14 @@ pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Helpers
|
||||
import qs.Modules.SysTray.Widgets
|
||||
import ZShell.Config
|
||||
import qs.Helpers
|
||||
import qs.Modules.Bar.Components.StatusIcons
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomClippingRect {
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
readonly property int firstPresent: {
|
||||
@@ -21,7 +22,7 @@ CustomClippingRect {
|
||||
}
|
||||
|
||||
// Index of the first/last entry that isn't collapsed, for edge margin gating
|
||||
readonly property alias items: row
|
||||
readonly property alias items: grid
|
||||
readonly property int lastPresent: {
|
||||
const values = model.values;
|
||||
for (let i = values.length - 1; i >= 0; i--)
|
||||
@@ -29,6 +30,7 @@ CustomClippingRect {
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
readonly property real size: horizontal ? grid.implicitWidth + Tokens.padding.small * 2 : grid.implicitHeight + Tokens.padding.small * 2
|
||||
readonly property int spacing: Tokens.spacing.normal / 2
|
||||
|
||||
// Entries that can shrink to nothing, spacing included
|
||||
@@ -38,19 +40,36 @@ CustomClippingRect {
|
||||
return false;
|
||||
}
|
||||
|
||||
bottomLeftRadius: Tokens.rounding.smallest / 2
|
||||
bottomLeftRadius: horizontal ? Tokens.rounding.smallest / 2 : Tokens.rounding.full
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: row.implicitWidth + Tokens.padding.small * 2
|
||||
implicitHeight: horizontal ? baseSize : size
|
||||
implicitWidth: horizontal ? size : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
topLeftRadius: Tokens.rounding.smallest / 2
|
||||
topRightRadius: horizontal ? Tokens.rounding.full : Tokens.rounding.smallest / 2
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
Behavior on implicitHeight {
|
||||
enabled: !root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: grid
|
||||
|
||||
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.small
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Tokens.padding.small
|
||||
anchors.rightMargin: Tokens.padding.small
|
||||
anchors.leftMargin: root.horizontal ? Tokens.padding.small : 0
|
||||
anchors.rightMargin: root.horizontal ? Tokens.padding.small : 0
|
||||
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.small
|
||||
columns: root.horizontal ? -1 : 1
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
@@ -69,6 +88,7 @@ CustomClippingRect {
|
||||
name: "audio"
|
||||
|
||||
AudioWidget {
|
||||
horizontal: root.horizontal
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +100,7 @@ CustomClippingRect {
|
||||
name: "audio"
|
||||
|
||||
MicWidget {
|
||||
horizontal: root.horizontal
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,6 +112,7 @@ CustomClippingRect {
|
||||
name: "upower"
|
||||
|
||||
UPowerWidget {
|
||||
horizontal: root.horizontal
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,8 +131,10 @@ CustomClippingRect {
|
||||
property real rightGap: present && index !== root.firstPresent ? margin : 0
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.leftMargin: Math.round(leftGap)
|
||||
Layout.rightMargin: Math.round(rightGap)
|
||||
Layout.bottomMargin: root.horizontal ? 0 : Math.round(rightGap)
|
||||
Layout.leftMargin: root.horizontal ? Math.round(leftGap) : 0
|
||||
Layout.rightMargin: root.horizontal ? Math.round(rightGap) : 0
|
||||
Layout.topMargin: root.horizontal ? 0 : Math.round(leftGap)
|
||||
children: item
|
||||
implicitHeight: item?.implicitHeight ?? 0
|
||||
implicitWidth: item?.implicitWidth ?? 0
|
||||
+3
-4
@@ -1,16 +1,15 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.Daemons
|
||||
import qs.Modules
|
||||
import ZShell.Config
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
MaterialIcon {
|
||||
id: speaker
|
||||
|
||||
required property bool horizontal
|
||||
|
||||
animate: true
|
||||
color: Audio.muted ? Colors.palette.m3error : Colors.palette.m3onSurface
|
||||
fill: 1
|
||||
+3
-4
@@ -1,16 +1,15 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.Daemons
|
||||
import qs.Modules
|
||||
import ZShell.Config
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
MaterialIcon {
|
||||
id: mic
|
||||
|
||||
required property bool horizontal
|
||||
|
||||
animate: true
|
||||
color: (Audio.sourceMuted ?? false) ? Colors.palette.m3error : Colors.palette.m3onSurface
|
||||
fill: 1
|
||||
+4
-1
@@ -1,13 +1,15 @@
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property bool horizontal
|
||||
|
||||
implicitHeight: Battery.isLaptop ? batteryIconLoader.item.implicitHeight : upowerIconLoader.item.implicitHeight
|
||||
implicitWidth: Battery.isLaptop ? batteryIconLoader.item.implicitWidth : upowerIconLoader.item.implicitWidth
|
||||
|
||||
@@ -123,6 +125,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
animate: true
|
||||
fill: 1
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: {
|
||||
if (PowerProfiles.profile === PowerProfile.PowerSaver)
|
||||
return "energy_savings_leaf";
|
||||
@@ -1,10 +1,9 @@
|
||||
import QtQuick.Layouts
|
||||
import QtQuick
|
||||
import QtQuick.VectorImage
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
import qs.Helpers
|
||||
import qs.Modules
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
@@ -13,10 +12,10 @@ Item {
|
||||
id: root
|
||||
|
||||
property bool current: popouts.currentName.startsWith(`traymenu${ind}`) && popouts.hasCurrent
|
||||
readonly property real dpr: Hypr.monitorFor(loader.screen).scale
|
||||
readonly property real dpr: Hypr.monitorFor(loader?.screen).scale
|
||||
required property int ind
|
||||
required property SystemTrayItem item
|
||||
required property RowLayout loader
|
||||
required property GridLayout loader
|
||||
required property Wrapper popouts
|
||||
|
||||
function resolveIcon(app: string, icon: string): string {
|
||||
@@ -3,33 +3,37 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Services.SystemTray
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Modules.SysTray.Widgets
|
||||
import qs.Modules
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Modules.Bar.Components.Tray
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Services
|
||||
|
||||
CustomClippingRect {
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
readonly property alias items: repeater
|
||||
readonly property alias layout: sysRow
|
||||
required property RowLayout loader
|
||||
readonly property alias layout: sysGrid
|
||||
required property GridLayout loader
|
||||
readonly property int padding: Tokens.padding.small
|
||||
required property Wrapper popouts
|
||||
readonly property real size: horizontal ? sysGrid.implicitWidth + Tokens.padding.small : sysGrid.implicitHeight + Tokens.padding.small
|
||||
|
||||
bottomLeftRadius: horizontal ? Tokens.rounding.full : Tokens.rounding.smallest / 2
|
||||
bottomRightRadius: Tokens.rounding.smallest / 2
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: sysRow.implicitWidth + Tokens.padding.small * 2
|
||||
implicitHeight: horizontal ? baseSize : size
|
||||
implicitWidth: horizontal ? size : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
topRightRadius: Tokens.rounding.smallest / 2
|
||||
topRightRadius: horizontal ? Tokens.rounding.smallest / 2 : Tokens.rounding.full
|
||||
|
||||
RowLayout {
|
||||
id: sysRow
|
||||
GridLayout {
|
||||
id: sysGrid
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
columns: root.horizontal ? -1 : 1
|
||||
rowSpacing: -2
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
@@ -0,0 +1,41 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
property int countUpdates: Updates.availableUpdates
|
||||
property color textColor: Colors.palette.m3onSurface
|
||||
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: horizontal ? baseSize : content.implicitHeight + Tokens.spacing.small
|
||||
implicitWidth: horizontal ? content.implicitWidth + Tokens.spacing.small * 2 : baseSize
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
GridLayout {
|
||||
id: content
|
||||
|
||||
anchors.centerIn: parent
|
||||
columnSpacing: Tokens.spacing.small
|
||||
columns: root.horizontal ? -1 : 1
|
||||
rowSpacing: -Tokens.spacing.extraSmall / 2
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
font.pointSize: root.horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
||||
text: "package_2"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
color: root.textColor
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
text: root.countUpdates
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property var bar
|
||||
property color color: Colors.palette.m3primary
|
||||
property Title current: text1
|
||||
required property bool horizontal
|
||||
// readonly property int maxWidth: 300
|
||||
readonly property int maxSize: {
|
||||
const otherModules = bar.children.filter(c => c.enabled && c.entryId && c.item !== this && c.entryId !== "spacer");
|
||||
const otherSize = otherModules.reduce((acc, curr) => acc + (horizontal ? (curr.item?.nonAnimWidth ?? curr.width ?? 0) : (curr.item.nonAnimHeight ?? curr.height ?? 0)), 0);
|
||||
return horizontal ? (bar.width - otherSize - bar.columnSpacing * (bar.children.length - 1) - bar.vPadding * 2) : (bar.height - otherSize - bar.rowSpacing * (bar.children.length - 1) - bar.vPadding * 4);
|
||||
}
|
||||
|
||||
clip: true
|
||||
implicitHeight: horizontal ? current.implicitHeight : current.implicitWidth + current.anchors.topMargin
|
||||
implicitWidth: horizontal ? current.implicitWidth + current.anchors.leftMargin : current.implicitHeight + current.anchors.topMargin
|
||||
|
||||
Behavior on implicitHeight {
|
||||
enabled: !root.horizontal
|
||||
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.horizontal
|
||||
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
Title {
|
||||
id: text1
|
||||
}
|
||||
|
||||
Title {
|
||||
id: text2
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: metrics
|
||||
|
||||
elide: Qt.ElideRight
|
||||
elideWidth: root.maxSize - (root.horizontal ? root.current.anchors.leftMargin : 0)
|
||||
font.family: "Rubik"
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
text: Hypr.activeToplevel?.title ?? qsTr("Desktop")
|
||||
|
||||
onElideWidthChanged: root.current.text = elidedText
|
||||
onTextChanged: {
|
||||
const next = root.current === text1 ? text2 : text1;
|
||||
next.text = elidedText;
|
||||
root.current = next;
|
||||
}
|
||||
}
|
||||
|
||||
component Title: CustomText {
|
||||
id: text
|
||||
|
||||
anchors.horizontalCenter: root.horizontal ? undefined : parent.horizontalCenter
|
||||
anchors.left: root.horizontal ? parent.left : undefined
|
||||
anchors.leftMargin: root.horizontal ? Tokens.spacing.small : 0
|
||||
anchors.top: root.horizontal ? undefined : parent.top
|
||||
anchors.topMargin: root.horizontal ? 0 : Tokens.spacing.small
|
||||
anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined
|
||||
color: root.color
|
||||
font.family: metrics.font.family
|
||||
font.pointSize: metrics.font.pointSize
|
||||
height: root.horizontal ? implicitHeight : implicitWidth
|
||||
opacity: root.current === this ? 1 : 0
|
||||
width: root.horizontal ? implicitWidth : implicitHeight
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
transform: [
|
||||
Translate {
|
||||
x: !root.horizontal ? -text.implicitWidth + text.implicitHeight : 0
|
||||
},
|
||||
Rotation {
|
||||
angle: root.horizontal ? 0 : 270
|
||||
origin.x: text.implicitHeight / 2
|
||||
origin.y: text.implicitHeight / 2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import ZShell.Config
|
||||
import qs.Modules.Bar.Components.Workspaces
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
@@ -14,41 +14,57 @@ Item {
|
||||
|
||||
property real activeWorkspaceMargin: Math.ceil(Tokens.padding.small / 2)
|
||||
readonly property int effectiveActiveWorkspaceId: monitor?.activeWorkspace?.id ?? 1
|
||||
required property bool horizontal
|
||||
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(root.screen)
|
||||
required property ShellScreen screen
|
||||
property int workspaceButtonWidth: bgRect.implicitHeight - root.activeWorkspaceMargin * 2
|
||||
readonly property real shortSize: Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||
readonly property real size: (workspaceButtonWidth * workspacesShown) + activeWorkspaceMargin * 2
|
||||
property int workspaceButtonWidth: (horizontal ? bgRect.implicitHeight : bgRect.implicitWidth) - root.activeWorkspaceMargin * 2
|
||||
property int workspaceIndexInGroup: (effectiveActiveWorkspaceId - 1) % root.workspacesShown
|
||||
readonly property list<var> workspaces: Hyprland.workspaces.values.filter(w => w.monitor === root.monitor)
|
||||
readonly property int workspacesShown: workspaces.length
|
||||
|
||||
height: implicitHeight
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smaller * 2
|
||||
implicitWidth: (root.workspaceButtonWidth * root.workspacesShown) + root.activeWorkspaceMargin * 2
|
||||
implicitHeight: horizontal ? shortSize : size
|
||||
implicitWidth: horizontal ? size : shortSize
|
||||
|
||||
Behavior on implicitHeight {
|
||||
enabled: !root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
// qmllint disable Quick.anchor-combinations
|
||||
id: bgRect
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.bottom: root.horizontal ? undefined : parent.bottom
|
||||
anchors.horizontalCenter: root.horizontal ? undefined : parent.horizontalCenter
|
||||
anchors.left: root.horizontal ? parent.left : undefined
|
||||
anchors.right: root.horizontal ? parent.right : undefined
|
||||
anchors.top: root.horizontal ? undefined : parent.top
|
||||
anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: root.implicitHeight - ((Tokens.padding.small - 1) * 2)
|
||||
implicitHeight: root.horizontal ? root.implicitHeight : 0
|
||||
implicitWidth: root.horizontal ? 0 : root.implicitWidth
|
||||
radius: height / 2
|
||||
|
||||
// qmllint enable Quick.anchor-combinations
|
||||
Grid {
|
||||
id: grid
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: root.activeWorkspaceMargin
|
||||
columnSpacing: 0
|
||||
columns: root.workspacesShown
|
||||
columns: root.horizontal ? root.workspacesShown : 1
|
||||
rowSpacing: 0
|
||||
rows: 1
|
||||
rows: root.horizontal ? 1 : root.workspacesShown
|
||||
|
||||
Repeater {
|
||||
model: root.workspaces
|
||||
@@ -74,7 +90,7 @@ Item {
|
||||
color: Colors.palette.m3onSecondaryContainer
|
||||
elide: Text.ElideRight
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: button.modelData.name
|
||||
text: button.modelData?.name ?? ""
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
@@ -94,13 +110,15 @@ Item {
|
||||
property real indicatorPosition: Math.min(idxPair.idx1, idxPair.idx2) * root.workspaceButtonWidth + root.activeWorkspaceMargin
|
||||
property real indicatorThickness: root.workspaceButtonWidth
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: root.horizontal ? undefined : parent.horizontalCenter
|
||||
anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined
|
||||
clip: true
|
||||
color: Colors.palette.m3primary
|
||||
implicitHeight: indicatorThickness
|
||||
implicitWidth: indicatorLength
|
||||
implicitHeight: root.horizontal ? indicatorThickness : indicatorLength
|
||||
implicitWidth: root.horizontal ? indicatorLength : indicatorThickness
|
||||
radius: Tokens.rounding.full
|
||||
x: indicatorPosition
|
||||
x: root.horizontal ? indicatorPosition : 0
|
||||
y: root.horizontal ? 0 : indicatorPosition
|
||||
|
||||
AnimatedTabIndexPair {
|
||||
id: idxPair
|
||||
@@ -114,7 +132,8 @@ Item {
|
||||
implicitWidth: grid.width
|
||||
source: grid
|
||||
sourceColor: Colors.palette.m3onSurface
|
||||
x: -indicator.x + 3
|
||||
x: root.horizontal ? -indicator.x + 3 : 0
|
||||
y: root.horizontal ? 0 : -indicator.y + 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property real idx1: index
|
||||
property int idx1Duration: 100
|
||||
property real idx2: index
|
||||
property int idx2Duration: 300
|
||||
required property int index
|
||||
|
||||
Behavior on idx1 {
|
||||
NumberAnimation {
|
||||
duration: root.idx1Duration
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
Behavior on idx2 {
|
||||
NumberAnimation {
|
||||
duration: root.idx2Duration
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property real borderThickness
|
||||
readonly property alias content: content
|
||||
readonly property bool horizontal: position !== "left"
|
||||
// property real offsetScale: y > 0 || content.hasCurrent ? 0 : 1
|
||||
property real offsetScale: {
|
||||
if (content.hasCurrent)
|
||||
return 0;
|
||||
if (position === "top")
|
||||
return y > 0 ? 0 : 1;
|
||||
if (position === "bottom")
|
||||
return 1;
|
||||
return x > 0 ? 0 : 1;
|
||||
}
|
||||
required property string position
|
||||
required property ShellScreen screen
|
||||
|
||||
anchors.bottom: position === "bottom" ? parent.bottom : undefined
|
||||
clip: true
|
||||
implicitHeight: horizontal ? content.implicitHeight * (1 - offsetScale) : content.implicitHeight
|
||||
implicitWidth: horizontal ? content.implicitWidth : content.implicitWidth * (1 - offsetScale)
|
||||
visible: width > 0 && height > 0
|
||||
x: {
|
||||
if (!horizontal)
|
||||
return 0;
|
||||
const off = content.currentCenter - borderThickness - content.nonAnimWidth / 2;
|
||||
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.floor(Math.max(off, 0));
|
||||
}
|
||||
y: {
|
||||
if (horizontal)
|
||||
return 0;
|
||||
|
||||
const off = content.currentCenter - borderThickness - content.nonAnimHeight / 2;
|
||||
const diff = parent.height - Math.floor(off + content.nonAnimHeight);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.max(off, 0);
|
||||
}
|
||||
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on x {
|
||||
enabled: !root.horizontal || root.offsetScale < 1
|
||||
|
||||
Anim {
|
||||
duration: content.animLength
|
||||
easing.bezierCurve: content.animCurve
|
||||
}
|
||||
}
|
||||
Behavior on y {
|
||||
enabled: root.horizontal || root.offsetScale < 1
|
||||
|
||||
Anim {
|
||||
duration: content.animLength
|
||||
easing.bezierCurve: content.animCurve
|
||||
}
|
||||
}
|
||||
|
||||
Wrapper {
|
||||
id: content
|
||||
|
||||
anchors.bottom: root.position === "bottom" ? parent.bottom : undefined
|
||||
anchors.bottomMargin: (-implicitHeight - 5) * root.offsetScale
|
||||
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
||||
anchors.left: root.horizontal ? undefined : parent.left
|
||||
anchors.leftMargin: (-implicitWidth - 5) * root.offsetScale
|
||||
anchors.top: root.position === "top" ? parent.top : undefined
|
||||
anchors.topMargin: (-implicitHeight - 5) * root.offsetScale
|
||||
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
||||
offsetScale: root.offsetScale
|
||||
screen: root.screen
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,6 @@ import Quickshell.Services.SystemTray
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.WSOverview
|
||||
import qs.Modules.Network
|
||||
import qs.Modules.SysTray.Popouts
|
||||
import qs.Modules.Updates
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -1,56 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property real borderThickness
|
||||
readonly property alias content: content
|
||||
property real offsetScale: y > 0 || content.hasCurrent ? 0 : 1
|
||||
required property ShellScreen screen
|
||||
|
||||
clip: true
|
||||
implicitHeight: content.implicitHeight * (1 - offsetScale)
|
||||
implicitWidth: content.implicitWidth
|
||||
visible: width > 0 && height > 0
|
||||
x: {
|
||||
const off = content.currentCenter - borderThickness - content.nonAnimWidth / 2;
|
||||
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.floor(Math.max(off, 0));
|
||||
}
|
||||
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on x {
|
||||
enabled: root.offsetScale < 1
|
||||
|
||||
Anim {
|
||||
duration: content.animLength
|
||||
easing.bezierCurve: content.animCurve
|
||||
}
|
||||
}
|
||||
Behavior on y {
|
||||
Anim {
|
||||
duration: content.animLength
|
||||
easing.bezierCurve: content.animCurve
|
||||
}
|
||||
}
|
||||
|
||||
Wrapper {
|
||||
id: content
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: (-implicitHeight - 5) * root.offsetScale
|
||||
offsetScale: root.offsetScale
|
||||
screen: root.screen
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Modules
|
||||
import qs.Helpers
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
required property RowLayout loader
|
||||
required property Wrapper popouts
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
color: visibilities.dashboard ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: timeText.contentWidth + Tokens.padding.normal * 2
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
CustomText {
|
||||
id: timeText
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: root.visibilities.dashboard ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
font: Config.appearance.font.family.mono
|
||||
text: Time.dateStr
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
color: root.visibilities.dashboard ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
|
||||
onClicked: {
|
||||
root.visibilities.dashboard = !root.visibilities.dashboard;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,16 @@ Item {
|
||||
}
|
||||
readonly property real nonAnimHeight: state === "visible" ? (content.item?.nonAnimHeight ?? 0) : 0
|
||||
required property real offsetScale
|
||||
required property string position
|
||||
readonly property bool shouldBeActive: root.visibilities.dashboard && Config.dashboard.enabled
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
anchors.bottom: position === "bottom" ? parent.bottom : undefined
|
||||
anchors.bottomMargin: position === "bottom" ? (-implicitHeight - 5) * offsetScale : 0
|
||||
anchors.left: position === "left" ? parent.left : undefined
|
||||
anchors.leftMargin: position === "left" ? (-implicitWidth - 5) * offsetScale : 0
|
||||
anchors.top: position === "top" ? parent.top : undefined
|
||||
anchors.topMargin: position === "top" ? (-implicitHeight - 5) * offsetScale : 0
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: content.implicitWidth || 854
|
||||
opacity: 1 - offsetScale
|
||||
@@ -28,8 +35,11 @@ Item {
|
||||
id: content
|
||||
|
||||
active: root.shouldBeActive || root.visible
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: root.position === "top" ? parent.bottom : undefined
|
||||
anchors.horizontalCenter: root.position !== "left" ? parent.horizontalCenter : undefined
|
||||
anchors.right: root.position !== "left" ? undefined : parent.right
|
||||
anchors.top: root.position === "bottom" ? parent.top : undefined
|
||||
anchors.verticalCenter: root.position === "left" ? undefined : parent.verticalCenter
|
||||
|
||||
sourceComponent: Content {
|
||||
dashState: root.dashState
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Components
|
||||
import qs.Daemons
|
||||
import ZShell.Config
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
readonly property string currentMedia: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
||||
readonly property int textWidth: Math.min(metrics.width, 200)
|
||||
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: layout.implicitWidth + Tokens.padding.normal * 2
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: metrics
|
||||
|
||||
font: mediatext.font
|
||||
text: mediatext.text
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: layout
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
animate: true
|
||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: Players.active?.isPlaying ? "music_note" : "music_off"
|
||||
}
|
||||
|
||||
MarqueeText {
|
||||
id: mediatext
|
||||
|
||||
Layout.preferredWidth: root.textWidth
|
||||
animate: true
|
||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
marqueeEnabled: false
|
||||
pauseMs: 4000
|
||||
text: root.currentMedia
|
||||
width: root.textWidth
|
||||
|
||||
CustomMouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (!containsMouse) {
|
||||
mediatext.marqueeEnabled = false;
|
||||
} else {
|
||||
mediatext.marqueeEnabled = true;
|
||||
mediatext.anim.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,16 @@ Item {
|
||||
|
||||
readonly property real nonAnimHeight: content.item?.nonAnimHeight ?? 0
|
||||
property real offsetScale: shouldBeActive ? 0 : 1
|
||||
required property string position
|
||||
readonly property bool shouldBeActive: root.visibilities.resources
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
anchors.topMargin: (-implicitHeight - 5) * offsetScale
|
||||
anchors.bottom: position === "bottom" ? parent.bottom : undefined
|
||||
anchors.bottomMargin: position === "bottom" ? (-implicitHeight - 5) * offsetScale : 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: position === "left" ? (-implicitWidth - 5) * offsetScale : 0
|
||||
anchors.top: position !== "bottom" ? parent.top : undefined
|
||||
anchors.topMargin: position === "top" ? (-implicitHeight - 5) * offsetScale : 0
|
||||
clip: true
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: content.implicitWidth || 854 // Hard coded fallback for first open
|
||||
@@ -31,7 +37,11 @@ Item {
|
||||
id: content
|
||||
|
||||
active: root.shouldBeActive || root.visible
|
||||
anchors.centerIn: parent
|
||||
anchors.bottom: root.position === "top" ? parent.bottom : undefined
|
||||
anchors.horizontalCenter: root.position !== "left" ? parent.horizontalCenter : undefined
|
||||
anchors.right: root.position !== "left" ? undefined : parent.right
|
||||
anchors.top: root.position === "bottom" ? parent.top : undefined
|
||||
anchors.verticalCenter: root.position === "left" ? undefined : parent.verticalCenter
|
||||
|
||||
sourceComponent: Content {
|
||||
wrapper: root
|
||||
|
||||
@@ -2,6 +2,7 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.Settings.Common
|
||||
|
||||
PageBase {
|
||||
@@ -32,6 +33,33 @@ PageBase {
|
||||
onToggled: Config.bar.autoHide = checked
|
||||
}
|
||||
|
||||
SelectRow {
|
||||
active: Config.bar.position === "top" ? menuItems[0] : Config.bar.position === "left" ? menuItems[1] : menuItems[2]
|
||||
settingAnchor: "bar-position"
|
||||
subtext: qsTr("Change which edge the bar appears on")
|
||||
text: qsTr("Position")
|
||||
|
||||
menuItems: [
|
||||
MenuItem {
|
||||
icon: "build"
|
||||
text: qsTr("Top")
|
||||
value: "top"
|
||||
},
|
||||
MenuItem {
|
||||
icon: "rotate_auto"
|
||||
text: qsTr("Left")
|
||||
value: "left"
|
||||
},
|
||||
MenuItem {
|
||||
icon: "rotate_auto"
|
||||
text: qsTr("Bottom")
|
||||
value: "bottom"
|
||||
}
|
||||
]
|
||||
|
||||
onSelected: item => Config.bar.position = item.value
|
||||
}
|
||||
|
||||
ToggleRow {
|
||||
checked: Config.bar.fullscreenReveal
|
||||
settingAnchor: "bar-fullscreen-reveal"
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Services.SystemTray
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Modules.SysTray.Widgets
|
||||
import qs.Modules
|
||||
import qs.Services
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
readonly property alias items: repeater
|
||||
required property RowLayout loader
|
||||
required property Wrapper popouts
|
||||
|
||||
function closestRowChild(row, x) {
|
||||
let child = row.childAt(x, row.height / 2);
|
||||
if (child)
|
||||
return child;
|
||||
|
||||
let closest = null;
|
||||
let closestDistance = Infinity;
|
||||
|
||||
for (let i = 0; i < row.children.length; ++i) {
|
||||
let c = row.children[i];
|
||||
|
||||
if (!c.visible || c.width <= 0)
|
||||
continue;
|
||||
|
||||
let centerX = c.x + c.width / 2;
|
||||
let dist = Math.abs(x - centerX);
|
||||
|
||||
if (dist < closestDistance) {
|
||||
closestDistance = dist;
|
||||
closest = c;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
|
||||
function getHoveredSubItem(localX, localY) {
|
||||
let modPos = mapToItem(sysTrayMod, localX, localY);
|
||||
if (sysTrayMod.contains(Qt.point(modPos.x, modPos.y))) {
|
||||
let modRowPos = sysTrayMod.mapToItem(sysIcons, modPos.x, modPos.y);
|
||||
let child = closestRowChild(sysIcons, modRowPos.x);
|
||||
if (child) {
|
||||
if (child.objectName === "audio" && Config.bar.popouts.audio)
|
||||
return {
|
||||
id: "audio",
|
||||
item: child
|
||||
};
|
||||
if (child.objectName === "microphone" && Config.bar.popouts.audio)
|
||||
return {
|
||||
id: "audio",
|
||||
item: child
|
||||
};
|
||||
if (child.objectName === "upower" && Config.bar.popouts.upower)
|
||||
return {
|
||||
id: "upower",
|
||||
item: child
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
let trayPos = mapToItem(sysTray, localX, localY);
|
||||
if (Config.bar.tray.showOnHover && sysTray.contains(Qt.point(trayPos.x, trayPos.y))) {
|
||||
let trayRowPos = sysTray.mapToItem(sysRow, trayPos.x, trayPos.y);
|
||||
let child = sysRow.childAt(trayRowPos.x, trayRowPos.y);
|
||||
if (child && child.hasOwnProperty("ind")) {
|
||||
return {
|
||||
id: `traymenu${child.ind}`,
|
||||
item: child
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
height: Config.bar.height + Tokens.padding.smallest * 2
|
||||
spacing: Tokens.padding.small
|
||||
width: sysTray.implicitWidth + sysTrayMod.implicitWidth + Tokens.padding.small
|
||||
|
||||
CustomClippingRect {
|
||||
id: sysTray
|
||||
|
||||
Layout.fillHeight: true
|
||||
bottomRightRadius: Tokens.rounding.smallest / 2
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitWidth: sysRow.width + Tokens.padding.small * 2
|
||||
radius: Tokens.rounding.full
|
||||
topRightRadius: Tokens.rounding.smallest / 2
|
||||
|
||||
Row {
|
||||
id: sysRow
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
model: SystemTray.items
|
||||
|
||||
TrayItem {
|
||||
id: trayItem
|
||||
|
||||
required property int index
|
||||
required property SystemTrayItem modelData
|
||||
|
||||
implicitHeight: 34
|
||||
implicitWidth: 34
|
||||
ind: index
|
||||
item: modelData
|
||||
loader: root.loader
|
||||
popouts: root.popouts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
id: sysTrayMod
|
||||
|
||||
Layout.fillHeight: true
|
||||
bottomLeftRadius: Tokens.rounding.smallest / 2
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitWidth: sysIcons.implicitWidth + Tokens.padding.smaller + Tokens.padding.normal
|
||||
radius: Tokens.rounding.full
|
||||
topLeftRadius: Tokens.rounding.smallest / 2
|
||||
|
||||
StatusIcons {
|
||||
id: sysIcons
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Tokens.padding.smaller
|
||||
anchors.rightMargin: Tokens.padding.normal
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
property int countUpdates: Updates.availableUpdates
|
||||
property color textColor: Colors.palette.m3onSurface
|
||||
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: Config.bar.height + Tokens.padding.smallest * 2
|
||||
implicitWidth: contentRow.implicitWidth + Tokens.spacing.small * 2
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
RowLayout {
|
||||
id: contentRow
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: Tokens.spacing.small
|
||||
|
||||
MaterialIcon {
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: "package_2"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
color: root.textColor
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
text: root.countUpdates
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property Item wrapper
|
||||
|
||||
implicitHeight: layout.implicitHeight + 16
|
||||
implicitWidth: layout.implicitWidth + 16
|
||||
|
||||
GridLayout {
|
||||
id: layout
|
||||
|
||||
anchors.centerIn: parent
|
||||
columnSpacing: 8
|
||||
rowSpacing: 8
|
||||
|
||||
Repeater {
|
||||
model: Hypr.workspaces
|
||||
|
||||
CustomRect {
|
||||
id: workspacePreview
|
||||
|
||||
required property HyprlandWorkspace modelData
|
||||
|
||||
Layout.preferredHeight: 180 + 10
|
||||
Layout.preferredWidth: 320 + 10
|
||||
border.color: "white"
|
||||
border.width: 1
|
||||
radius: Tokens.rounding.smallest
|
||||
|
||||
Repeater {
|
||||
model: workspacePreview.modelData.toplevels
|
||||
|
||||
Item {
|
||||
id: preview
|
||||
|
||||
property rect appPosition: {
|
||||
let {
|
||||
at: [cx, cy],
|
||||
size: [cw, ch]
|
||||
} = modelData.lastIpcObject;
|
||||
|
||||
cx -= modelData.monitor.x;
|
||||
cy -= modelData.monitor.y;
|
||||
|
||||
return Qt.rect((cx / 8), (cy / 8), (cw / 8), (ch / 8));
|
||||
}
|
||||
required property HyprlandToplevel modelData
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
|
||||
CustomRect {
|
||||
border.color: Colors.tPalette.m3outline
|
||||
border.width: 1
|
||||
implicitHeight: preview.appPosition.height
|
||||
implicitWidth: preview.appPosition.width
|
||||
radius: Tokens.rounding.smallest / 2
|
||||
x: preview.appPosition.x
|
||||
y: preview.appPosition.y - 3.4
|
||||
|
||||
ScreencopyView {
|
||||
id: previewCopy
|
||||
|
||||
anchors.fill: parent
|
||||
captureSource: preview.modelData.wayland
|
||||
live: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property var bar
|
||||
property color colour: Colors.palette.m3primary
|
||||
property Title current: text1
|
||||
// readonly property int maxWidth: 300
|
||||
readonly property int maxWidth: {
|
||||
const otherModules = bar.children.filter(c => c.enabled && c.id && c.item !== this && c.id !== "spacer");
|
||||
const otherWidth = otherModules.reduce((acc, curr) => {
|
||||
return acc + (curr.item?.nonAnimWidth ?? curr.width ?? 0);
|
||||
}, 0);
|
||||
return bar.width - otherWidth - bar.spacing * (bar.children.length - 1) - bar.vPadding * 2;
|
||||
}
|
||||
|
||||
clip: true
|
||||
implicitHeight: current.implicitHeight
|
||||
implicitWidth: Math.min(current.implicitWidth, root.maxWidth)
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Title {
|
||||
id: text1
|
||||
}
|
||||
|
||||
Title {
|
||||
id: text2
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: metrics
|
||||
|
||||
elide: Qt.ElideRight
|
||||
elideWidth: root.maxWidth
|
||||
font.family: "Rubik"
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
text: Hypr.activeToplevel?.title ?? qsTr("Desktop")
|
||||
|
||||
onElideWidthChanged: root.current.text = elidedText
|
||||
onTextChanged: {
|
||||
const next = root.current === text1 ? text2 : text1;
|
||||
next.text = elidedText;
|
||||
root.current = next;
|
||||
}
|
||||
}
|
||||
|
||||
component Title: CustomText {
|
||||
id: text
|
||||
|
||||
anchors.leftMargin: 7
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.colour
|
||||
font.family: metrics.font.family
|
||||
font.pointSize: metrics.font.pointSize
|
||||
height: implicitHeight
|
||||
opacity: root.current === this ? 1 : 0
|
||||
width: implicitWidth
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user