feat: initial commit for pixel-snapping components and helpers
This commit is contained in:
@@ -4,6 +4,7 @@ import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import ZShell.Components
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Helpers
|
||||
@@ -43,7 +44,7 @@ WidgetBase {
|
||||
timeTokens: timeTokens
|
||||
};
|
||||
}
|
||||
required property GridLayout loader
|
||||
required property SnapLayout loader
|
||||
required property Wrapper popouts
|
||||
readonly property real size: horizontal ? timeText.contentWidth + Tokens.padding.medium * 2 : verticalColumn.implicitHeight + Tokens.padding.medium * 2
|
||||
required property ScreenState screenState
|
||||
@@ -67,7 +68,8 @@ WidgetBase {
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
SnapLayout {
|
||||
orientation: Qt.Vertical
|
||||
id: verticalColumn
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
|
||||
@@ -11,7 +12,7 @@ Item {
|
||||
anchors.top: parent.top
|
||||
implicitWidth: layout.implicitWidth
|
||||
|
||||
RowLayout {
|
||||
SnapLayout {
|
||||
id: layout
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import Quickshell
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
|
||||
@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import ZShell.Config
|
||||
import ZShell.Services
|
||||
import qs.Services
|
||||
|
||||
@@ -4,6 +4,7 @@ import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import ZShell.Components
|
||||
import qs.Helpers
|
||||
import qs.Modules.Bar.Components.StatusIcons
|
||||
import qs.Modules.Bar.Components.Common
|
||||
@@ -51,17 +52,15 @@ WidgetBase {
|
||||
Behavior on implicitHeight {
|
||||
enabled: !root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
SnapLayout {
|
||||
id: grid
|
||||
|
||||
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.medium
|
||||
@@ -69,7 +68,8 @@ WidgetBase {
|
||||
anchors.leftMargin: root.horizontal ? Tokens.padding.extraSmall : 0
|
||||
anchors.rightMargin: root.horizontal ? Tokens.padding.extraSmall : 0
|
||||
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.extraSmall
|
||||
columns: root.horizontal ? -1 : 1
|
||||
orientation: root.horizontal ? Qt.Horizontal : Qt.Vertical
|
||||
spacing: root.horizontal ? Tokens.spacing.extraSmall : -2
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
@@ -111,8 +111,7 @@ WidgetBase {
|
||||
delegate: EntryWrapper {
|
||||
name: "upower"
|
||||
|
||||
UPowerWidget {
|
||||
}
|
||||
UPowerWidget {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import ZShell.Config
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import ZShell.Config
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import ZShell.Config
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Components
|
||||
|
||||
@@ -2,10 +2,11 @@ import QtQuick.Layouts
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
import ZShell.Config
|
||||
import ZShell.Components
|
||||
import qs.Helpers
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
@@ -15,7 +16,7 @@ Item {
|
||||
readonly property real dpr: Hypr.monitorFor(loader?.screen).scale
|
||||
required property int ind
|
||||
required property SystemTrayItem item
|
||||
required property GridLayout loader
|
||||
required property SnapLayout loader
|
||||
required property Wrapper popouts
|
||||
|
||||
function resolveIcon(app: string, icon: string): string {
|
||||
|
||||
@@ -4,6 +4,7 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Services.SystemTray
|
||||
import ZShell.Config
|
||||
import ZShell.Components
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Modules.Bar.Components.Tray
|
||||
@@ -15,7 +16,7 @@ WidgetBase {
|
||||
|
||||
readonly property alias items: repeater
|
||||
readonly property alias layout: sysGrid
|
||||
required property GridLayout loader
|
||||
required property SnapLayout loader
|
||||
readonly property int padding: Tokens.padding.extraSmall
|
||||
required property Wrapper popouts
|
||||
readonly property real size: horizontal ? sysGrid.implicitWidth + sysGrid.anchors.leftMargin + sysGrid.anchors.rightMargin : sysGrid.implicitHeight + sysGrid.anchors.topMargin + sysGrid.anchors.bottomMargin
|
||||
@@ -28,7 +29,7 @@ WidgetBase {
|
||||
radius: Tokens.rounding.full
|
||||
topRightRadius: horizontal ? Tokens.rounding.small / 2 : Tokens.rounding.full
|
||||
|
||||
GridLayout {
|
||||
SnapLayout {
|
||||
id: sysGrid
|
||||
|
||||
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.extraSmall
|
||||
@@ -36,8 +37,8 @@ WidgetBase {
|
||||
anchors.leftMargin: root.horizontal ? Tokens.padding.extraSmall : 0
|
||||
anchors.rightMargin: root.horizontal ? Tokens.padding.extraSmall : 0
|
||||
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.extraSmall
|
||||
columns: root.horizontal ? -1 : 1
|
||||
rowSpacing: -2
|
||||
orientation: root.horizontal ? Qt.Horizontal : Qt.Vertical
|
||||
spacing: root.horizontal ? Tokens.spacing.extraSmall : -2
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Components.Common
|
||||
|
||||
@@ -17,7 +17,7 @@ Item {
|
||||
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);
|
||||
return horizontal ? (bar.width - otherSize - bar.spacing * (bar.children.length - 1) - bar.vPadding * 2) : (bar.height - otherSize - bar.spacing * (bar.children.length - 1) - bar.vPadding * 4);
|
||||
}
|
||||
|
||||
clip: true
|
||||
|
||||
Reference in New Issue
Block a user