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 "mpris" as Mpris
 | 
			
		||||
import "power" as Power
 | 
			
		||||
import "root:notifications" as Notifs
 | 
			
		||||
import "../notifications" as Notifs
 | 
			
		||||
 | 
			
		||||
BarContainment {
 | 
			
		||||
	id: root
 | 
			
		||||
 | 
			
		||||
	property bool isSoleBar: Quickshell.screens.length == 1;
 | 
			
		||||
 | 
			
		||||
	ColumnLayout {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
import QtQuick
 | 
			
		||||
import Quickshell
 | 
			
		||||
import Quickshell.Hyprland
 | 
			
		||||
import Quickshell.Wayland
 | 
			
		||||
import ".."
 | 
			
		||||
import "../lock" as Lock
 | 
			
		||||
| 
						 | 
				
			
			@ -15,41 +16,58 @@ PanelWindow {
 | 
			
		|||
		bottom: true
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	width: 70
 | 
			
		||||
	exclusiveZone: width - margins.left
 | 
			
		||||
	property real baseWidth: 55
 | 
			
		||||
	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"
 | 
			
		||||
 | 
			
		||||
	WlrLayershell.namespace: "shell:bar"
 | 
			
		||||
 | 
			
		||||
	readonly property var tooltip: tooltip;
 | 
			
		||||
	readonly property Tooltip tooltip: tooltip;
 | 
			
		||||
	Tooltip {
 | 
			
		||||
		id: tooltip
 | 
			
		||||
		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 {
 | 
			
		||||
		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 {
 | 
			
		||||
		id: barRect
 | 
			
		||||
 | 
			
		||||
		x: 10 - Lock.Controller.lockSlide * (barRect.width + 10)
 | 
			
		||||
		x: root.leftMargin - Lock.Controller.lockSlide * (barRect.width + root.leftMargin)
 | 
			
		||||
		width: parent.width - 15
 | 
			
		||||
 | 
			
		||||
		anchors {
 | 
			
		||||
			top: parent.top
 | 
			
		||||
			bottom: parent.bottom
 | 
			
		||||
			margins: 10
 | 
			
		||||
			margins: root.compactState * 10
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		color: ShellGlobals.colors.bar
 | 
			
		||||
		radius: 5
 | 
			
		||||
		radius: root.compactState * 5
 | 
			
		||||
		border.color: ShellGlobals.colors.barOutline
 | 
			
		||||
		border.width: 1
 | 
			
		||||
		border.width: root.compactState
 | 
			
		||||
 | 
			
		||||
		Item {
 | 
			
		||||
			id: containment
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ FullwidthMouseArea {
 | 
			
		|||
				property int wsIndex: root.wsBaseIndex + index;
 | 
			
		||||
				property HyprlandWorkspace 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: {
 | 
			
		||||
					if (active) root.currentIndex = wsIndex;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,6 @@ BarWidgetInner {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		id: column;
 | 
			
		||||
		implicitHeight: childrenRect.height;
 | 
			
		||||
		spacing: 5;
 | 
			
		||||
 | 
			
		||||
		Loader {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,9 @@ T.Slider {
 | 
			
		|||
  implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
 | 
			
		||||
    implicitHandleHeight + topPadding + bottomPadding)
 | 
			
		||||
 | 
			
		||||
	property color barColor: "#80ceffff"
 | 
			
		||||
	property color grooveColor: "#30ceffff"
 | 
			
		||||
 | 
			
		||||
	background: Rectangle {
 | 
			
		||||
		x: control.leftPadding
 | 
			
		||||
		y: control.topPadding + control.availableHeight / 2 - height / 2
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +21,7 @@ T.Slider {
 | 
			
		|||
		height: implicitHeight
 | 
			
		||||
 | 
			
		||||
		radius: 5
 | 
			
		||||
		color: "#30ceffff"
 | 
			
		||||
		color: control.grooveColor
 | 
			
		||||
		border.width: 0
 | 
			
		||||
 | 
			
		||||
		Rectangle {
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +32,7 @@ T.Slider {
 | 
			
		|||
 | 
			
		||||
			width: control.handle.x + (control.handle.width / 2) - parent.x
 | 
			
		||||
			radius: parent.radius
 | 
			
		||||
			color: "#80ceffff"
 | 
			
		||||
			color: control.barColor
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,8 +29,15 @@ FullwidthMouseArea {
 | 
			
		|||
 | 
			
		||||
	property alias widgetOpen: persist.widgetOpen;
 | 
			
		||||
 | 
			
		||||
	acceptedButtons: Qt.RightButton
 | 
			
		||||
	onPressed: widgetOpen = !widgetOpen
 | 
			
		||||
	acceptedButtons: Qt.RightButton | Qt.ForwardButton | Qt.BackButton
 | 
			
		||||
	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 => {
 | 
			
		||||
		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
 | 
			
		||||
							enabled: player.canSeek
 | 
			
		||||
							from: 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import QtQuick
 | 
			
		||||
import QtQuick.Controls
 | 
			
		||||
import "root:bar"
 | 
			
		||||
import "../bar"
 | 
			
		||||
 | 
			
		||||
BarWidgetInner {
 | 
			
		||||
	id: root
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ BarWidgetInner {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	property var tooltip: TooltipItem {
 | 
			
		||||
	property TooltipItem tooltip: TooltipItem {
 | 
			
		||||
		tooltip: bar.tooltip
 | 
			
		||||
		owner: root
 | 
			
		||||
		show: button.containsMouse
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ BarWidgetInner {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	property var rightclickMenu: TooltipItem {
 | 
			
		||||
	property TooltipItem rightclickMenu: TooltipItem {
 | 
			
		||||
		tooltip: bar.tooltip
 | 
			
		||||
		owner: root
 | 
			
		||||
		isMenu: true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
//@ pragma ShellId shell
 | 
			
		||||
 | 
			
		||||
import Quickshell
 | 
			
		||||
import Quickshell.Io
 | 
			
		||||
import Quickshell.Wayland
 | 
			
		||||
| 
						 | 
				
			
			@ -14,8 +15,6 @@ import "background"
 | 
			
		|||
ShellRoot {
 | 
			
		||||
	Component.onCompleted: [Lock.Controller, Launcher.Controller.init()]
 | 
			
		||||
 | 
			
		||||
	ReloadPopup {}
 | 
			
		||||
 | 
			
		||||
	Process {
 | 
			
		||||
		command: ["mkdir", "-p", ShellGlobals.rtpath]
 | 
			
		||||
		running: true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue