misc qs updates
This commit is contained in:
parent
ee9bb5b3fc
commit
3c91610d5a
9 changed files with 60 additions and 147 deletions
|
@ -1,126 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Scope {
|
|
||||||
id: root
|
|
||||||
property bool failed;
|
|
||||||
property string errorString;
|
|
||||||
|
|
||||||
// Connect to the Quickshell global to listen for the reload signals.
|
|
||||||
Connections {
|
|
||||||
target: Quickshell
|
|
||||||
|
|
||||||
function onReloadCompleted() {
|
|
||||||
root.failed = false;
|
|
||||||
popupLoader.loading = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onReloadFailed(error: string) {
|
|
||||||
// Close any existing popup before making a new one.
|
|
||||||
popupLoader.active = false;
|
|
||||||
|
|
||||||
root.failed = true;
|
|
||||||
root.errorString = error;
|
|
||||||
popupLoader.loading = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep the popup in a loader because it isn't needed most of the timeand will take up
|
|
||||||
// memory that could be used for something else.
|
|
||||||
LazyLoader {
|
|
||||||
id: popupLoader
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
id: popup
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: true
|
|
||||||
left: true
|
|
||||||
}
|
|
||||||
|
|
||||||
margins {
|
|
||||||
top: 25
|
|
||||||
left: 25
|
|
||||||
}
|
|
||||||
|
|
||||||
width: rect.width
|
|
||||||
height: rect.height
|
|
||||||
|
|
||||||
// color blending is a bit odd as detailed in the type reference.
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: rect
|
|
||||||
color: failed ? "#40802020" : "#40009020"
|
|
||||||
|
|
||||||
implicitHeight: layout.implicitHeight + 50
|
|
||||||
implicitWidth: layout.implicitWidth + 30
|
|
||||||
|
|
||||||
// Fills the whole area of the rectangle, making any clicks go to it,
|
|
||||||
// which dismiss the popup.
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: popupLoader.active = false
|
|
||||||
|
|
||||||
// makes the mouse area track mouse hovering, so the hide animation
|
|
||||||
// can be paused when hovering.
|
|
||||||
hoverEnabled: true
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: layout
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
topMargin: 20
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: root.failed ? "Reload failed." : "Reloaded completed!"
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: root.errorString
|
|
||||||
color: "white"
|
|
||||||
// When visible is false, it also takes up no space.
|
|
||||||
visible: root.errorString != ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// A progress bar on the bottom of the screen, showing how long until the
|
|
||||||
// popup is removed.
|
|
||||||
Rectangle {
|
|
||||||
id: bar
|
|
||||||
color: "#20ffffff"
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
height: 20
|
|
||||||
|
|
||||||
PropertyAnimation {
|
|
||||||
id: anim
|
|
||||||
target: bar
|
|
||||||
property: "width"
|
|
||||||
from: rect.width
|
|
||||||
to: 0
|
|
||||||
duration: failed ? 10000 : 800
|
|
||||||
onFinished: popupLoader.active = false
|
|
||||||
|
|
||||||
// Pause the animation when the mouse is hovering over the popup,
|
|
||||||
// so it stays onscreen while reading. This updates reactively
|
|
||||||
// when the mouse moves on and off the popup.
|
|
||||||
paused: mouseArea.containsMouse
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We could set `running: true` inside the animation, but the width of the
|
|
||||||
// rectangle might not be calculated yet, due to the layout.
|
|
||||||
// In the `Component.onCompleted` event handler, all of the component's
|
|
||||||
// properties and children have been initialized.
|
|
||||||
Component.onCompleted: anim.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,11 +7,10 @@ import "systray" as SysTray
|
||||||
import "audio" as Audio
|
import "audio" as Audio
|
||||||
import "mpris" as Mpris
|
import "mpris" as Mpris
|
||||||
import "power" as Power
|
import "power" as Power
|
||||||
import "root:notifications" as Notifs
|
import "../notifications" as Notifs
|
||||||
|
|
||||||
BarContainment {
|
BarContainment {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool isSoleBar: Quickshell.screens.length == 1;
|
property bool isSoleBar: Quickshell.screens.length == 1;
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import ".."
|
import ".."
|
||||||
import "../lock" as Lock
|
import "../lock" as Lock
|
||||||
|
@ -15,41 +16,58 @@ PanelWindow {
|
||||||
bottom: true
|
bottom: true
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 70
|
property real baseWidth: 55
|
||||||
exclusiveZone: width - margins.left
|
property real leftMargin: root.compactState * 10
|
||||||
|
width: baseWidth + 15
|
||||||
|
exclusiveZone: baseWidth + (isFullscreenWorkspace ? 0 : 15) - margins.left
|
||||||
|
|
||||||
|
mask: Region {
|
||||||
|
height: root.height
|
||||||
|
width: root.exclusiveZone
|
||||||
|
}
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
WlrLayershell.namespace: "shell:bar"
|
WlrLayershell.namespace: "shell:bar"
|
||||||
|
|
||||||
readonly property var tooltip: tooltip;
|
readonly property Tooltip tooltip: tooltip;
|
||||||
Tooltip {
|
Tooltip {
|
||||||
id: tooltip
|
id: tooltip
|
||||||
bar: root
|
bar: root
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property real tooltipXOffset: root.width + 2;
|
readonly property real tooltipXOffset: root.baseWidth + root.leftMargin + 5;
|
||||||
|
|
||||||
function boundedY(targetY: real, height: real): real {
|
function boundedY(targetY: real, height: real): real {
|
||||||
return Math.max(barRect.anchors.topMargin + height, Math.min(barRect.height + barRect.anchors.topMargin - height, targetY))
|
return Math.max(barRect.anchors.topMargin + height, Math.min(barRect.height + barRect.anchors.topMargin - height, targetY))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property bool isFullscreenWorkspace: Hyprland.monitorFor(screen).activeWorkspace.hasFullscreen
|
||||||
|
property real compactState: isFullscreenWorkspace ? 0 : 1
|
||||||
|
Behavior on compactState {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 600
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: [0.0, 0.75, 0.15, 1.0, 1.0, 1.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: barRect
|
id: barRect
|
||||||
|
|
||||||
x: 10 - Lock.Controller.lockSlide * (barRect.width + 10)
|
x: root.leftMargin - Lock.Controller.lockSlide * (barRect.width + root.leftMargin)
|
||||||
width: parent.width - 15
|
width: parent.width - 15
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
margins: 10
|
margins: root.compactState * 10
|
||||||
}
|
}
|
||||||
|
|
||||||
color: ShellGlobals.colors.bar
|
color: ShellGlobals.colors.bar
|
||||||
radius: 5
|
radius: root.compactState * 5
|
||||||
border.color: ShellGlobals.colors.barOutline
|
border.color: ShellGlobals.colors.barOutline
|
||||||
border.width: 1
|
border.width: root.compactState
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: containment
|
id: containment
|
||||||
|
|
|
@ -61,7 +61,7 @@ FullwidthMouseArea {
|
||||||
property int wsIndex: root.wsBaseIndex + index;
|
property int wsIndex: root.wsBaseIndex + index;
|
||||||
property HyprlandWorkspace workspace: null;
|
property HyprlandWorkspace workspace: null;
|
||||||
property bool exists: workspace != null;
|
property bool exists: workspace != null;
|
||||||
property bool active: (root.monitor?.activeWorkspace ?? false) && root.monitor.activeWorkspace == workspace;
|
property bool active: workspace?.active ?? false
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
if (active) root.currentIndex = wsIndex;
|
if (active) root.currentIndex = wsIndex;
|
||||||
|
|
|
@ -16,7 +16,6 @@ BarWidgetInner {
|
||||||
}
|
}
|
||||||
|
|
||||||
id: column;
|
id: column;
|
||||||
implicitHeight: childrenRect.height;
|
|
||||||
spacing: 5;
|
spacing: 5;
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|
|
@ -9,6 +9,9 @@ T.Slider {
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitHandleHeight + topPadding + bottomPadding)
|
implicitHandleHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
|
property color barColor: "#80ceffff"
|
||||||
|
property color grooveColor: "#30ceffff"
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
x: control.leftPadding
|
x: control.leftPadding
|
||||||
y: control.topPadding + control.availableHeight / 2 - height / 2
|
y: control.topPadding + control.availableHeight / 2 - height / 2
|
||||||
|
@ -18,7 +21,7 @@ T.Slider {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
|
|
||||||
radius: 5
|
radius: 5
|
||||||
color: "#30ceffff"
|
color: control.grooveColor
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -29,7 +32,7 @@ T.Slider {
|
||||||
|
|
||||||
width: control.handle.x + (control.handle.width / 2) - parent.x
|
width: control.handle.x + (control.handle.width / 2) - parent.x
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: "#80ceffff"
|
color: control.barColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,15 @@ FullwidthMouseArea {
|
||||||
|
|
||||||
property alias widgetOpen: persist.widgetOpen;
|
property alias widgetOpen: persist.widgetOpen;
|
||||||
|
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton | Qt.ForwardButton | Qt.BackButton
|
||||||
onPressed: widgetOpen = !widgetOpen
|
onPressed: event => {
|
||||||
|
if (event.button == Qt.RightButton) widgetOpen = !widgetOpen;
|
||||||
|
else if (event.button == Qt.ForwardButton) {
|
||||||
|
MprisController.next();
|
||||||
|
} else if (event.button == Qt.BackButton) {
|
||||||
|
MprisController.previous();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onWheel: event => {
|
onWheel: event => {
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
|
@ -664,6 +671,20 @@ FullwidthMouseArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColorQuantizer {
|
||||||
|
id: quant
|
||||||
|
rescaleSize: 200
|
||||||
|
depth: 0
|
||||||
|
source: MprisController.activeTrack.artUrl
|
||||||
|
onColorsChanged: console.log(colors)
|
||||||
|
}
|
||||||
|
|
||||||
|
grooveColor: quant.colors.length === 0 ? "#30ceffff" : Qt.alpha(quant.colors[0], 0.2)
|
||||||
|
barColor: quant.colors.length === 0 ? "#80ceffff" : Qt.alpha(Qt.lighter(quant.colors[0]), 0.5)
|
||||||
|
|
||||||
|
Behavior on grooveColor { ColorAnimation { duration: 200 } }
|
||||||
|
Behavior on barColor { ColorAnimation { duration: 200 } }
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: player.canSeek
|
enabled: player.canSeek
|
||||||
from: 0
|
from: 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "root:bar"
|
import "../bar"
|
||||||
|
|
||||||
BarWidgetInner {
|
BarWidgetInner {
|
||||||
id: root
|
id: root
|
||||||
|
@ -49,7 +49,7 @@ BarWidgetInner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var tooltip: TooltipItem {
|
property TooltipItem tooltip: TooltipItem {
|
||||||
tooltip: bar.tooltip
|
tooltip: bar.tooltip
|
||||||
owner: root
|
owner: root
|
||||||
show: button.containsMouse
|
show: button.containsMouse
|
||||||
|
@ -65,7 +65,7 @@ BarWidgetInner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var rightclickMenu: TooltipItem {
|
property TooltipItem rightclickMenu: TooltipItem {
|
||||||
tooltip: bar.tooltip
|
tooltip: bar.tooltip
|
||||||
owner: root
|
owner: root
|
||||||
isMenu: true
|
isMenu: true
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
//@ pragma ShellId shell
|
//@ pragma ShellId shell
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
@ -14,8 +15,6 @@ import "background"
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
Component.onCompleted: [Lock.Controller, Launcher.Controller.init()]
|
Component.onCompleted: [Lock.Controller, Launcher.Controller.init()]
|
||||||
|
|
||||||
ReloadPopup {}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
command: ["mkdir", "-p", ShellGlobals.rtpath]
|
command: ["mkdir", "-p", ShellGlobals.rtpath]
|
||||||
running: true
|
running: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue