Compare commits
14
Commits
6ad9c0b17e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc197339fa | ||
|
|
3f0e31b116 | ||
|
|
660fa69be6 | ||
|
|
1a394955cf | ||
|
|
629287f7f3 | ||
|
|
f756d37f6d | ||
|
|
68281b0874 | ||
|
|
4f078bdf5c | ||
|
|
f96d16df87 | ||
|
|
d37f9b7121 | ||
|
|
1e918414d1 | ||
|
|
972ab1120e | ||
|
|
604424869d | ||
|
|
b03bd77941 |
No files matched your search
@@ -33,6 +33,8 @@ PanelWindow {
|
|||||||
item: root.notch ? leftIsland : panel
|
item: root.notch ? leftIsland : panel
|
||||||
Region { item: root.notch ? notchPill : null; intersection: Intersection.Combine }
|
Region { item: root.notch ? notchPill : null; intersection: Intersection.Combine }
|
||||||
Region { item: root.notch ? rightIsland : null; intersection: Intersection.Combine }
|
Region { item: root.notch ? rightIsland : null; intersection: Intersection.Combine }
|
||||||
|
Region { item: root.notch && innerLeft.shown ? innerLeft : null; intersection: Intersection.Combine }
|
||||||
|
Region { item: root.notch && innerRight.shown ? innerRight : null; intersection: Intersection.Combine }
|
||||||
}
|
}
|
||||||
color: Theme.transparent
|
color: Theme.transparent
|
||||||
// Reserve the bar itself (margin + height), not the overhang below it, so
|
// Reserve the bar itself (margin + height), not the overhang below it, so
|
||||||
@@ -151,6 +153,39 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
Island { id: leftIsland; side: "left" }
|
Island { id: leftIsland; side: "left" }
|
||||||
Island { id: rightIsland; side: "right" }
|
Island { id: rightIsland; side: "right" }
|
||||||
|
// Spots right beside the notch, one each side at the same distance. Always
|
||||||
|
// bare (no pill), they ride the notch's edges as it springs wider for media,
|
||||||
|
// and step aside while it is opened or widened for the launcher or a banner.
|
||||||
|
readonly property int innerGap: 10
|
||||||
|
readonly property bool notchBusy: ShellState.notchOpen || notchPill.searching || notchPill.showing
|
||||||
|
component InnerSlot: Item {
|
||||||
|
id: slot
|
||||||
|
property string side
|
||||||
|
readonly property bool used: root.notch && ConfigService.ready && (ConfigService.data.notch[side] || []).length > 0
|
||||||
|
readonly property bool shown: used && opacity > 0.01
|
||||||
|
visible: shown
|
||||||
|
opacity: used && !root.notchBusy ? 1 : 0
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.duration
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x: side === "innerLeft" ? notchPill.x - root.innerGap - width : notchPill.x + notchPill.width + root.innerGap
|
||||||
|
y: root.islandY
|
||||||
|
width: slotRow.implicitWidth
|
||||||
|
height: BarDrawers.height
|
||||||
|
ModuleRow {
|
||||||
|
id: slotRow
|
||||||
|
position: slot.side === "innerLeft" ? "left" : "right"
|
||||||
|
active: slot.used
|
||||||
|
modules: BarLayout.notchModules(root.screen ? root.screen.name : "", slot.side)
|
||||||
|
barScreen: root.screen
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
InnerSlot { id: innerLeft; side: "innerLeft" }
|
||||||
|
InnerSlot { id: innerRight; side: "innerRight" }
|
||||||
NotchPill {
|
NotchPill {
|
||||||
id: notchPill
|
id: notchPill
|
||||||
barScreen: root.screen
|
barScreen: root.screen
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ PanelWindow {
|
|||||||
drawerId: "popout"
|
drawerId: "popout"
|
||||||
screenName: root.screen ? root.screen.name : ""
|
screenName: root.screen ? root.screen.name : ""
|
||||||
screenX: root.animX
|
screenX: root.animX
|
||||||
|
sourceScreenX: root.anchorPoint.x + (root.placementItem ? root.placementItem.width / 2 : 0)
|
||||||
onHoveredChanged: PopoutState.setPopoutHovered(hovered)
|
onHoveredChanged: PopoutState.setPopoutHovered(hovered)
|
||||||
Text {
|
Text {
|
||||||
id: tip
|
id: tip
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "../../components"
|
||||||
|
import "../../services"
|
||||||
|
// Caffeine on the bar: keeps the system awake while lit.
|
||||||
|
BarToggle {
|
||||||
|
property var entry: ({})
|
||||||
|
objectName: "caffeineModule"
|
||||||
|
tip: "Caffeine"
|
||||||
|
glyph: CaffeineService.active ? "" : ""
|
||||||
|
on: CaffeineService.active
|
||||||
|
bare: entry.bare === true
|
||||||
|
onClicked: CaffeineService.toggle()
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "../../components"
|
||||||
|
import "../../services"
|
||||||
|
// Night Light on the bar. Shows the provider's acknowledged state; while
|
||||||
|
// only the bar watches, the state is polled slowly.
|
||||||
|
BarToggle {
|
||||||
|
property var entry: ({})
|
||||||
|
readonly property var info: SystemService.state.nightLight || ({
|
||||||
|
available: false
|
||||||
|
})
|
||||||
|
objectName: "nightLightModule"
|
||||||
|
tip: "Night Light"
|
||||||
|
glyph: ""
|
||||||
|
on: !!info.enabled
|
||||||
|
bare: entry.bare === true
|
||||||
|
enabled: !!info.available && !SystemService.acting
|
||||||
|
onClicked: SystemService.action("nightLight", !info.enabled, false)
|
||||||
|
Component.onCompleted: SystemService.nightLightWatchers++
|
||||||
|
Component.onDestruction: SystemService.nightLightWatchers--
|
||||||
|
}
|
||||||
@@ -23,6 +23,13 @@ GlassPill {
|
|||||||
// Omarchy widgets report emptiness through hasVisualContent instead.
|
// Omarchy widgets report emptiness through hasVisualContent instead.
|
||||||
readonly property var widgetObject: loader.item
|
readonly property var widgetObject: loader.item
|
||||||
readonly property bool shown: !!widget && (noctalia || widgetObject.hasVisualContent !== false) && widget.implicitWidth > 0
|
readonly property bool shown: !!widget && (noctalia || widgetObject.hasVisualContent !== false) && widget.implicitWidth > 0
|
||||||
|
// A plugin can offer a "background" setting; "transparent" drops the
|
||||||
|
// pill so its widget sits straight on the bar, like the tray's option.
|
||||||
|
// The spots beside the notch drop it too.
|
||||||
|
readonly property bool bare: settings.background === "transparent" || entry.bare === true
|
||||||
|
color: bare ? "transparent" : Qt.alpha(Theme.surface, surfaceOpacity)
|
||||||
|
border.width: bare ? 0 : 1
|
||||||
|
plain: bare
|
||||||
implicitHeight: ModuleRegistry.pillHeight
|
implicitHeight: ModuleRegistry.pillHeight
|
||||||
implicitWidth: shown ? Math.ceil(widget.implicitWidth) + 8 : 0
|
implicitWidth: shown ? Math.ceil(widget.implicitWidth) + 8 : 0
|
||||||
visible: implicitWidth > 0
|
visible: implicitWidth > 0
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import "../../core"
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property var barScreen
|
property var barScreen
|
||||||
|
property var entry: ({})
|
||||||
readonly property bool shown: TrayService.options.enabled && TrayService.items.length > 0
|
readonly property bool shown: TrayService.options.enabled && TrayService.items.length > 0
|
||||||
implicitWidth: shown ? row.implicitWidth + 12 : 0
|
implicitWidth: shown ? row.implicitWidth + 12 : 0
|
||||||
implicitHeight: shown ? ModuleRegistry.pillHeight : 0
|
implicitHeight: shown ? ModuleRegistry.pillHeight : 0
|
||||||
@@ -14,7 +15,7 @@ Item {
|
|||||||
// The whole pill is hover space: gaps between icons keep a hover menu open.
|
// The whole pill is hover space: gaps between icons keep a hover menu open.
|
||||||
readonly property bool hovered: hover.hovered
|
readonly property bool hovered: hover.hovered
|
||||||
HoverHandler { id: hover }
|
HoverHandler { id: hover }
|
||||||
GlassPill { anchors.fill: parent; visible: TrayService.options.background === "pill" }
|
GlassPill { anchors.fill: parent; visible: TrayService.options.background === "pill" && root.entry.bare !== true }
|
||||||
Row {
|
Row {
|
||||||
id: row; anchors.centerIn: parent; spacing: TrayService.options.spacing
|
id: row; anchors.centerIn: parent; spacing: TrayService.options.spacing
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ PanelWindow {
|
|||||||
drawerId: "noctalia-panel-" + (root.api ? root.api.pluginId : "")
|
drawerId: "noctalia-panel-" + (root.api ? root.api.pluginId : "")
|
||||||
screenName: root.screen ? root.screen.name : ""
|
screenName: root.screen ? root.screen.name : ""
|
||||||
screenX: root.drawerX
|
screenX: root.drawerX
|
||||||
|
sourceScreenX: root.fromBar ? root.anchorCenter : -1
|
||||||
focus: root.open
|
focus: root.open
|
||||||
Keys.onEscapePressed: root.api.closePanel(null)
|
Keys.onEscapePressed: root.api.closePanel(null)
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ PanelWindow {
|
|||||||
drawerId: "plugin-popup-" + (root.owner && root.owner.moduleName ? root.owner.moduleName : "")
|
drawerId: "plugin-popup-" + (root.owner && root.owner.moduleName ? root.owner.moduleName : "")
|
||||||
screenName: root.screen ? root.screen.name : ""
|
screenName: root.screen ? root.screen.name : ""
|
||||||
screenX: root.drawerX
|
screenX: root.drawerX
|
||||||
|
sourceScreenX: root.centerOnBar ? -1 : root.anchorScreenPos.x + root.anchorW / 2
|
||||||
|
|
||||||
// Swallow clicks on the card so they never reach the outside catcher.
|
// Swallow clicks on the card so they never reach the outside catcher.
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
@@ -21,17 +21,42 @@ Item {
|
|||||||
// "slide" unrolls out of the bar; "drop" falls into place and away
|
// "slide" unrolls out of the bar; "drop" falls into place and away
|
||||||
// downwards; "fade" fades in place; "shrink" grows from / shrinks to nothing.
|
// downwards; "fade" fades in place; "shrink" grows from / shrinks to nothing.
|
||||||
property string style: "slide"
|
property string style: "slide"
|
||||||
|
// Notch mode has no bar to unroll from: attached drawers use NotchDrop
|
||||||
|
// instead, with the notch's own panel speeds. Opt out with `liquid: false`.
|
||||||
|
property bool liquid: ShellState.notchMode && attached
|
||||||
|
// Screen x of the icon the drawer belongs to; the drop comes out under it.
|
||||||
|
property real sourceScreenX: -1
|
||||||
// Fill and timing; notch mode passes the notch's own.
|
// Fill and timing; notch mode passes the notch's own.
|
||||||
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
|
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
|
||||||
property real openDuration: Theme.duration * 1.8
|
property real openDuration: Theme.duration * 1.8
|
||||||
property real closeDuration: Theme.duration
|
property real closeDuration: Theme.duration
|
||||||
readonly property bool unrolls: style === "slide"
|
readonly property bool unrolls: style === "slide" && !liquid
|
||||||
property real progress: open ? 1 : 0
|
property real progress: open ? 1 : 0
|
||||||
readonly property real revealed: unrolls ? Math.max(0, contentHeight * progress) : contentHeight
|
readonly property real revealed: unrolls ? Math.max(0, contentHeight * progress) : contentHeight
|
||||||
// Drop moves down on the way in and on the way out.
|
// Drop moves down on the way in and on the way out.
|
||||||
property real dropFrom: -1
|
property real dropFrom: -1
|
||||||
onOpenChanged: dropFrom = open ? -1 : 1
|
// Hyprland fades out a layer's last frame when it unmaps. A fast close can
|
||||||
readonly property bool shown: progress > 0.001
|
// jump from a visible bead straight to 0, so the drop stays mapped for a
|
||||||
|
// few frames after closing to present an empty frame first.
|
||||||
|
readonly property bool shown: progress > 0.001 || holdEmpty
|
||||||
|
property bool holdEmpty: false
|
||||||
|
onOpenChanged: {
|
||||||
|
dropFrom = open ? -1 : 1;
|
||||||
|
holdEmpty = !open && liquid && progress > 0.001;
|
||||||
|
emptyFrames.stop();
|
||||||
|
}
|
||||||
|
onProgressChanged: if (holdEmpty && progress <= 0.001)
|
||||||
|
emptyFrames.restart()
|
||||||
|
Timer {
|
||||||
|
id: emptyFrames
|
||||||
|
interval: 60
|
||||||
|
onTriggered: root.holdEmpty = false
|
||||||
|
}
|
||||||
|
// NotchDrop's content fade: in once the panel has its size, out first.
|
||||||
|
readonly property real dropContent: {
|
||||||
|
const t = Math.min(1, Math.max(0, (progress - 0.82) / 0.18));
|
||||||
|
return t * t * (3 - 2 * t);
|
||||||
|
}
|
||||||
readonly property bool settled: !anim.running && open
|
readonly property bool settled: !anim.running && open
|
||||||
// Input/hover region: the full body as soon as it opens (the pointer may
|
// Input/hover region: the full body as soon as it opens (the pointer may
|
||||||
// reach the drawer before the reveal finishes), the visible part while closing.
|
// reach the drawer before the reveal finishes), the visible part while closing.
|
||||||
@@ -40,12 +65,17 @@ Item {
|
|||||||
// Content parent, for items reparented in at runtime.
|
// Content parent, for items reparented in at runtime.
|
||||||
readonly property alias container: inner
|
readonly property alias container: inner
|
||||||
// Enter: emphasized decelerate; exit: emphasized accelerate (Material 3).
|
// Enter: emphasized decelerate; exit: emphasized accelerate (Material 3).
|
||||||
|
// Timing follows where the animation is heading, not `open`: both bindings
|
||||||
|
// depend on `open`, and the animation can start before the duration updates.
|
||||||
Behavior on progress {
|
Behavior on progress {
|
||||||
|
id: motionBehavior
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: anim
|
id: anim
|
||||||
duration: root.open ? root.openDuration : root.closeDuration
|
readonly property bool opening: motionBehavior.targetValue > 0.5
|
||||||
easing.type: Easing.BezierSpline
|
duration: root.liquid ? (anim.opening ? Theme.notchPanelOpenDuration : Theme.notchPanelCloseDuration) : anim.opening ? root.openDuration : root.closeDuration
|
||||||
easing.bezierCurve: root.open ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1]
|
// NotchDrop eases each phase itself.
|
||||||
|
easing.type: root.liquid ? Easing.Linear : Easing.BezierSpline
|
||||||
|
easing.bezierCurve: anim.opening ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
implicitWidth: contentWidth + 2 * ear
|
implicitWidth: contentWidth + 2 * ear
|
||||||
@@ -69,14 +99,32 @@ Item {
|
|||||||
id: motion
|
id: motion
|
||||||
width: root.width
|
width: root.width
|
||||||
height: root.height
|
height: root.height
|
||||||
opacity: root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
|
opacity: root.liquid ? 1 : root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
|
||||||
scale: root.style === "shrink" ? Math.max(0.001, root.progress) : 1
|
scale: !root.liquid && root.style === "shrink" ? Math.max(0.001, root.progress) : 1
|
||||||
transformOrigin: Item.Center
|
transformOrigin: Item.Center
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
y: root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
|
y: !root.liquid && root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
|
||||||
|
}
|
||||||
|
Loader {
|
||||||
|
active: root.liquid
|
||||||
|
width: root.width
|
||||||
|
sourceComponent: NotchDrop {
|
||||||
|
width: root.width
|
||||||
|
progress: root.progress
|
||||||
|
bodyX: root.ear
|
||||||
|
bodyWidth: root.contentWidth
|
||||||
|
bodyHeight: root.contentHeight
|
||||||
|
sourceX: root.sourceScreenX < 0 ? -1 : root.sourceScreenX - root.screenX
|
||||||
|
topSpace: Math.max(0, root.y)
|
||||||
|
islandBottom: Math.round((BarDrawers.bottom - BarDrawers.height) / 2) + BarDrawers.height - root.y
|
||||||
|
fillColor: root.fillColor
|
||||||
|
screenName: root.screenName
|
||||||
|
screenX: root.screenX
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DrawerShape {
|
DrawerShape {
|
||||||
id: shape
|
id: shape
|
||||||
|
visible: !root.liquid
|
||||||
bodyWidth: root.contentWidth
|
bodyWidth: root.contentWidth
|
||||||
bodyHeight: root.revealed
|
bodyHeight: root.revealed
|
||||||
ear: BarDrawers.ear
|
ear: BarDrawers.ear
|
||||||
@@ -94,7 +142,10 @@ Item {
|
|||||||
width: root.contentWidth
|
width: root.contentWidth
|
||||||
height: root.contentHeight
|
height: root.contentHeight
|
||||||
y: root.revealed - root.contentHeight
|
y: root.revealed - root.contentHeight
|
||||||
opacity: root.unrolls ? Math.min(1, root.progress * 1.6) : 1
|
opacity: root.liquid ? root.dropContent : root.unrolls ? Math.min(1, root.progress * 1.6) : 1
|
||||||
|
transform: Translate {
|
||||||
|
y: root.liquid ? (1 - root.dropContent) * 6 : 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "../core"
|
||||||
|
import "../theme"
|
||||||
|
// A bar module that is one glyph switching something on and off (Caffeine,
|
||||||
|
// Night Light). Lit in the accent colour while on. `bare` (the spots beside
|
||||||
|
// the notch) drops the pill and keeps only a soft hover circle.
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property string glyph
|
||||||
|
property bool on: false
|
||||||
|
property bool bare: false
|
||||||
|
property string tip: ""
|
||||||
|
signal clicked
|
||||||
|
implicitWidth: ModuleRegistry.pillHeight
|
||||||
|
implicitHeight: ModuleRegistry.pillHeight
|
||||||
|
opacity: enabled ? 1 : 0.45
|
||||||
|
GlassPill {
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: !root.bare
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.height - 6
|
||||||
|
height: width
|
||||||
|
radius: width / 2
|
||||||
|
color: root.on ? Qt.alpha(Theme.accent, 0.16) : Theme.hover
|
||||||
|
opacity: area.containsMouse || root.on ? 1 : 0
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.duration / 2 } }
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: root.glyph
|
||||||
|
color: root.on ? Theme.accent : Theme.text
|
||||||
|
font.pixelSize: Math.round(root.height * 0.46)
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.duration } }
|
||||||
|
}
|
||||||
|
scale: area.pressed ? 1 - 0.06 * Theme.intensity : 1
|
||||||
|
Behavior on scale { NumberAnimation { duration: Theme.duration / 2; easing.type: Easing.OutCubic } }
|
||||||
|
MouseArea {
|
||||||
|
id: area
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.clicked()
|
||||||
|
}
|
||||||
|
Accessible.role: Accessible.CheckBox
|
||||||
|
Accessible.name: root.tip
|
||||||
|
Accessible.checked: root.on
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "../theme"
|
||||||
|
|
||||||
|
// Hold-to-confirm overlay: accent liquid fills the parent shape while
|
||||||
|
// `holding` is true and emits completed() once full. Let go early and it
|
||||||
|
// drains. The glyph (or `inkSource`) turns the accent text colour where the
|
||||||
|
// liquid covers it, so the overlay sits on top of the button's own glyph.
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property bool holding: false
|
||||||
|
property int duration: 800
|
||||||
|
property real radius: Math.min(width, height) / 2
|
||||||
|
property color color: Theme.accent
|
||||||
|
property color inkColor: Theme.accentText
|
||||||
|
// The default ink is a centred glyph matching the button's own.
|
||||||
|
property string glyph
|
||||||
|
property string fallback
|
||||||
|
property int glyphSize: Math.round(Math.min(width, height) * 0.5)
|
||||||
|
property int glyphWeight: Font.Normal
|
||||||
|
// Any transparent item the size of this one, e.g. a row of labels.
|
||||||
|
property Item inkSource: defaultInk
|
||||||
|
property real progress: 0
|
||||||
|
property real time: 0
|
||||||
|
// Stays full for a moment after completing, in case the action fails.
|
||||||
|
property bool latched: false
|
||||||
|
readonly property bool active: progress > 0
|
||||||
|
signal completed
|
||||||
|
// Let go before full.
|
||||||
|
signal cancelled
|
||||||
|
|
||||||
|
onHoldingChanged: {
|
||||||
|
if (latched)
|
||||||
|
return;
|
||||||
|
if (holding) {
|
||||||
|
drain.stop();
|
||||||
|
rise.from = progress;
|
||||||
|
rise.duration = Math.max(1, (1 - progress) * duration);
|
||||||
|
rise.start();
|
||||||
|
} else if (rise.running || progress > 0) {
|
||||||
|
rise.stop();
|
||||||
|
if (progress < 1)
|
||||||
|
cancelled();
|
||||||
|
root.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function empty() {
|
||||||
|
drain.from = progress;
|
||||||
|
drain.duration = Theme.duration * 2.2 * progress;
|
||||||
|
drain.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: rise
|
||||||
|
target: root
|
||||||
|
property: "progress"
|
||||||
|
to: 1
|
||||||
|
easing.type: Easing.InOutSine
|
||||||
|
onFinished: if (root.progress >= 1) {
|
||||||
|
root.latched = true;
|
||||||
|
hold.restart();
|
||||||
|
root.completed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
id: drain
|
||||||
|
target: root
|
||||||
|
property: "progress"
|
||||||
|
to: 0
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
id: hold
|
||||||
|
interval: 900
|
||||||
|
onTriggered: {
|
||||||
|
root.latched = false;
|
||||||
|
if (!root.holding)
|
||||||
|
root.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FrameAnimation {
|
||||||
|
running: root.active && Theme.intensity > 0
|
||||||
|
onTriggered: root.time += frameTime
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: defaultInk
|
||||||
|
width: root.width
|
||||||
|
height: root.height
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: Icons.available && root.glyph ? root.glyph : root.fallback
|
||||||
|
font.family: Icons.available && root.glyph ? Icons.family : ""
|
||||||
|
font.pixelSize: root.glyphSize
|
||||||
|
font.weight: root.glyphWeight
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
ShaderEffectSource {
|
||||||
|
id: inkTexture
|
||||||
|
sourceItem: root.inkSource
|
||||||
|
hideSource: root.inkSource === defaultInk
|
||||||
|
live: true
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
ShaderEffect {
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: root.active
|
||||||
|
property point size: Qt.point(width, height)
|
||||||
|
property real radius: root.radius
|
||||||
|
property real level: root.progress
|
||||||
|
property real time: root.time
|
||||||
|
// Sloshes more while draining than while filling.
|
||||||
|
property real slosh: Math.max(1.2, root.height * 0.06) * Math.min(1, Theme.intensity) * (root.holding ? 1 : 1.6)
|
||||||
|
property vector4d fill: Qt.vector4d(root.color.r * root.color.a, root.color.g * root.color.a, root.color.b * root.color.a, root.color.a)
|
||||||
|
property vector4d ink: Qt.vector4d(root.inkColor.r * root.inkColor.a, root.inkColor.g * root.inkColor.a, root.inkColor.b * root.inkColor.a, root.inkColor.a)
|
||||||
|
property var glyph: inkTexture
|
||||||
|
fragmentShader: Qt.resolvedUrl("shaders/holdfill.frag.qsb")
|
||||||
|
Behavior on slosh {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.duration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import "../services"
|
||||||
|
import "../theme"
|
||||||
|
|
||||||
|
// Notch mode's own panel animation (BarDrawer swaps to it while notch mode
|
||||||
|
// is on). There is no bar to unroll from, so a glass bead swells out under the
|
||||||
|
// clicked island icon on a tapered neck, works as a lens on the wallpaper
|
||||||
|
// while it hangs, then widens into the panel and lets go of the island.
|
||||||
|
// Drawer-local coordinates; `progress` runs linearly, the easing lives here.
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property real progress: 0
|
||||||
|
property real bodyX: 0
|
||||||
|
property real bodyWidth: 300
|
||||||
|
property real bodyHeight: 200
|
||||||
|
// Drawer-local x of the icon the panel belongs to; -1 is the middle.
|
||||||
|
property real sourceX: -1
|
||||||
|
// Distance from the screen top to the drawer's top edge.
|
||||||
|
property real topSpace: 0
|
||||||
|
// Drawer-local y of the islands' bottom edge (negative: above the drawer).
|
||||||
|
property real islandBottom: -5
|
||||||
|
property real radius: Theme.radius
|
||||||
|
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
|
||||||
|
property color borderColor: Theme.border
|
||||||
|
property string screenName: ""
|
||||||
|
property real screenX: 0
|
||||||
|
|
||||||
|
y: -topSpace
|
||||||
|
height: topSpace + bodyHeight
|
||||||
|
visible: progress > 0.002
|
||||||
|
|
||||||
|
function clamp(x, a, b) {
|
||||||
|
return Math.min(b, Math.max(a, x));
|
||||||
|
}
|
||||||
|
function lerp(a, b, t) {
|
||||||
|
return a + (b - a) * t;
|
||||||
|
}
|
||||||
|
function sstep(a, b, x) {
|
||||||
|
const t = clamp((x - a) / (b - a), 0, 1);
|
||||||
|
return t * t * (3 - 2 * t);
|
||||||
|
}
|
||||||
|
function out3(t) {
|
||||||
|
return 1 - Math.pow(1 - clamp(t, 0, 1), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property var g: {
|
||||||
|
const p = progress, W = bodyWidth, H = bodyHeight, X = bodyX;
|
||||||
|
const panelR = Math.min(radius, W / 2, H / 2);
|
||||||
|
// Small panels (tooltips) get a smaller bead.
|
||||||
|
const bulbMax = Math.max(6, Math.min(40, W / 2 - 2, H / 2 - 2));
|
||||||
|
const top = islandBottom - 3;
|
||||||
|
const sx = clamp(sourceX < 0 ? X + W / 2 : sourceX, X + bulbMax + 2, X + W - bulbMax - 2);
|
||||||
|
const a = out3(p / 0.4); // bead swells and sinks
|
||||||
|
const b = clamp((p - 0.3) / 0.62, 0, 1); // bead becomes the panel
|
||||||
|
const eb = out3(b);
|
||||||
|
const release = sstep(0.8, 0.95, p); // the neck lets go
|
||||||
|
// The bead shrinks all the way back into the island, so the last frame
|
||||||
|
// before the layer unmaps is empty (Hyprland fades that frame out).
|
||||||
|
const grow = sstep(0.015, 0.12, p);
|
||||||
|
const bulbR = Math.max(0.01, lerp(0, bulbMax, a) * grow);
|
||||||
|
const hang = Math.max(4, Math.min(66, H - bulbMax - 2 - top));
|
||||||
|
const beadY = top + lerp(4, hang, a);
|
||||||
|
// A small sideways swell as it settles, kept inside the ears.
|
||||||
|
const swell = Math.sin(clamp((b - 0.55) / 0.45, 0, 1) * Math.PI) * 0.03;
|
||||||
|
const halfW = Math.min(lerp(bulbR, W / 2, eb) * (1 + swell), W / 2 + X - 1);
|
||||||
|
const halfH = lerp(bulbR, H / 2, eb);
|
||||||
|
const cx = lerp(sx, X + W / 2, eb), cy = lerp(beadY, H / 2, eb);
|
||||||
|
return {
|
||||||
|
stem: Qt.vector4d(sx, top, lerp(6, 11, a) * grow * (1 - release), lerp(bulbR * 0.9, 10, eb) * (1 - release)),
|
||||||
|
stemH: lerp(beadY, 12, eb) - top,
|
||||||
|
box: Qt.vector4d(cx, cy, halfW, halfH),
|
||||||
|
boxR: Math.min(lerp(bulbR, panelR, eb), halfW, halfH),
|
||||||
|
melt: lerp(20, 6, release),
|
||||||
|
// Only the bead is a lens; it clears before the panel takes shape.
|
||||||
|
lens: Qt.vector4d(cx, cy, Math.min(Math.max(halfW, halfH), bulbMax * 1.4), 1 - sstep(0.3, 0.52, p))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// The wallpaper under this screen, for the lens. Loaded only while the drop
|
||||||
|
// is out; the pixmap cache keeps it for the next opening.
|
||||||
|
readonly property var screenObj: Quickshell.screens.find(s => s.name === screenName) || null
|
||||||
|
readonly property string wallPath: {
|
||||||
|
if (!screenName || !ConfigService.ready)
|
||||||
|
return "";
|
||||||
|
return WallpaperService.observed[screenName] || ConfigService.data.wallpaper.byMonitor[screenName] || "";
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: wallImage
|
||||||
|
visible: false
|
||||||
|
asynchronous: true
|
||||||
|
cache: true
|
||||||
|
sourceSize.width: 1280
|
||||||
|
source: root.visible && root.wallPath ? "file://" + root.wallPath : ""
|
||||||
|
}
|
||||||
|
readonly property vector4d cover: {
|
||||||
|
const iw = wallImage.implicitWidth, ih = wallImage.implicitHeight;
|
||||||
|
const sw = screenObj ? screenObj.width : 1920, sh = screenObj ? screenObj.height : 1080;
|
||||||
|
if (iw <= 0 || ih <= 0)
|
||||||
|
return Qt.vector4d(0, 0, 0, 0);
|
||||||
|
const sc = Math.max(sw / iw, sh / ih), w = iw * sc, h = ih * sc;
|
||||||
|
return Qt.vector4d(1 / w, 1 / h, (w - sw) / 2 / w, (h - sh) / 2 / h);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderEffect {
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: root.sstep(0.005, 0.04, root.progress)
|
||||||
|
property point size: Qt.point(width, height)
|
||||||
|
property real topY: -root.topSpace
|
||||||
|
property vector4d stem: root.g.stem
|
||||||
|
property real stemH: root.g.stemH
|
||||||
|
property vector4d box: root.g.box
|
||||||
|
property real boxR: root.g.boxR
|
||||||
|
property real melt: root.g.melt
|
||||||
|
property vector4d lens: root.g.lens
|
||||||
|
property vector4d fill: Qt.vector4d(root.fillColor.r * root.fillColor.a, root.fillColor.g * root.fillColor.a, root.fillColor.b * root.fillColor.a, root.fillColor.a)
|
||||||
|
property vector4d edge: Qt.vector4d(root.borderColor.r * root.borderColor.a, root.borderColor.g * root.borderColor.a, root.borderColor.b * root.borderColor.a, root.borderColor.a)
|
||||||
|
property vector4d cover: root.cover
|
||||||
|
property point screenOrigin: Qt.point(root.screenX, root.topSpace)
|
||||||
|
property real hasWall: wallImage.status === Image.Ready ? 1 : 0
|
||||||
|
property var wall: wallImage
|
||||||
|
fragmentShader: Qt.resolvedUrl("shaders/notchdrop.frag.qsb")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#version 440
|
||||||
|
// Hold-to-confirm fill (HoldFill.qml): accent liquid rises inside a rounded
|
||||||
|
// shape while a button is held, with a wavy surface, a paler back wave and a
|
||||||
|
// lit meniscus. The glyph texture is inked in the accent text colour where the
|
||||||
|
// liquid covers it. Output is premultiplied.
|
||||||
|
// Rebuild holdfill.frag.qsb with scripts/build-shaders after editing.
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform buf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
vec2 size; // item size, px
|
||||||
|
float radius; // corner radius, px
|
||||||
|
float level; // 0 empty .. 1 full
|
||||||
|
float time; // seconds, drives the waves
|
||||||
|
float slosh; // wave amplitude, px
|
||||||
|
vec4 fill; // premultiplied liquid colour
|
||||||
|
vec4 ink; // premultiplied glyph colour under the liquid
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D glyph;
|
||||||
|
|
||||||
|
float sdBox(vec2 p, vec2 h, float r) {
|
||||||
|
r = min(r, min(h.x, h.y));
|
||||||
|
vec2 q = abs(p) - h + r;
|
||||||
|
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 p = qt_TexCoord0 * size;
|
||||||
|
float shape = clamp(0.5 - sdBox(p - size * 0.5, size * 0.5, radius), 0.0, 1.0);
|
||||||
|
if (shape <= 0.0 || level <= 0.0) {
|
||||||
|
fragColor = vec4(0.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Waves calm down at the very bottom and top so it starts and ends flat.
|
||||||
|
float amp = slosh * smoothstep(0.0, 0.18, level) * (1.0 - smoothstep(0.82, 1.0, level));
|
||||||
|
float x = p.x / max(size.x, 1.0) * 6.2831853;
|
||||||
|
float base = mix(size.y + amp * 2.0, -amp * 2.0, level);
|
||||||
|
float front = base + amp * (sin(x * 1.3 + time * 4.2) * 0.65 + sin(x * 2.1 - time * 2.9) * 0.35);
|
||||||
|
float back = base - amp * 0.6 + amp * sin(x * 1.1 - time * 3.4 + 1.7);
|
||||||
|
|
||||||
|
float aFront = clamp(p.y - front + 0.5, 0.0, 1.0);
|
||||||
|
float aBack = clamp(p.y - back + 0.5, 0.0, 1.0) * 0.42;
|
||||||
|
|
||||||
|
// Deeper liquid is a touch darker; a bright band sits under the surface.
|
||||||
|
float depth = clamp((p.y - front) / max(size.y, 1.0), 0.0, 1.0);
|
||||||
|
vec3 col = fill.rgb * (1.0 - 0.16 * depth);
|
||||||
|
float meniscus = exp(-max(p.y - front, 0.0) / 1.6) * aFront;
|
||||||
|
col = mix(col, vec3(fill.a), 0.28 * meniscus);
|
||||||
|
|
||||||
|
vec4 c = vec4(fill.rgb, fill.a) * aBack;
|
||||||
|
c = c * (1.0 - aFront) + vec4(col, fill.a) * aFront;
|
||||||
|
float g = texture(glyph, qt_TexCoord0).a * aFront;
|
||||||
|
c = c * (1.0 - g * ink.a) + ink * g;
|
||||||
|
fragColor = c * shape * qt_Opacity;
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,96 @@
|
|||||||
|
#version 440
|
||||||
|
// Notch-mode panel opening (NotchDrop.qml): a glass bead swells out of the
|
||||||
|
// island under the clicked icon on a tapered neck, flips the wallpaper behind
|
||||||
|
// it like a lens, then widens into the panel and the neck lets go.
|
||||||
|
// The shape is one signed distance field: an uneven capsule (the neck) melted
|
||||||
|
// into a rounded box (bead, then panel). Geometry comes from QML per frame.
|
||||||
|
// Output is premultiplied; HyprGlass adds its blur where alpha is above its
|
||||||
|
// mask threshold, so the lens and fill sit on top of the compositor glass.
|
||||||
|
// Rebuild notchdrop.frag.qsb with scripts/build-shaders after editing.
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform buf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
vec2 size; // item size, px
|
||||||
|
float topY; // drawer-local y of the item's top edge
|
||||||
|
vec4 stem; // neck: top x, top y, top radius, bottom radius
|
||||||
|
float stemH; // neck length
|
||||||
|
vec4 box; // bead/panel: centre x, y, half width, half height
|
||||||
|
float boxR;
|
||||||
|
float melt; // smooth-union width between neck and bead
|
||||||
|
vec4 lens; // centre x, y, radius, strength
|
||||||
|
vec4 fill; // premultiplied
|
||||||
|
vec4 edge; // premultiplied hairline
|
||||||
|
vec4 cover; // screen px -> wallpaper uv: scale xy, offset zw
|
||||||
|
vec2 screenOrigin; // screen position of drawer-local (0, 0)
|
||||||
|
float hasWall;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D wall;
|
||||||
|
|
||||||
|
float sdBox(vec2 p, vec2 c, vec2 h, float r) {
|
||||||
|
r = min(r, min(h.x, h.y));
|
||||||
|
vec2 q = abs(p - c) - h + r;
|
||||||
|
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
|
||||||
|
}
|
||||||
|
// Vertical capsule with different end radii, axis pointing down (+y).
|
||||||
|
float sdNeck(vec2 p, float r1, float r2, float h) {
|
||||||
|
h = max(h, abs(r1 - r2) + 0.5);
|
||||||
|
p.x = abs(p.x);
|
||||||
|
float b = (r1 - r2) / h;
|
||||||
|
float a = sqrt(max(1.0 - b * b, 0.0));
|
||||||
|
float k = dot(p, vec2(-b, a));
|
||||||
|
if (k < 0.0)
|
||||||
|
return length(p) - r1;
|
||||||
|
if (k > a * h)
|
||||||
|
return length(p - vec2(0.0, h)) - r2;
|
||||||
|
return dot(p, vec2(a, b)) - r1;
|
||||||
|
}
|
||||||
|
float smin(float a, float b, float k) {
|
||||||
|
k = max(k, 0.001);
|
||||||
|
float h = max(k - abs(a - b), 0.0) / k;
|
||||||
|
return min(a, b) - h * h * k * 0.25;
|
||||||
|
}
|
||||||
|
float scene(vec2 p) {
|
||||||
|
float n = stem.z + stem.w > 0.05 ? sdNeck(p - stem.xy, stem.z, stem.w, stemH) : 1e5;
|
||||||
|
return smin(n, sdBox(p, box.xy, box.zw, boxR), melt);
|
||||||
|
}
|
||||||
|
vec3 wallAt(vec2 p) {
|
||||||
|
return texture(wall, (p + screenOrigin) * cover.xy + cover.zw).rgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 p = qt_TexCoord0 * size + vec2(0.0, topY);
|
||||||
|
float d = scene(p);
|
||||||
|
if (d > 1.5) {
|
||||||
|
fragColor = vec4(0.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vec2 e = vec2(1.0, 0.0);
|
||||||
|
vec2 g = vec2(scene(p + e.xy) - scene(p - e.xy), scene(p + e.yx) - scene(p - e.yx));
|
||||||
|
g = length(g) > 1e-5 ? normalize(g) : vec2(0.0, 1.0); // points outwards
|
||||||
|
float depth = clamp(-d / 16.0, 0.0, 1.0);
|
||||||
|
float rim = pow(1.0 - depth, 2.2);
|
||||||
|
|
||||||
|
vec4 c = fill;
|
||||||
|
// The hanging bead is a lens: the wallpaper behind it, upside down.
|
||||||
|
float la = lens.w * hasWall * (1.0 - smoothstep(lens.z * 0.55, lens.z * 1.05, length(p - lens.xy)));
|
||||||
|
if (la > 0.002) {
|
||||||
|
vec2 q = lens.xy - (p - lens.xy) * 0.9 + g * rim * 10.0;
|
||||||
|
vec3 w = (wallAt(q) * 2.0 + wallAt(q + vec2(1.5, 0.0)) + wallAt(q - vec2(1.5, 0.0))
|
||||||
|
+ wallAt(q + vec2(0.0, 1.5)) + wallAt(q - vec2(0.0, 1.5))) / 6.0;
|
||||||
|
c = mix(c, vec4(w * 0.94, 1.0), la * 0.9);
|
||||||
|
}
|
||||||
|
// Light from the top left, and the bright lower lip of a drop.
|
||||||
|
float r6 = pow(1.0 - depth, 6.0);
|
||||||
|
float hl = r6 * (0.26 * max(0.0, dot(g, normalize(vec2(-0.6, -1.0))))
|
||||||
|
+ 0.42 * max(0.0, g.y) * (0.35 + 0.65 * lens.w));
|
||||||
|
c = clamp(c + vec4(hl, hl, hl, hl * 0.6), 0.0, 1.0);
|
||||||
|
// Hairline, as the other drawers have.
|
||||||
|
float line = smoothstep(1.2, 0.0, abs(d + 0.5));
|
||||||
|
c = mix(c, edge + c * (1.0 - edge.a), line);
|
||||||
|
|
||||||
|
fragColor = c * clamp(0.5 - d, 0.0, 1.0) * qt_Opacity;
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -268,6 +268,8 @@
|
|||||||
"mediaFirst": true,
|
"mediaFirst": true,
|
||||||
"left": ["workspaces"],
|
"left": ["workspaces"],
|
||||||
"right": ["tray"],
|
"right": ["tray"],
|
||||||
|
"innerLeft": [],
|
||||||
|
"innerRight": [],
|
||||||
"strip": [],
|
"strip": [],
|
||||||
"controls": [],
|
"controls": [],
|
||||||
"opacity": 0,
|
"opacity": 0,
|
||||||
@@ -277,6 +279,8 @@
|
|||||||
"openSpeed": 100,
|
"openSpeed": 100,
|
||||||
"closeSpeed": 100,
|
"closeSpeed": 100,
|
||||||
"colorSpeed": 100,
|
"colorSpeed": 100,
|
||||||
|
"panelOpenSpeed": 100,
|
||||||
|
"panelCloseSpeed": 100,
|
||||||
"workspaceStyle": "bar",
|
"workspaceStyle": "bar",
|
||||||
"islandStyle": "float"
|
"islandStyle": "float"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,14 +2,24 @@ import QtQuick
|
|||||||
import "../components"
|
import "../components"
|
||||||
import "../theme"
|
import "../theme"
|
||||||
|
|
||||||
// Round icon toggle; filled with the accent while on.
|
// Round icon toggle; filled with the accent while on. With `hold` it is a
|
||||||
|
// hold-to-confirm button instead: liquid fills it while held and held() fires
|
||||||
|
// once full; clicked() is not emitted.
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property string glyph
|
property string glyph
|
||||||
property string fallback
|
property string fallback
|
||||||
property bool checked: false
|
property bool checked: false
|
||||||
property int size: 34
|
property int size: 34
|
||||||
|
property bool hold: false
|
||||||
|
// Callers may withhold filling, e.g. until an action is pending.
|
||||||
|
property bool armed: true
|
||||||
|
readonly property bool holding: hold && armed && area.pressed && area.containsMouse
|
||||||
|
readonly property bool pressed: area.pressed
|
||||||
|
readonly property bool filled: fill.active
|
||||||
signal clicked
|
signal clicked
|
||||||
|
signal held
|
||||||
|
signal holdCancelled
|
||||||
implicitWidth: size
|
implicitWidth: size
|
||||||
implicitHeight: size
|
implicitHeight: size
|
||||||
opacity: enabled ? 1 : 0.45
|
opacity: enabled ? 1 : 0.45
|
||||||
@@ -32,12 +42,25 @@ Item {
|
|||||||
easing.type: Easing.OutCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HoldFill {
|
||||||
|
id: fill
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: root.hold
|
||||||
|
holding: root.holding
|
||||||
|
glyph: root.glyph
|
||||||
|
fallback: root.fallback
|
||||||
|
glyphSize: Math.round(root.size * 0.5)
|
||||||
|
glyphWeight: Font.DemiBold
|
||||||
|
onCompleted: root.held()
|
||||||
|
onCancelled: root.holdCancelled()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: area
|
id: area
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.clicked()
|
onClicked: if (!root.hold)
|
||||||
|
root.clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,8 @@ import "../../services"
|
|||||||
import "../../theme"
|
import "../../theme"
|
||||||
|
|
||||||
// Session actions as round buttons, wrapped to the tile. When they do not fit
|
// Session actions as round buttons, wrapped to the tile. When they do not fit
|
||||||
// it becomes one power button that extends into a list. Confirmation for
|
// it becomes one power button that extends into a list. Destructive actions
|
||||||
// destructive actions extends below the tile.
|
// are held to confirm: accent liquid fills the button, then the action runs.
|
||||||
CCModule {
|
CCModule {
|
||||||
id: root
|
id: root
|
||||||
readonly property var actions: [
|
readonly property var actions: [
|
||||||
@@ -56,10 +56,9 @@ CCModule {
|
|||||||
readonly property real buttonSize: labels || plain ? 34 : squeezed
|
readonly property real buttonSize: labels || plain ? 34 : squeezed
|
||||||
readonly property real buttonWidth: labels ? 52 : buttonSize
|
readonly property real buttonWidth: labels ? 52 : buttonSize
|
||||||
readonly property bool fits: labels || plain || squeezed >= 24
|
readonly property bool fits: labels || plain || squeezed >= 24
|
||||||
readonly property bool pending: PowerService.pending !== ""
|
|
||||||
round: !fits
|
round: !fits
|
||||||
hovered: menuArea.containsMouse
|
hovered: menuArea.containsMouse
|
||||||
extraHeight: (pending || (expanded && !fits)) && extension.item ? extension.implicitHeight + 20 : 0
|
extraHeight: expanded && !fits && extension.item ? extension.implicitHeight + 20 : 0
|
||||||
Component.onDestruction: PowerService.cancel()
|
Component.onDestruction: PowerService.cancel()
|
||||||
function allowed(id) {
|
function allowed(id) {
|
||||||
return (id === "lock" && ConfigService.ready && ConfigService.data.lock.enabled) || (!!SystemService.state.power && !!SystemService.state.power[id] && !SystemService.acting);
|
return (id === "lock" && ConfigService.ready && ConfigService.data.lock.enabled) || (!!SystemService.state.power && !!SystemService.state.power[id] && !SystemService.acting);
|
||||||
@@ -78,22 +77,41 @@ CCModule {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: action
|
id: action
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
// A tap on a hold button says to hold it, in place of the label.
|
||||||
|
property bool hint: false
|
||||||
Layout.preferredWidth: root.buttonWidth
|
Layout.preferredWidth: root.buttonWidth
|
||||||
spacing: 3
|
spacing: 3
|
||||||
|
Timer {
|
||||||
|
id: hintTimer
|
||||||
|
interval: 1600
|
||||||
|
onTriggered: action.hint = false
|
||||||
|
}
|
||||||
CCToggle {
|
CCToggle {
|
||||||
objectName: "power-" + action.modelData.id
|
objectName: "power-" + action.modelData.id
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
size: root.buttonSize
|
size: root.buttonSize
|
||||||
glyph: action.modelData.glyph
|
glyph: action.modelData.glyph
|
||||||
fallback: action.modelData.label.charAt(0)
|
fallback: action.modelData.label.charAt(0)
|
||||||
checked: PowerService.pending === action.modelData.id
|
hold: PowerService.needsHold(action.modelData.id)
|
||||||
|
armed: PowerService.pending === action.modelData.id
|
||||||
enabled: root.allowed(action.modelData.id)
|
enabled: root.allowed(action.modelData.id)
|
||||||
onClicked: PowerService.request(action.modelData.id)
|
onClicked: PowerService.request(action.modelData.id)
|
||||||
Accessible.name: action.modelData.label
|
onPressedChanged: if (hold) {
|
||||||
|
if (pressed)
|
||||||
|
PowerService.request(action.modelData.id);
|
||||||
|
else if (armed)
|
||||||
|
PowerService.cancel();
|
||||||
|
}
|
||||||
|
onHeld: PowerService.confirm()
|
||||||
|
onHoldCancelled: {
|
||||||
|
action.hint = true;
|
||||||
|
hintTimer.restart();
|
||||||
|
}
|
||||||
|
Accessible.name: hold ? "Hold to " + action.modelData.label.toLowerCase() : action.modelData.label
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
visible: root.labels
|
visible: root.labels
|
||||||
text: action.modelData.label
|
text: action.hint ? "Hold" : action.modelData.label
|
||||||
color: Theme.textSecondary
|
color: Theme.textSecondary
|
||||||
font.pixelSize: 10
|
font.pixelSize: 10
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
@@ -140,8 +158,8 @@ CCModule {
|
|||||||
x: 10
|
x: 10
|
||||||
y: root.baseHeight + 6
|
y: root.baseHeight + 6
|
||||||
width: root.width - 20
|
width: root.width - 20
|
||||||
active: root.pending || (root.expanded && !root.fits)
|
active: root.expanded && !root.fits
|
||||||
sourceComponent: root.pending ? confirm : menu
|
sourceComponent: menu
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: menu
|
id: menu
|
||||||
@@ -152,29 +170,53 @@ CCModule {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: item
|
id: item
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
readonly property bool hold: PowerService.needsHold(modelData.id)
|
||||||
|
property bool hint: false
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
radius: 8
|
radius: 8
|
||||||
enabled: root.allowed(modelData.id)
|
enabled: root.allowed(modelData.id)
|
||||||
opacity: enabled ? 1 : 0.45
|
opacity: enabled ? 1 : 0.45
|
||||||
color: itemArea.containsMouse ? Theme.hover : Theme.transparent
|
color: itemArea.containsMouse ? Theme.hover : Theme.transparent
|
||||||
RowLayout {
|
Timer {
|
||||||
|
id: rowHint
|
||||||
|
interval: 1600
|
||||||
|
onTriggered: item.hint = false
|
||||||
|
}
|
||||||
|
// Transparent, so it doubles as the ink mask for the fill.
|
||||||
|
Item {
|
||||||
|
id: rowContent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: 8
|
RowLayout {
|
||||||
anchors.rightMargin: 8
|
anchors.fill: parent
|
||||||
spacing: 8
|
anchors.leftMargin: 8
|
||||||
Text {
|
anchors.rightMargin: 8
|
||||||
text: Icons.available ? item.modelData.glyph : ""
|
spacing: 8
|
||||||
font.family: Icons.family
|
Text {
|
||||||
font.pixelSize: 14
|
text: Icons.available ? item.modelData.glyph : ""
|
||||||
color: Theme.text
|
font.family: Icons.family
|
||||||
|
font.pixelSize: 14
|
||||||
|
color: Theme.text
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: item.hint ? "Hold to " + item.modelData.label.toLowerCase() : item.modelData.label
|
||||||
|
color: Theme.text
|
||||||
|
font.pixelSize: 12
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
}
|
||||||
text: item.modelData.label
|
HoldFill {
|
||||||
color: Theme.text
|
anchors.fill: parent
|
||||||
font.pixelSize: 12
|
visible: item.hold
|
||||||
elide: Text.ElideRight
|
radius: item.radius
|
||||||
Layout.fillWidth: true
|
inkSource: rowContent
|
||||||
|
holding: item.hold && itemArea.pressed && itemArea.containsMouse && PowerService.pending === item.modelData.id
|
||||||
|
onCompleted: PowerService.confirm()
|
||||||
|
onCancelled: {
|
||||||
|
item.hint = true;
|
||||||
|
rowHint.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -183,39 +225,17 @@ CCModule {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: PowerService.request(item.modelData.id)
|
onClicked: if (!item.hold)
|
||||||
|
PowerService.request(item.modelData.id)
|
||||||
|
onPressedChanged: if (item.hold) {
|
||||||
|
if (pressed)
|
||||||
|
PowerService.request(item.modelData.id);
|
||||||
|
else if (PowerService.pending === item.modelData.id)
|
||||||
|
PowerService.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
|
||||||
id: confirm
|
|
||||||
ColumnLayout {
|
|
||||||
spacing: 8
|
|
||||||
Text {
|
|
||||||
text: "Confirm " + PowerService.pending + "? Unsaved work may be lost."
|
|
||||||
color: Theme.text
|
|
||||||
font.pixelSize: 12
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
RowLayout {
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
spacing: 8
|
|
||||||
GlassButton {
|
|
||||||
objectName: "powerCancel"
|
|
||||||
text: "Cancel"
|
|
||||||
onClicked: PowerService.cancel()
|
|
||||||
}
|
|
||||||
GlassButton {
|
|
||||||
objectName: "powerConfirm"
|
|
||||||
text: "Confirm"
|
|
||||||
accented: true
|
|
||||||
enabled: !SystemService.acting
|
|
||||||
onClicked: PowerService.confirm()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,9 @@ Singleton {
|
|||||||
return [];
|
return [];
|
||||||
return hasOwn(screenName) ? screens[screenName].modules : ConfigService.data.bar.modules;
|
return hasOwn(screenName) ? screens[screenName].modules : ConfigService.data.bar.modules;
|
||||||
}
|
}
|
||||||
// Entries for a notch module list ("left", "right" or "strip"). Each reuses
|
// Entries for a notch module list ("left", "right", "innerLeft",
|
||||||
// the module's bar entry for its options when the layout has one.
|
// "innerRight" or "strip"). Each reuses the module's bar entry for its
|
||||||
|
// options when the layout has one.
|
||||||
function notchModules(screenName, key) {
|
function notchModules(screenName, key) {
|
||||||
if (!ConfigService.ready || !ConfigService.data.notch)
|
if (!ConfigService.ready || !ConfigService.data.notch)
|
||||||
return [];
|
return [];
|
||||||
@@ -28,7 +29,9 @@ Singleton {
|
|||||||
id: id,
|
id: id,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
notch: true,
|
notch: true,
|
||||||
position: key === "right" ? "right" : key === "left" ? "left" : "center"
|
// The spots beside the notch never draw pills.
|
||||||
|
bare: key === "innerLeft" || key === "innerRight",
|
||||||
|
position: key === "right" || key === "innerRight" ? "right" : key === "left" || key === "innerLeft" ? "left" : "center"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
// Saves to the screen's own layout when it has one, else the shared layout.
|
// Saves to the screen's own layout when it has one, else the shared layout.
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ Singleton {
|
|||||||
clock: Qt.resolvedUrl("../bar/modules/ClockModule.qml"),
|
clock: Qt.resolvedUrl("../bar/modules/ClockModule.qml"),
|
||||||
tray: Qt.resolvedUrl("../bar/modules/TrayModule.qml"),
|
tray: Qt.resolvedUrl("../bar/modules/TrayModule.qml"),
|
||||||
system: Qt.resolvedUrl("../bar/modules/SystemModule.qml"),
|
system: Qt.resolvedUrl("../bar/modules/SystemModule.qml"),
|
||||||
volume: Qt.resolvedUrl("../bar/modules/VolumeModule.qml")
|
volume: Qt.resolvedUrl("../bar/modules/VolumeModule.qml"),
|
||||||
|
caffeine: Qt.resolvedUrl("../bar/modules/CaffeineModule.qml"),
|
||||||
|
nightLight: Qt.resolvedUrl("../bar/modules/NightLightModule.qml")
|
||||||
})
|
})
|
||||||
// Installed plugin bar widgets are modules named "plugin:<id>".
|
// Installed plugin bar widgets are modules named "plugin:<id>".
|
||||||
function isPlugin(id) { return String(id).startsWith("plugin:"); }
|
function isPlugin(id) { return String(id).startsWith("plugin:"); }
|
||||||
@@ -33,7 +35,7 @@ Singleton {
|
|||||||
activeWindow: "Windows", cava: "Visualizer", clock: "Clock", cpu: "CPU", cpuTemperature: "CPU temp",
|
activeWindow: "Windows", cava: "Visualizer", clock: "Clock", cpu: "CPU", cpuTemperature: "CPU temp",
|
||||||
gpu: "GPU", gpuTemperature: "GPU temp", networkThroughput: "Network", nowPlaying: "Now playing",
|
gpu: "GPU", gpuTemperature: "GPU temp", networkThroughput: "Network", nowPlaying: "Now playing",
|
||||||
ram: "Memory", settings: "Settings", storage: "Storage", system: "System", tray: "Tray",
|
ram: "Memory", settings: "Settings", storage: "Storage", system: "System", tray: "Tray",
|
||||||
volume: "Volume", workspaces: "Workspaces"
|
volume: "Volume", workspaces: "Workspaces", caffeine: "Caffeine", nightLight: "Night Light"
|
||||||
})
|
})
|
||||||
function title(id) { return isPlugin(id) ? PluginService.title(String(id).slice(7)) : titles[id] || id; }
|
function title(id) { return isPlugin(id) ? PluginService.title(String(id).slice(7)) : titles[id] || id; }
|
||||||
// Per-module options edited from the cog on each card in Settings → Bar.
|
// Per-module options edited from the cog on each card in Settings → Bar.
|
||||||
@@ -48,8 +50,43 @@ Singleton {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
// Cog options stored outside the module entry: a config path shared by every
|
// Cog options stored outside the module entry: a config path shared by every
|
||||||
// layout (`setting`), or another module's enabled flag (`module`).
|
// layout (`setting`), or another module's enabled flag (`module`). Every cog
|
||||||
|
// opens inline; these mirror the controls on the module's settings page.
|
||||||
|
readonly property var metricsOptions: [
|
||||||
|
{ key: "interval", setting: "metrics.interval", label: "Sampling interval", type: "integer", min: 1, max: 30, description: "Seconds between samples, shared by every metric" }
|
||||||
|
]
|
||||||
|
readonly property var gpuOption: ({ key: "gpu", setting: "metrics.gpu", label: "GPU", type: "choice",
|
||||||
|
choices: ["auto"].concat(MetricsService.gpus.map(g => g.id)),
|
||||||
|
choiceLabels: ["Automatic"].concat(MetricsService.gpus.map(g => g.name)) })
|
||||||
readonly property var sharedOptions: ({
|
readonly property var sharedOptions: ({
|
||||||
|
clock: [
|
||||||
|
{ key: "showDate", setting: "bar.clock.showDate", label: "Show date", type: "boolean" },
|
||||||
|
{ key: "use24Hour", setting: "bar.clock.use24Hour", label: "24-hour time", type: "boolean" },
|
||||||
|
{ key: "showSeconds", setting: "bar.clock.showSeconds", label: "Show seconds", type: "boolean" }
|
||||||
|
],
|
||||||
|
workspaces: [
|
||||||
|
{ key: "style", setting: "bar.workspaces.style", label: "Style", type: "choice", choices: ["numbers", "roman", "kanji", "dots", "pacman"] },
|
||||||
|
{ key: "preview", setting: "bar.workspaces.preview", label: "Preview on hover", type: "boolean" },
|
||||||
|
{ key: "count", setting: "bar.workspaces.count", label: "Count", type: "integer", min: 1, max: 20 }
|
||||||
|
],
|
||||||
|
tray: [
|
||||||
|
{ key: "background", setting: "tray.background", label: "Background", type: "choice", choices: ["pill", "transparent", "icons"] },
|
||||||
|
{ key: "hoverMenus", setting: "tray.hoverMenus", label: "Hover menus", type: "boolean", description: "Open application menus on hover" },
|
||||||
|
{ key: "iconSize", setting: "tray.iconSize", label: "Icon size", type: "integer", min: 16, max: 32 },
|
||||||
|
{ key: "spacing", setting: "tray.spacing", label: "Spacing", type: "integer", min: 0, max: 24 }
|
||||||
|
],
|
||||||
|
volume: [
|
||||||
|
{ key: "step", setting: "osd.step", label: "Step", type: "integer", min: 1, max: 20, description: "Percent per scroll or key press" }
|
||||||
|
],
|
||||||
|
cpu: metricsOptions,
|
||||||
|
cpuTemperature: metricsOptions,
|
||||||
|
ram: metricsOptions,
|
||||||
|
storage: metricsOptions,
|
||||||
|
gpu: metricsOptions.concat([gpuOption]),
|
||||||
|
gpuTemperature: metricsOptions.concat([gpuOption]),
|
||||||
|
networkThroughput: metricsOptions.concat([{ key: "networkInterface", setting: "metrics.networkInterface", label: "Interface", type: "choice",
|
||||||
|
description: "Auto totals physical interfaces to avoid counting VPN/bridge traffic twice",
|
||||||
|
choices: Array.from(new Set(["auto", ConfigService.ready ? ConfigService.data.metrics.networkInterface : "auto"].concat((MetricsService.network.interfaces || []).map(i => i.name)))) }]),
|
||||||
nowPlaying: [
|
nowPlaying: [
|
||||||
{ key: "visualizer", module: "cava", label: "Visualizer", type: "boolean", description: "Cava bars beside the track; shows system audio and only runs while something plays" },
|
{ key: "visualizer", module: "cava", label: "Visualizer", type: "boolean", description: "Cava bars beside the track; shows system audio and only runs while something plays" },
|
||||||
{ key: "cavaBars", setting: "bar.cava.bars", label: "Visualizer bars", type: "integer", min: 4, max: 24 },
|
{ key: "cavaBars", setting: "bar.cava.bars", label: "Visualizer bars", type: "integer", min: 4, max: 24 },
|
||||||
@@ -62,20 +99,17 @@ Singleton {
|
|||||||
{ key: "cavaHide", setting: "bar.cava.hideWhenIdle", label: "Hide while paused", type: "boolean" }
|
{ key: "cavaHide", setting: "bar.cava.hideWhenIdle", label: "Hide while paused", type: "boolean" }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
// Modules whose options already live on a settings page: the cog jumps there.
|
// Modules with more on a settings page than fits the cog: the open cog
|
||||||
readonly property var settingsLinks: ({
|
// ends with a link there.
|
||||||
clock: { page: "bar", setting: "Show date" },
|
readonly property var moreSettings: ({
|
||||||
workspaces: { page: "bar", setting: "Workspace style" },
|
volume: { page: "osd", title: "OSD" },
|
||||||
tray: { page: "tray", setting: "" },
|
cpu: { page: "metrics", title: "Metrics" },
|
||||||
volume: { page: "osd", setting: "Step" },
|
cpuTemperature: { page: "metrics", title: "Metrics" },
|
||||||
system: { page: "controlcenter", setting: "" },
|
gpu: { page: "metrics", title: "Metrics" },
|
||||||
cpu: { page: "metrics", setting: "" },
|
gpuTemperature: { page: "metrics", title: "Metrics" },
|
||||||
cpuTemperature: { page: "metrics", setting: "" },
|
ram: { page: "metrics", title: "Metrics" },
|
||||||
gpu: { page: "metrics", setting: "" },
|
storage: { page: "metrics", title: "Metrics" },
|
||||||
gpuTemperature: { page: "metrics", setting: "" },
|
networkThroughput: { page: "metrics", title: "Metrics" }
|
||||||
ram: { page: "metrics", setting: "" },
|
|
||||||
storage: { page: "metrics", setting: "" },
|
|
||||||
networkThroughput: { page: "metrics", setting: "" }
|
|
||||||
})
|
})
|
||||||
function option(entry, key) {
|
function option(entry, key) {
|
||||||
const schema = (optionSchemas[entry.id] || []).find(o => o.key === key);
|
const schema = (optionSchemas[entry.id] || []).find(o => o.key === key);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import "../components"
|
||||||
import "../theme"
|
import "../theme"
|
||||||
|
|
||||||
// Round glyph button used by the media controls and the power tab.
|
// Round glyph button used by the media controls and the power tab.
|
||||||
@@ -12,7 +13,17 @@ Rectangle {
|
|||||||
property bool active: false
|
property bool active: false
|
||||||
property bool danger: false
|
property bool danger: false
|
||||||
property bool interactive: true
|
property bool interactive: true
|
||||||
|
// Hold-to-confirm: liquid fills the button while held, held() fires once
|
||||||
|
// full and clicked() is not emitted.
|
||||||
|
property bool hold: false
|
||||||
|
// Callers may withhold filling, e.g. until an action is pending.
|
||||||
|
property bool armed: true
|
||||||
|
readonly property bool holding: hold && armed && area.pressed && area.containsMouse
|
||||||
|
readonly property bool pressed: area.pressed
|
||||||
|
readonly property bool filled: fill.active
|
||||||
signal clicked
|
signal clicked
|
||||||
|
signal held
|
||||||
|
signal holdCancelled
|
||||||
implicitWidth: size
|
implicitWidth: size
|
||||||
implicitHeight: size
|
implicitHeight: size
|
||||||
radius: size / 2
|
radius: size / 2
|
||||||
@@ -42,13 +53,25 @@ Rectangle {
|
|||||||
font.pixelSize: Math.round(root.size * root.glyphScale)
|
font.pixelSize: Math.round(root.size * root.glyphScale)
|
||||||
color: root.accented ? Theme.accentText : root.active ? Theme.accentVivid : Theme.text
|
color: root.accented ? Theme.accentText : root.active ? Theme.accentVivid : Theme.text
|
||||||
}
|
}
|
||||||
|
HoldFill {
|
||||||
|
id: fill
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: root.hold
|
||||||
|
holding: root.holding
|
||||||
|
glyph: root.glyph
|
||||||
|
fallback: root.fallback
|
||||||
|
glyphSize: Math.round(root.size * root.glyphScale)
|
||||||
|
onCompleted: root.held()
|
||||||
|
onCancelled: root.holdCancelled()
|
||||||
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: area
|
id: area
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
enabled: root.interactive
|
enabled: root.interactive
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.clicked()
|
onClicked: if (!root.hold)
|
||||||
|
root.clicked()
|
||||||
}
|
}
|
||||||
Accessible.role: Accessible.Button
|
Accessible.role: Accessible.Button
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,12 @@ import QtQuick.Layouts
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import ".."
|
import ".."
|
||||||
import "../../components"
|
|
||||||
import "../../core"
|
import "../../core"
|
||||||
import "../../services"
|
import "../../services"
|
||||||
import "../../theme"
|
import "../../theme"
|
||||||
|
|
||||||
// Lock, restart and shut down. Restart and shut down ask for confirmation.
|
// Lock, restart and shut down. Restart and shut down are held to confirm:
|
||||||
|
// accent liquid fills the button, then the action runs.
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property bool current: false
|
property bool current: false
|
||||||
@@ -106,7 +106,14 @@ Item {
|
|||||||
id: action
|
id: action
|
||||||
required property var modelData
|
required property var modelData
|
||||||
readonly property bool armed: PowerService.pending === modelData.id
|
readonly property bool armed: PowerService.pending === modelData.id
|
||||||
|
// A tap on a hold button says to hold it, in place of the label.
|
||||||
|
property bool hint: false
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
Timer {
|
||||||
|
id: hintTimer
|
||||||
|
interval: 1600
|
||||||
|
onTriggered: action.hint = false
|
||||||
|
}
|
||||||
DashButton {
|
DashButton {
|
||||||
objectName: "dashPower-" + action.modelData.id
|
objectName: "dashPower-" + action.modelData.id
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
@@ -114,53 +121,32 @@ Item {
|
|||||||
glyphScale: 0.36
|
glyphScale: 0.36
|
||||||
glyph: action.modelData.glyph
|
glyph: action.modelData.glyph
|
||||||
fallback: action.modelData.fallback
|
fallback: action.modelData.fallback
|
||||||
active: action.armed
|
hold: PowerService.needsHold(action.modelData.id)
|
||||||
danger: action.modelData.id !== "lock"
|
armed: action.armed
|
||||||
interactive: root.available(action.modelData.id)
|
interactive: root.available(action.modelData.id)
|
||||||
onClicked: root.run(action.modelData.id)
|
onClicked: root.run(action.modelData.id)
|
||||||
Accessible.name: action.modelData.label
|
onPressedChanged: if (hold) {
|
||||||
|
if (pressed)
|
||||||
|
PowerService.request(action.modelData.id);
|
||||||
|
else if (action.armed)
|
||||||
|
PowerService.cancel();
|
||||||
|
}
|
||||||
|
onHeld: PowerService.confirm()
|
||||||
|
onHoldCancelled: {
|
||||||
|
action.hint = true;
|
||||||
|
hintTimer.restart();
|
||||||
|
}
|
||||||
|
Accessible.name: hold ? "Hold to " + action.modelData.label.toLowerCase() : action.modelData.label
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: action.modelData.label
|
text: action.hint ? "Hold to " + action.modelData.label.toLowerCase() : action.modelData.label
|
||||||
color: action.armed ? Theme.text : Theme.textSecondary
|
color: action.armed ? Theme.text : Theme.textSecondary
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout {
|
|
||||||
id: confirm
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 8
|
|
||||||
readonly property var pending: root.actions.find(a => a.id === PowerService.pending)
|
|
||||||
opacity: pending ? 1 : 0
|
|
||||||
visible: opacity > 0
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.duration
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
text: confirm.pending ? confirm.pending.label + " now? Unsaved work may be lost." : ""
|
|
||||||
color: Theme.text
|
|
||||||
font.pixelSize: 12
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
GlassButton {
|
|
||||||
objectName: "dashPowerCancel"
|
|
||||||
text: "Cancel"
|
|
||||||
onClicked: PowerService.cancel()
|
|
||||||
}
|
|
||||||
GlassButton {
|
|
||||||
objectName: "dashPowerConfirm"
|
|
||||||
text: confirm.pending ? confirm.pending.label : "Confirm"
|
|
||||||
accented: true
|
|
||||||
enabled: !SystemService.acting
|
|
||||||
onClicked: PowerService.confirm()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,6 +138,7 @@ PanelWindow {
|
|||||||
drawerId: root.isRoot ? "tray" : ""
|
drawerId: root.isRoot ? "tray" : ""
|
||||||
screenName: root.screen ? root.screen.name : ""
|
screenName: root.screen ? root.screen.name : ""
|
||||||
screenX: root.animX
|
screenX: root.animX
|
||||||
|
sourceScreenX: root.isRoot ? root.placementCenter : -1
|
||||||
onHoveredChanged: if (root.isRoot) TrayService.setHovered(root, hovered)
|
onHoveredChanged: if (root.isRoot) TrayService.setHovered(root, hovered)
|
||||||
}
|
}
|
||||||
// Shared menu body, placed in whichever surface this menu uses.
|
// Shared menu body, placed in whichever surface this menu uses.
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ Column {
|
|||||||
font.pixelSize: root.frameHeight * 0.38
|
font.pixelSize: root.frameHeight * 0.38
|
||||||
font.weight: Font.DemiBold
|
font.weight: Font.DemiBold
|
||||||
}
|
}
|
||||||
|
// Below the tiles, so their close buttons take clicks first.
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.chosen()
|
||||||
|
}
|
||||||
// Keyed by address so title changes keep each live capture.
|
// Keyed by address so title changes keep each live capture.
|
||||||
Repeater {
|
Repeater {
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
@@ -155,12 +161,55 @@ Column {
|
|||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: tileHover
|
id: tileHover
|
||||||
}
|
}
|
||||||
|
// Middle-click closes, as in the bar's window list.
|
||||||
|
TapHandler {
|
||||||
|
acceptedButtons: Qt.MiddleButton
|
||||||
|
onTapped: HyprlandService.closeWindow(tile.win.address)
|
||||||
|
}
|
||||||
|
// Close without visiting the workspace; shown on hover.
|
||||||
|
Rectangle {
|
||||||
|
objectName: "workspacePreviewClose"
|
||||||
|
readonly property real size: Math.min(20, Math.min(tile.width, tile.height) - 8)
|
||||||
|
visible: size >= 12
|
||||||
|
opacity: tileHover.hovered ? 1 : 0
|
||||||
|
enabled: tileHover.hovered
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: 4
|
||||||
|
width: size
|
||||||
|
height: size
|
||||||
|
radius: size / 2
|
||||||
|
color: closeHover.hovered ? Qt.alpha("#ff5f57", 0.85) : Qt.alpha(Theme.surface, 0.85)
|
||||||
|
border.width: 1
|
||||||
|
border.color: Theme.hairline
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.duration / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.duration / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: Icons.available ? "" : "×"
|
||||||
|
font.family: Icons.available ? Icons.family : ""
|
||||||
|
font.pixelSize: Math.round(parent.size * 0.6)
|
||||||
|
color: Theme.text
|
||||||
|
}
|
||||||
|
HoverHandler {
|
||||||
|
id: closeHover
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
|
TapHandler {
|
||||||
|
onTapped: HyprlandService.closeWindow(tile.win.address)
|
||||||
|
}
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: "Close " + (tile.win.title || tile.win.appId || "window")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: root.chosen()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,10 +86,10 @@ function validate(c) {
|
|||||||
const dashTabs=new Set();
|
const dashTabs=new Set();
|
||||||
for(const t of dash.tabs) { if(!t || typeof t.id!=="string" || dashTabs.has(t.id) || typeof t.enabled!=="boolean")throw Error("Invalid dashboard tab"); dashTabs.add(t.id); }
|
for(const t of dash.tabs) { if(!t || typeof t.id!=="string" || dashTabs.has(t.id) || typeof t.enabled!=="boolean")throw Error("Invalid dashboard tab"); dashTabs.add(t.id); }
|
||||||
if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences");
|
if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences");
|
||||||
for(const key of ["left","right","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules");
|
for(const key of ["left","right","innerLeft","innerRight","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules");
|
||||||
if(!Array.isArray(c.notch.controls) || c.notch.controls.some(m=>!m || typeof m.id!=="string" || typeof m.enabled!=="boolean" || ["w","h"].some(k=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<1 || m[k]>4)) || [["x",3],["y",63]].some(([k,max])=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<0 || m[k]>max))))throw Error("Invalid notch controls");
|
if(!Array.isArray(c.notch.controls) || c.notch.controls.some(m=>!m || typeof m.id!=="string" || typeof m.enabled!=="boolean" || ["w","h"].some(k=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<1 || m[k]>4)) || [["x",3],["y",63]].some(([k,max])=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<0 || m[k]>max))))throw Error("Invalid notch controls");
|
||||||
if(!Number.isFinite(c.notch.opacity) || c.notch.opacity<0 || c.notch.opacity>100 || typeof c.notch.color!=="string" || (c.notch.color!=="" && !/^#[0-9a-fA-F]{6}$/.test(c.notch.color)))throw Error("Invalid notch colour");
|
if(!Number.isFinite(c.notch.opacity) || c.notch.opacity<0 || c.notch.opacity>100 || typeof c.notch.color!=="string" || (c.notch.color!=="" && !/^#[0-9a-fA-F]{6}$/.test(c.notch.color)))throw Error("Invalid notch colour");
|
||||||
if(typeof c.notch.glassOnOpen!=="boolean" || typeof c.notch.launcherMatch!=="boolean" || ["openSpeed","closeSpeed","colorSpeed"].some(k=>!Number.isFinite(c.notch[k]) || c.notch[k]<25 || c.notch[k]>300))throw Error("Invalid notch animation");
|
if(typeof c.notch.glassOnOpen!=="boolean" || typeof c.notch.launcherMatch!=="boolean" || ["openSpeed","closeSpeed","colorSpeed","panelOpenSpeed","panelCloseSpeed"].some(k=>!Number.isFinite(c.notch[k]) || c.notch[k]<25 || c.notch[k]>300))throw Error("Invalid notch animation");
|
||||||
if(!["bar","numbers","roman","kanji","dots","pacman"].includes(c.notch.workspaceStyle))throw Error("Invalid notch workspace style");
|
if(!["bar","numbers","roman","kanji","dots","pacman"].includes(c.notch.workspaceStyle))throw Error("Invalid notch workspace style");
|
||||||
if(!["float","pill","notch"].includes(c.notch.islandStyle))throw Error("Invalid notch island style");
|
if(!["float","pill","notch"].includes(c.notch.islandStyle))throw Error("Invalid notch island style");
|
||||||
if(typeof c.osd.enabled!=="boolean" || !["slide","drop","fade","shrink"].includes(c.osd.animation) || !["top-right","top-center","bottom-center"].includes(c.osd.position) || !Number.isInteger(c.osd.timeout) || c.osd.timeout<500 || c.osd.timeout>5000 || !Number.isInteger(c.osd.step) || c.osd.step<1 || c.osd.step>20)throw Error("Invalid OSD preferences");
|
if(typeof c.osd.enabled!=="boolean" || !["slide","drop","fade","shrink"].includes(c.osd.animation) || !["top-right","top-center","bottom-center"].includes(c.osd.position) || !Number.isInteger(c.osd.timeout) || c.osd.timeout<500 || c.osd.timeout>5000 || !Number.isInteger(c.osd.step) || c.osd.step<1 || c.osd.step>20)throw Error("Invalid OSD preferences");
|
||||||
|
|||||||
@@ -125,8 +125,12 @@ Singleton {
|
|||||||
if (!p || !isEnabled(id))
|
if (!p || !isEnabled(id))
|
||||||
return false;
|
return false;
|
||||||
const moduleId = "plugin:" + id;
|
const moduleId = "plugin:" + id;
|
||||||
if (ConfigService.data.bar.modules.some(m => m.id === moduleId))
|
const existing = ConfigService.data.bar.modules.find(m => m.id === moduleId);
|
||||||
return false;
|
// A switched-off entry may hold options set on the Plugins page: turn it on.
|
||||||
|
if (existing)
|
||||||
|
return existing.enabled === false
|
||||||
|
? ConfigService.setValue("bar.modules", ConfigService.data.bar.modules.map(m => m.id === moduleId ? Object.assign({}, m, {enabled: true}) : m))
|
||||||
|
: false;
|
||||||
const section = (p.manifest.barWidget || {}).defaultSection;
|
const section = (p.manifest.barWidget || {}).defaultSection;
|
||||||
return ConfigService.setValue("bar.modules", ConfigService.data.bar.modules.concat([
|
return ConfigService.setValue("bar.modules", ConfigService.data.bar.modules.concat([
|
||||||
{
|
{
|
||||||
@@ -452,6 +456,12 @@ Singleton {
|
|||||||
function toggle(id: string, payload: string): bool {
|
function toggle(id: string, payload: string): bool {
|
||||||
return root.toggle(id, payload);
|
return root.toggle(id, payload);
|
||||||
}
|
}
|
||||||
|
// Settings → Plugins with this plugin's settings open.
|
||||||
|
function settings(id: string): void {
|
||||||
|
root.focusedSettings = "";
|
||||||
|
root.focusedSettings = id;
|
||||||
|
ShellState.openSettings("plugins");
|
||||||
|
}
|
||||||
// Marketplace search, as in the Browse tab.
|
// Marketplace search, as in the Browse tab.
|
||||||
function browse(query: string): void {
|
function browse(query: string): void {
|
||||||
root.marketQuery = query;
|
root.marketQuery = query;
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import "../core"
|
|||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
// The action being held to confirm. Its button fills while this is set and
|
||||||
|
// confirm() runs it once full; cancel() (release, Escape, closing) drains.
|
||||||
property string pending: ""
|
property string pending: ""
|
||||||
|
function needsHold(action) {
|
||||||
|
return ["logout", "reboot", "shutdown"].includes(action);
|
||||||
|
}
|
||||||
function request(action) {
|
function request(action) {
|
||||||
// The built-in lock screen needs no external locker.
|
// The built-in lock screen needs no external locker.
|
||||||
if (action === "lock" && ConfigService.ready && ConfigService.data.lock.enabled) {
|
if (action === "lock" && ConfigService.ready && ConfigService.data.lock.enabled) {
|
||||||
@@ -14,7 +19,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
if (!SystemService.state.power || !SystemService.state.power[action] || SystemService.acting)
|
if (!SystemService.state.power || !SystemService.state.power[action] || SystemService.acting)
|
||||||
return false;
|
return false;
|
||||||
if (["logout", "reboot", "shutdown"].includes(action)) {
|
if (needsHold(action)) {
|
||||||
pending = action;
|
pending = action;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,14 @@ Singleton {
|
|||||||
// them for every background status poll flickered them every five seconds.
|
// them for every background status poll flickered them every five seconds.
|
||||||
readonly property bool acting: (job.running && job.request.op === "action") || queued !== null
|
readonly property bool acting: (job.running && job.request.op === "action") || queued !== null
|
||||||
property var queued: null
|
property var queued: null
|
||||||
|
// Bar modules showing Night Light; while only they watch, it polls slowly.
|
||||||
|
property int nightLightWatchers: 0
|
||||||
readonly property var features: {
|
readonly property var features: {
|
||||||
|
const own = panelFeatures;
|
||||||
|
return nightLightWatchers > 0 && !own.includes("nightLight") ? own.concat(["nightLight"]) : own;
|
||||||
|
}
|
||||||
|
readonly property bool panelObserved: panelFeatures.length > 0
|
||||||
|
readonly property var panelFeatures: {
|
||||||
if (!ConfigService.ready)
|
if (!ConfigService.ready)
|
||||||
return [];
|
return [];
|
||||||
if (ShellState.controlCenterOpen || ShellState.notchOpen)
|
if (ShellState.controlCenterOpen || ShellState.notchOpen)
|
||||||
@@ -79,7 +86,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
interval: 5000
|
interval: root.panelObserved ? 5000 : 30000
|
||||||
repeat: true
|
repeat: true
|
||||||
running: root.observed
|
running: root.observed
|
||||||
onTriggered: root.refresh()
|
onTriggered: root.refresh()
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ Item {
|
|||||||
id:card
|
id:card
|
||||||
required property var modelData
|
required property var modelData
|
||||||
readonly property var schema:root.fieldsFor(modelData.id)
|
readonly property var schema:root.fieldsFor(modelData.id)
|
||||||
readonly property var link:ModuleRegistry.settingsLinks[modelData.id] || null
|
readonly property var link:ModuleRegistry.moreSettings[modelData.id] || null
|
||||||
readonly property bool expanded:root.expandedId===modelData.id && schema.length>0
|
readonly property bool expanded:root.expandedId===modelData.id && schema.length>0
|
||||||
Layout.fillWidth:true
|
Layout.fillWidth:true
|
||||||
implicitHeight:52+(expanded ? optionsColumn.implicitHeight+4 : 0)
|
implicitHeight:52+(expanded ? optionsColumn.implicitHeight+4 : 0)
|
||||||
@@ -153,10 +153,10 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text {text:ModuleRegistry.title(card.modelData.id);color:Theme.text;Layout.fillWidth:true;elide:Text.ElideRight;font.pixelSize:12}
|
Text {text:ModuleRegistry.title(card.modelData.id);color:Theme.text;Layout.fillWidth:true;elide:Text.ElideRight;font.pixelSize:12}
|
||||||
// Cog: module options inline, or the page that holds them.
|
// Cog: the module's options, always inline.
|
||||||
Rectangle {
|
Rectangle {
|
||||||
objectName:"bar-options-"+card.modelData.id
|
objectName:"bar-options-"+card.modelData.id
|
||||||
visible:card.schema.length>0 || !!card.link
|
visible:card.schema.length>0
|
||||||
implicitWidth:26;implicitHeight:26;radius:13
|
implicitWidth:26;implicitHeight:26;radius:13
|
||||||
color:card.expanded ? Qt.alpha(Theme.accent,0.3) : cogArea.containsMouse ? Theme.hover : Qt.alpha(Theme.text,0.06)
|
color:card.expanded ? Qt.alpha(Theme.accent,0.3) : cogArea.containsMouse ? Theme.hover : Qt.alpha(Theme.text,0.06)
|
||||||
Accessible.name:"Options for "+card.modelData.id
|
Accessible.name:"Options for "+card.modelData.id
|
||||||
@@ -167,10 +167,7 @@ Item {
|
|||||||
anchors.fill:parent
|
anchors.fill:parent
|
||||||
hoverEnabled:true
|
hoverEnabled:true
|
||||||
cursorShape:Qt.PointingHandCursor
|
cursorShape:Qt.PointingHandCursor
|
||||||
onClicked:{
|
onClicked:root.expandedId=card.expanded ? "" : card.modelData.id
|
||||||
if(card.schema.length>0)root.expandedId=card.expanded ? "" : card.modelData.id;
|
|
||||||
else if(card.link)ShellState.revealSetting(card.link.page,card.link.setting);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GlassToggle {objectName:"bar-enable-"+card.modelData.id;checked:card.modelData.enabled;onToggled:root.save(Logic.editModule(root.modules,card.modelData.id,"enabled",checked))}
|
GlassToggle {objectName:"bar-enable-"+card.modelData.id;checked:card.modelData.enabled;onToggled:root.save(Logic.editModule(root.modules,card.modelData.id,"enabled",checked))}
|
||||||
@@ -197,63 +194,88 @@ Item {
|
|||||||
id:optionsColumn
|
id:optionsColumn
|
||||||
visible:card.expanded
|
visible:card.expanded
|
||||||
anchors {left:parent.left;right:parent.right;top:parent.top;topMargin:50;leftMargin:12;rightMargin:10}
|
anchors {left:parent.left;right:parent.right;top:parent.top;topMargin:50;leftMargin:12;rightMargin:10}
|
||||||
spacing:6
|
spacing:10
|
||||||
Repeater {
|
Repeater {
|
||||||
model:card.schema
|
model:card.schema
|
||||||
RowLayout {
|
// Label line (with a toggle or a slider's value), then the control at
|
||||||
|
// the card's full width: lanes are narrow, so nothing sits beside a field.
|
||||||
|
ColumnLayout {
|
||||||
id:optionRow
|
id:optionRow
|
||||||
required property var modelData
|
required property var modelData
|
||||||
readonly property var value:root.valueOf(card.modelData,modelData)
|
readonly property var value:root.valueOf(card.modelData,modelData)
|
||||||
|
readonly property string kind:modelData.type
|
||||||
|
readonly property bool numeric:kind==="integer" || kind==="number"
|
||||||
Layout.fillWidth:true
|
Layout.fillWidth:true
|
||||||
spacing:8
|
spacing:3
|
||||||
Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;elide:Text.ElideRight
|
RowLayout {
|
||||||
HoverHandler {id:labelHover}
|
Layout.fillWidth:true
|
||||||
GlassToolTip {
|
spacing:8
|
||||||
visible: labelHover.hovered && !!optionRow.modelData.description
|
Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;wrapMode:Text.Wrap
|
||||||
delay: 600
|
HoverHandler {id:labelHover}
|
||||||
text: optionRow.modelData.description || ""
|
GlassToolTip {
|
||||||
}}
|
visible: labelHover.hovered && !!optionRow.modelData.description
|
||||||
|
delay: 600
|
||||||
|
text: optionRow.modelData.description || ""
|
||||||
|
}}
|
||||||
|
GlassToggle {
|
||||||
|
visible:optionRow.kind==="boolean"
|
||||||
|
checked:optionRow.value===true
|
||||||
|
onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked)
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
visible:optionRow.numeric
|
||||||
|
text:optionRow.value===undefined ? "" : String(optionRow.value)+(optionRow.modelData.unit ? " "+optionRow.modelData.unit : "")
|
||||||
|
color:Theme.text;font.pixelSize:11
|
||||||
|
horizontalAlignment:Text.AlignRight
|
||||||
|
}
|
||||||
|
}
|
||||||
GlassComboBox {
|
GlassComboBox {
|
||||||
objectName:"bar-option-"+card.modelData.id+"-"+optionRow.modelData.key
|
objectName:"bar-option-"+card.modelData.id+"-"+optionRow.modelData.key
|
||||||
visible:optionRow.modelData.type==="choice"
|
visible:optionRow.kind==="choice"
|
||||||
Layout.preferredWidth:110
|
Layout.fillWidth:true
|
||||||
implicitHeight:30
|
implicitHeight:30
|
||||||
model:optionRow.modelData.choices.map(c=>({text:String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c}))
|
model:(optionRow.modelData.choices || []).map((c,i)=>({text:optionRow.modelData.choiceLabels ? optionRow.modelData.choiceLabels[i] : String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c}))
|
||||||
textRole:"text"
|
textRole:"text"
|
||||||
valueRole:"value"
|
valueRole:"value"
|
||||||
currentIndex:optionRow.modelData.choices.indexOf(optionRow.value)
|
currentIndex:(optionRow.modelData.choices || []).indexOf(optionRow.value)
|
||||||
onActivated:root.setOption(card.modelData,optionRow.modelData.key,currentValue)
|
onActivated:root.setOption(card.modelData,optionRow.modelData.key,currentValue)
|
||||||
}
|
}
|
||||||
GlassToggle {
|
|
||||||
visible:optionRow.modelData.type==="boolean"
|
|
||||||
checked:optionRow.value===true
|
|
||||||
onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked)
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number"
|
|
||||||
text:optionRow.value===undefined ? "" : String(optionRow.value)
|
|
||||||
color:Theme.text;font.pixelSize:11
|
|
||||||
Layout.preferredWidth:26;horizontalAlignment:Text.AlignRight
|
|
||||||
}
|
|
||||||
GlassSlider {
|
GlassSlider {
|
||||||
visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number"
|
visible:optionRow.numeric
|
||||||
Layout.preferredWidth:90
|
Layout.fillWidth:true
|
||||||
implicitHeight:26
|
implicitHeight:26
|
||||||
from:Number(optionRow.modelData.min !== undefined ? optionRow.modelData.min : 0)
|
from:Number(optionRow.modelData.min !== undefined ? optionRow.modelData.min : 0)
|
||||||
to:Number(optionRow.modelData.max !== undefined ? optionRow.modelData.max : 100)
|
to:Number(optionRow.modelData.max !== undefined ? optionRow.modelData.max : 100)
|
||||||
stepSize:Number(optionRow.modelData.step || (optionRow.modelData.type==="integer" ? 1 : 0.1))
|
stepSize:Number(optionRow.modelData.step || (optionRow.kind==="integer" ? 1 : 0.1))
|
||||||
value:Number(optionRow.value || 0)
|
value:Number(optionRow.value || 0)
|
||||||
onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.modelData.type==="integer" ? Math.round(value) : value)
|
onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.kind==="integer" ? Math.round(value) : value)
|
||||||
}
|
}
|
||||||
GlassTextField {
|
GlassTextField {
|
||||||
visible:optionRow.modelData.type==="string"
|
visible:optionRow.kind==="string"
|
||||||
Layout.preferredWidth:110
|
Layout.fillWidth:true
|
||||||
implicitHeight:30
|
implicitHeight:30
|
||||||
text:optionRow.value===undefined ? "" : String(optionRow.value)
|
text:optionRow.value===undefined ? "" : String(optionRow.value)
|
||||||
onEditingFinished:root.setOption(card.modelData,optionRow.modelData.key,text)
|
onEditingFinished:root.setOption(card.modelData,optionRow.modelData.key,text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// The rest of the module's settings, on their page.
|
||||||
|
Text {
|
||||||
|
objectName:"bar-more-"+card.modelData.id
|
||||||
|
visible:!!card.link
|
||||||
|
text:card.link ? "All "+card.link.title+" settings →" : ""
|
||||||
|
color:moreArea.containsMouse ? Theme.text : Theme.accent
|
||||||
|
font.pixelSize:11
|
||||||
|
Layout.topMargin:2
|
||||||
|
Layout.bottomMargin:4
|
||||||
|
MouseArea {
|
||||||
|
id:moreArea
|
||||||
|
anchors.fill:parent
|
||||||
|
hoverEnabled:true
|
||||||
|
cursorShape:Qt.PointingHandCursor
|
||||||
|
onClicked:ShellState.revealSetting(card.link.page,"")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import "../../components"
|
||||||
|
import "../../services"
|
||||||
|
import "../../theme"
|
||||||
|
|
||||||
|
// Settings form for an Omarchy plugin, built from its manifest schema
|
||||||
|
// (boolean / integer / number / string / choices). Values are the widget's
|
||||||
|
// options on its bar.modules entry, the same ones the bar cog edits, so the
|
||||||
|
// bar and the notch both use them. Changes apply as they are made.
|
||||||
|
ColumnLayout {
|
||||||
|
id: root
|
||||||
|
required property string pluginId
|
||||||
|
readonly property string moduleId: "plugin:" + pluginId
|
||||||
|
readonly property var entry: ConfigService.ready ? (ConfigService.data.bar.modules.find(m => m.id === moduleId) || null) : null
|
||||||
|
readonly property var values: PluginService.widgetSettings(pluginId, entry ? entry.options : {})
|
||||||
|
readonly property var fields: PluginService.schema(pluginId).filter(f => f && f.key).map(f => {
|
||||||
|
const choices = Array.isArray(f.choices) ? f.choices : Array.isArray(f.options) ? f.options.map(o => typeof o === "object" ? o.value : o) : null;
|
||||||
|
return Object.assign({}, f, {
|
||||||
|
label: f.label || f.key,
|
||||||
|
type: choices ? "choice" : (f.type || "string"),
|
||||||
|
choices: choices || []
|
||||||
|
});
|
||||||
|
})
|
||||||
|
spacing: 14
|
||||||
|
|
||||||
|
function set(key, value) {
|
||||||
|
const modules = ConfigService.data.bar.modules;
|
||||||
|
if (modules.some(m => m.id === moduleId))
|
||||||
|
return ConfigService.setValue("bar.modules", modules.map(m => m.id === moduleId ? Object.assign({}, m, {
|
||||||
|
options: Object.assign({}, m.options || {}, {[key]: value})
|
||||||
|
}) : m));
|
||||||
|
// Not in the bar: keep the options on a switched-off entry (the notch reads it too).
|
||||||
|
const section = ((PluginService.plugin(pluginId) || {}).manifest || {}).barWidget || {};
|
||||||
|
return ConfigService.setValue("bar.modules", modules.concat([
|
||||||
|
{
|
||||||
|
id: moduleId,
|
||||||
|
position: ["left", "center", "right"].includes(section.defaultSection) ? section.defaultSection : "right",
|
||||||
|
enabled: false,
|
||||||
|
options: {[key]: value}
|
||||||
|
}
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: root.fields
|
||||||
|
RowLayout {
|
||||||
|
id: field
|
||||||
|
required property var modelData
|
||||||
|
required property int index
|
||||||
|
readonly property var value: root.values[modelData.key]
|
||||||
|
readonly property bool numeric: modelData.type === "integer" || modelData.type === "number"
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 16
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 3
|
||||||
|
Text {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: field.modelData.label
|
||||||
|
color: Theme.text
|
||||||
|
font.pixelSize: 13
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: !!field.modelData.description
|
||||||
|
text: field.modelData.description || ""
|
||||||
|
color: Theme.textSecondary
|
||||||
|
font.pixelSize: 11
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Every control sits in the same right-hand column.
|
||||||
|
Item {
|
||||||
|
Layout.preferredWidth: 300
|
||||||
|
Layout.preferredHeight: 34
|
||||||
|
GlassComboBox {
|
||||||
|
objectName: "plugin-option-" + root.pluginId + "-" + field.modelData.key
|
||||||
|
visible: field.modelData.type === "choice"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 190
|
||||||
|
height: 32
|
||||||
|
model: (field.modelData.choices || []).map((c, i) => ({
|
||||||
|
text: field.modelData.choiceLabels ? field.modelData.choiceLabels[i] : String(c).charAt(0).toUpperCase() + String(c).slice(1),
|
||||||
|
value: c
|
||||||
|
}))
|
||||||
|
textRole: "text"
|
||||||
|
valueRole: "value"
|
||||||
|
currentIndex: (field.modelData.choices || []).indexOf(field.value)
|
||||||
|
onActivated: root.set(field.modelData.key, currentValue)
|
||||||
|
}
|
||||||
|
GlassToggle {
|
||||||
|
objectName: "plugin-option-" + root.pluginId + "-" + field.modelData.key
|
||||||
|
visible: field.modelData.type === "boolean"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
checked: field.value === true
|
||||||
|
onToggled: root.set(field.modelData.key, checked)
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
visible: field.numeric
|
||||||
|
anchors.right: slider.left
|
||||||
|
anchors.rightMargin: 12
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: field.value === undefined ? "" : String(field.value) + (field.modelData.unit ? " " + field.modelData.unit : "")
|
||||||
|
color: Theme.text
|
||||||
|
font.pixelSize: 12
|
||||||
|
}
|
||||||
|
GlassSlider {
|
||||||
|
id: slider
|
||||||
|
objectName: "plugin-option-" + root.pluginId + "-" + field.modelData.key
|
||||||
|
visible: field.numeric
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 220
|
||||||
|
height: 26
|
||||||
|
from: Number(field.modelData.min !== undefined ? field.modelData.min : 0)
|
||||||
|
to: Number(field.modelData.max !== undefined ? field.modelData.max : 100)
|
||||||
|
stepSize: Number(field.modelData.step || (field.modelData.type === "integer" ? 1 : 0.1))
|
||||||
|
value: Number(field.value || 0)
|
||||||
|
onMoved: root.set(field.modelData.key, field.modelData.type === "integer" ? Math.round(value) : value)
|
||||||
|
}
|
||||||
|
GlassTextField {
|
||||||
|
objectName: "plugin-option-" + root.pluginId + "-" + field.modelData.key
|
||||||
|
visible: field.modelData.type === "string"
|
||||||
|
anchors.fill: parent
|
||||||
|
topPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
font.pixelSize: 13
|
||||||
|
text: field.value === undefined ? "" : String(field.value)
|
||||||
|
placeholderText: field.modelData.placeholder || ""
|
||||||
|
onEditingFinished: if (text !== String(field.value === undefined ? "" : field.value))
|
||||||
|
root.set(field.modelData.key, text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,15 +10,26 @@ import "../../theme"
|
|||||||
SettingsPage {
|
SettingsPage {
|
||||||
id: root
|
id: root
|
||||||
readonly property var options: ConfigService.data.notch
|
readonly property var options: ConfigService.data.notch
|
||||||
|
// The four spots in the bar row; a module sits in one of them at a time.
|
||||||
|
readonly property var sideKeys: ["left", "innerLeft", "innerRight", "right"]
|
||||||
// Adds or removes a bar module from one of the notch's module lists.
|
// Adds or removes a bar module from one of the notch's module lists.
|
||||||
|
// Adding it to a side spot moves it there from the other side spots.
|
||||||
function toggleModule(key, id) {
|
function toggleModule(key, id) {
|
||||||
const list = (options[key] || []).slice();
|
const list = (options[key] || []).slice();
|
||||||
const at = list.indexOf(id);
|
const at = list.indexOf(id);
|
||||||
if (at >= 0)
|
if (at >= 0) {
|
||||||
list.splice(at, 1);
|
list.splice(at, 1);
|
||||||
else
|
return ConfigService.setValue("notch." + key, list);
|
||||||
list.push(id);
|
}
|
||||||
ConfigService.setValue("notch." + key, list);
|
list.push(id);
|
||||||
|
const next = Object.assign({}, options, {
|
||||||
|
[key]: list
|
||||||
|
});
|
||||||
|
if (sideKeys.includes(key))
|
||||||
|
for (const other of sideKeys)
|
||||||
|
if (other !== key)
|
||||||
|
next[other] = (options[other] || []).filter(m => m !== id);
|
||||||
|
ConfigService.setValue("notch", next);
|
||||||
}
|
}
|
||||||
// Chips for every bar module; filled ones are shown there, in click order.
|
// Chips for every bar module; filled ones are shown there, in click order.
|
||||||
component ModulePicker: SettingRow {
|
component ModulePicker: SettingRow {
|
||||||
@@ -104,6 +115,18 @@ SettingsPage {
|
|||||||
icon: ""
|
icon: ""
|
||||||
key: "right"
|
key: "right"
|
||||||
}
|
}
|
||||||
|
ModulePicker {
|
||||||
|
title: "Left of the notch"
|
||||||
|
description: "Right beside the notch, always without a pill"
|
||||||
|
icon: ""
|
||||||
|
key: "innerLeft"
|
||||||
|
}
|
||||||
|
ModulePicker {
|
||||||
|
title: "Right of the notch"
|
||||||
|
description: "Right beside the notch, always without a pill"
|
||||||
|
icon: ""
|
||||||
|
key: "innerRight"
|
||||||
|
}
|
||||||
PreferenceChoice {
|
PreferenceChoice {
|
||||||
label: "Workspace style"
|
label: "Workspace style"
|
||||||
description: "\"bar\" uses the style from Settings → Bar"
|
description: "\"bar\" uses the style from Settings → Bar"
|
||||||
@@ -216,5 +239,24 @@ SettingsPage {
|
|||||||
step: 5
|
step: 5
|
||||||
unit: "%"
|
unit: "%"
|
||||||
}
|
}
|
||||||
|
PreferenceSlider {
|
||||||
|
label: "Panel opening speed"
|
||||||
|
description: "Quick Fix, tray menus and other panels that drop out of an island"
|
||||||
|
icon: ""
|
||||||
|
setting: "notch.panelOpenSpeed"
|
||||||
|
from: 25
|
||||||
|
to: 300
|
||||||
|
step: 5
|
||||||
|
unit: "%"
|
||||||
|
}
|
||||||
|
PreferenceSlider {
|
||||||
|
label: "Panel closing speed"
|
||||||
|
icon: ""
|
||||||
|
setting: "notch.panelCloseSpeed"
|
||||||
|
from: 25
|
||||||
|
to: 300
|
||||||
|
step: 5
|
||||||
|
unit: "%"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,23 @@ SettingsPage {
|
|||||||
onTabChanged: if (tab === "browse" && PluginService.market.items.length === 0)
|
onTabChanged: if (tab === "browse" && PluginService.market.items.length === 0)
|
||||||
PluginService.browse(false)
|
PluginService.browse(false)
|
||||||
Component.onCompleted: PluginService.refresh()
|
Component.onCompleted: PluginService.refresh()
|
||||||
|
// Scroll a plugin row to the top once the page has laid out.
|
||||||
|
function reveal(item) {
|
||||||
|
revealTimer.item = item;
|
||||||
|
revealTimer.restart();
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
id: revealTimer
|
||||||
|
property Item item: null
|
||||||
|
interval: 120
|
||||||
|
onTriggered: {
|
||||||
|
const flick = root.contentItem;
|
||||||
|
if (!item || !flick || flick.contentY === undefined)
|
||||||
|
return;
|
||||||
|
const y = item.mapToItem(flick.contentItem, 0, 0).y;
|
||||||
|
flick.contentY = Math.max(0, Math.min(y - 12, flick.contentHeight - flick.height));
|
||||||
|
}
|
||||||
|
}
|
||||||
readonly property var capabilityLabels: ({
|
readonly property var capabilityLabels: ({
|
||||||
"privilege": "Uses sudo",
|
"privilege": "Uses sudo",
|
||||||
"package-manager": "Installs packages",
|
"package-manager": "Installs packages",
|
||||||
@@ -111,7 +128,7 @@ SettingsPage {
|
|||||||
SettingsSection {
|
SettingsSection {
|
||||||
visible: root.tab === "installed"
|
visible: root.tab === "installed"
|
||||||
title: "Installed"
|
title: "Installed"
|
||||||
description: PluginService.plugins.length ? "Turn a plugin on to load it. Bar widgets then appear under Bar → Modules (and can go on a single screen); their options are on the module's cog." : ""
|
description: PluginService.plugins.length ? "Turn a plugin on to load it. Bar widgets then appear under Bar → Modules (and can go on a single screen); their options are under Settings here and on the module's cog." : ""
|
||||||
Text {
|
Text {
|
||||||
visible: PluginService.loaded && PluginService.plugins.length === 0
|
visible: PluginService.loaded && PluginService.plugins.length === 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -127,7 +144,9 @@ SettingsPage {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
readonly property var manifest: modelData.manifest || {}
|
readonly property var manifest: modelData.manifest || {}
|
||||||
readonly property bool enabledNow: PluginService.isEnabled(modelData.id)
|
readonly property bool enabledNow: PluginService.isEnabled(modelData.id)
|
||||||
readonly property bool inBar: ConfigService.data.bar.modules.some(m => m.id === "plugin:" + modelData.id)
|
readonly property bool inBar: ConfigService.data.bar.modules.some(m => m.id === "plugin:" + modelData.id && m.enabled !== false)
|
||||||
|
// Omarchy plugins: a form from their manifest schema (Noctalia ones bring Settings.qml).
|
||||||
|
readonly property bool schemaSettings: modelData.ecosystem !== "noctalia" && PluginService.schema(modelData.id).length > 0
|
||||||
objectName: "plugin-" + modelData.id
|
objectName: "plugin-" + modelData.id
|
||||||
title: manifest.name || modelData.id
|
title: manifest.name || modelData.id
|
||||||
description: [manifest.description || "", [manifest.version ? "v" + manifest.version : "", manifest.author || ""].filter(x => x).join(" · ")].filter(x => x).join("\n")
|
description: [manifest.description || "", [manifest.version ? "v" + manifest.version : "", manifest.author || ""].filter(x => x).join(" · ")].filter(x => x).join("\n")
|
||||||
@@ -140,7 +159,7 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
GlassButton {
|
GlassButton {
|
||||||
objectName: "plugin-settings-" + row.modelData.id
|
objectName: "plugin-settings-" + row.modelData.id
|
||||||
visible: row.enabledNow && (row.modelData.kinds || []).includes("settings")
|
visible: row.enabledNow && ((row.modelData.kinds || []).includes("settings") || row.schemaSettings)
|
||||||
text: root.openSettings === row.modelData.id ? "Close settings" : "Settings"
|
text: root.openSettings === row.modelData.id ? "Close settings" : "Settings"
|
||||||
accented: root.openSettings === row.modelData.id
|
accented: root.openSettings === row.modelData.id
|
||||||
onClicked: root.openSettings = root.openSettings === row.modelData.id ? "" : row.modelData.id
|
onClicked: root.openSettings = root.openSettings === row.modelData.id ? "" : row.modelData.id
|
||||||
@@ -233,11 +252,17 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The plugin's own settings screen (Noctalia Settings.qml), with
|
// The plugin's own settings screen (Noctalia Settings.qml), with
|
||||||
// its pluginApi; Save calls the plugin's saveSettings().
|
// its pluginApi; Save calls the plugin's saveSettings(). Omarchy
|
||||||
|
// plugins get a form from their schema that applies as you edit.
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: root.openSettings === row.modelData.id
|
visible: root.openSettings === row.modelData.id
|
||||||
implicitHeight: visible ? settingsColumn.implicitHeight + 24 : 0
|
implicitHeight: visible ? settingsColumn.implicitHeight + 24 : 0
|
||||||
|
// Bring the plugin and its settings into view once laid out.
|
||||||
|
onVisibleChanged: if (visible)
|
||||||
|
root.reveal(row)
|
||||||
|
Component.onCompleted: if (visible)
|
||||||
|
root.reveal(row)
|
||||||
radius: 12
|
radius: 12
|
||||||
color: Theme.fill
|
color: Theme.fill
|
||||||
border.width: 1
|
border.width: 1
|
||||||
@@ -249,10 +274,15 @@ SettingsPage {
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.margins: 12
|
anchors.margins: 12
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
PluginOptions {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: row.schemaSettings
|
||||||
|
pluginId: row.modelData.id
|
||||||
|
}
|
||||||
Loader {
|
Loader {
|
||||||
id: pluginSettings
|
id: pluginSettings
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
active: root.openSettings === row.modelData.id
|
active: !row.schemaSettings && root.openSettings === row.modelData.id
|
||||||
onActiveChanged: if (active)
|
onActiveChanged: if (active)
|
||||||
setSource(row.modelData.entryUrls.settings, {
|
setSource(row.modelData.entryUrls.settings, {
|
||||||
pluginApi: PluginService.noctaliaApi(row.modelData.id)
|
pluginApi: PluginService.noctaliaApi(row.modelData.id)
|
||||||
@@ -264,10 +294,18 @@ SettingsPage {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
GlassButton {
|
GlassButton {
|
||||||
|
visible: row.schemaSettings
|
||||||
|
text: "Done"
|
||||||
|
accented: true
|
||||||
|
onClicked: root.openSettings = ""
|
||||||
|
}
|
||||||
|
GlassButton {
|
||||||
|
visible: !row.schemaSettings
|
||||||
text: "Cancel"
|
text: "Cancel"
|
||||||
onClicked: root.openSettings = ""
|
onClicked: root.openSettings = ""
|
||||||
}
|
}
|
||||||
GlassButton {
|
GlassButton {
|
||||||
|
visible: !row.schemaSettings
|
||||||
objectName: "plugin-settings-save-" + row.modelData.id
|
objectName: "plugin-settings-save-" + row.modelData.id
|
||||||
text: "Save"
|
text: "Save"
|
||||||
accented: true
|
accented: true
|
||||||
|
|||||||
@@ -178,6 +178,17 @@ Item {
|
|||||||
input.mouseClick(item, item.width / 2, item.height / 2);
|
input.mouseClick(item, item.width / 2, item.height / 2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Presses an item and holds it for ms before releasing.
|
||||||
|
function hold(name: string, ms: int): bool {
|
||||||
|
const item = root.child(name);
|
||||||
|
if (!item || !item.enabled)
|
||||||
|
return false;
|
||||||
|
root.reveal(item);
|
||||||
|
input.mousePress(item, item.width / 2, item.height / 2);
|
||||||
|
input.wait(ms);
|
||||||
|
input.mouseRelease(item, item.width / 2, item.height / 2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
function slider(name: string): bool {
|
function slider(name: string): bool {
|
||||||
const item = root.child(name);
|
const item = root.child(name);
|
||||||
if (!item || !item.enabled)
|
if (!item || !item.enabled)
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ Singleton {
|
|||||||
readonly property real notchOpenDuration: duration * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.openSpeed) : 100)
|
readonly property real notchOpenDuration: duration * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.openSpeed) : 100)
|
||||||
readonly property real notchCloseDuration: duration * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.closeSpeed) : 100)
|
readonly property real notchCloseDuration: duration * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.closeSpeed) : 100)
|
||||||
// Docked colour to the open fill and back (only differs with "glassy when open").
|
// Docked colour to the open fill and back (only differs with "glassy when open").
|
||||||
|
// Notch-mode panels (Quick Fix, tray menus, plugin panels): the liquid drop.
|
||||||
|
readonly property real notchPanelOpenDuration: duration * 4.2 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.panelOpenSpeed) : 100)
|
||||||
|
readonly property real notchPanelCloseDuration: duration * 2.5 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.panelCloseSpeed) : 100)
|
||||||
readonly property real notchColorDuration: duration * 0.6 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.colorSpeed) : 100)
|
readonly property real notchColorDuration: duration * 0.6 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.colorSpeed) : 100)
|
||||||
// Motion inside the open notch (pages, tiles, the pill's width) uses the opening speed.
|
// Motion inside the open notch (pages, tiles, the pill's width) uses the opening speed.
|
||||||
readonly property real notchDuration: notchOpenDuration
|
readonly property real notchDuration: notchOpenDuration
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ PanelWindow {
|
|||||||
fillColor:root.notch ? Theme.notchOpenFill : Qt.alpha(Theme.surface,Theme.glassOpacity)
|
fillColor:root.notch ? Theme.notchOpenFill : Qt.alpha(Theme.surface,Theme.glassOpacity)
|
||||||
openDuration:root.notch ? Theme.notchOpenDuration*2 : Theme.duration*1.8
|
openDuration:root.notch ? Theme.notchOpenDuration*2 : Theme.duration*1.8
|
||||||
closeDuration:root.notch ? Theme.notchCloseDuration*1.3 : Theme.duration
|
closeDuration:root.notch ? Theme.notchCloseDuration*1.3 : Theme.duration
|
||||||
|
// The notch-shaped picker keeps the notch's own motion.
|
||||||
|
liquid:false
|
||||||
drawerId:"wallpaper"
|
drawerId:"wallpaper"
|
||||||
screenName:root.screen ? root.screen.name : ""
|
screenName:root.screen ? root.screen.name : ""
|
||||||
screenX:(root.screenWidth-width)/2
|
screenX:(root.screenWidth-width)/2
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
# nix shell nixpkgs#qt6.qtshadertools -c ./scripts/build-shaders
|
# nix shell nixpkgs#qt6.qtshadertools -c ./scripts/build-shaders
|
||||||
set -eu
|
set -eu
|
||||||
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||||
for source in "$project_dir"/quickshell/lock/shaders/*.frag "$project_dir"/quickshell/wallpaper/shaders/*.frag; do
|
for source in "$project_dir"/quickshell/lock/shaders/*.frag "$project_dir"/quickshell/wallpaper/shaders/*.frag "$project_dir"/quickshell/components/shaders/*.frag; do
|
||||||
qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o "$source.qsb" "$source"
|
qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o "$source.qsb" "$source"
|
||||||
done
|
done
|
||||||
@@ -80,13 +80,12 @@ with tempfile.TemporaryDirectory(prefix='glassmxrph-controls-') as tmp:
|
|||||||
wait(lambda:not state()['busy'] and not state()['error'] and not state()['state']['dnd']['enabled'],'provider recovery')
|
wait(lambda:not state()['busy'] and not state()['error'] and not state()['state']['dnd']['enabled'],'provider recovery')
|
||||||
assert ipc('controlTest','slider','brightnessSlider')
|
assert ipc('controlTest','slider','brightnessSlider')
|
||||||
wait(lambda:not state()['busy'] and state()['state']['brightness']['value']>60,'brightness readback')
|
wait(lambda:not state()['busy'] and state()['state']['brightness']['value']>60,'brightness readback')
|
||||||
assert ipc('controlTest','click','power-reboot');assert state()['power']=='reboot'
|
assert ipc('controlTest','click','power-reboot');assert state()['power']==''
|
||||||
|
assert ipc('controlTest','hold','power-shutdown',250);assert state()['power']==''
|
||||||
assert not any(json.loads(line)['action']=='power' for line in events.read_text().splitlines())
|
assert not any(json.loads(line)['action']=='power' for line in events.read_text().splitlines())
|
||||||
assert ipc('controlTest','click','powerCancel');assert state()['power']==''
|
|
||||||
assert ipc('controlTest','click','power-shutdown');ipc('controlTest','pressEscape');wait(lambda:state()['power']=='','Escape cancels pending power')
|
|
||||||
assert ipc('controlcenter','status')['opened']
|
assert ipc('controlcenter','status')['opened']
|
||||||
assert ipc('controlTest','click','power-reboot');assert ipc('controlTest','click','powerConfirm')
|
assert ipc('controlTest','hold','power-reboot',1200)
|
||||||
wait(lambda:not state()['busy'],'recorded confirmation')
|
wait(lambda:not state()['busy'],'recorded hold confirmation')
|
||||||
actions=[json.loads(line) for line in events.read_text().splitlines()]
|
actions=[json.loads(line) for line in events.read_text().splitlines()]
|
||||||
power=[a for a in actions if a['action']=='power'];assert len(power)==1 and power[0]['value']=='reboot' and power[0]['confirmed'] is True,str(actions)
|
power=[a for a in actions if a['action']=='power'];assert len(power)==1 and power[0]['value']=='reboot' and power[0]['confirmed'] is True,str(actions)
|
||||||
ipc('controlcenter','close');time.sleep(.3);ipc('controlcenter','open');time.sleep(.35)
|
ipc('controlcenter','close');time.sleep(.3);ipc('controlcenter','open');time.sleep(.35)
|
||||||
@@ -167,4 +166,4 @@ with tempfile.TemporaryDirectory(prefix='glassmxrph-controls-') as tmp:
|
|||||||
shell.terminate();shell.wait(timeout=5)
|
shell.terminate();shell.wait(timeout=5)
|
||||||
if original:subprocess.run(['hyprctl','dispatch','focusmonitor',original],capture_output=True)
|
if original:subprocess.run(['hyprctl','dispatch','focusmonitor',original],capture_output=True)
|
||||||
text=log.read_text();assert 'WARN' not in text and 'ERROR' not in text,text
|
text=log.read_text();assert 'WARN' not in text and 'ERROR' not in text,text
|
||||||
print('PASS: native read-only discovery, active-monitor placement, system pill, recording audio/per-app volume/Caffeine/Game Mode/network/Bluetooth/display/DND actions, free grid edit mode (place, push down, air gaps, resize, remove, add, plugin tiles, reset), power confirmation/cancel, outside/Escape/exclusivity, settings, clean logs.')
|
print('PASS: native read-only discovery, active-monitor placement, system pill, recording audio/per-app volume/Caffeine/Game Mode/network/Bluetooth/display/DND actions, free grid edit mode (place, push down, air gaps, resize, remove, add, plugin tiles, reset), power hold-to-confirm/early release, outside/Escape/exclusivity, settings, clean logs.')
|
||||||
Reference in new issue
Block a user