quickshell: auto expand some monitorItem on value changes (just being too lazy to write a popup : )
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
"location": "Munich",
|
||||
"notifications": {
|
||||
"doNotDisturb": false,
|
||||
"lastSeenTs": 1760397059000
|
||||
"lastSeenTs": 1760464428000
|
||||
},
|
||||
"primaryColor": "#89b4fa",
|
||||
"showLyricsBar": false
|
||||
"showLyricsBar": true
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ MonitorItem {
|
||||
}
|
||||
maxValue: 100
|
||||
textSuffix: "%"
|
||||
expandOnValueChange: true
|
||||
onWheelUp: {
|
||||
const monitor = getMonitor();
|
||||
if (monitor)
|
||||
|
||||
@@ -10,6 +10,7 @@ MonitorItem {
|
||||
value: Math.round(AudioService.volume * 100)
|
||||
maxValue: 100
|
||||
textSuffix: "%"
|
||||
expandOnValueChange: true
|
||||
onWheelUp: {
|
||||
AudioService.increaseVolume();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ Item {
|
||||
property color fillColor: Colors.primary
|
||||
property string textSuffix: ""
|
||||
property bool pointerCursor: true
|
||||
property alias hovered: mouseArea.containsMouse
|
||||
property bool expandOnValueChange: false
|
||||
property real hideTimeOut: 2000 // ms
|
||||
property bool forceExpand: false
|
||||
property bool _expand: forceExpand || mouseArea.containsMouse
|
||||
property bool disableHover: false
|
||||
property bool critical: false
|
||||
property color criticalColor: Colors.red
|
||||
@@ -27,7 +30,34 @@ Item {
|
||||
signal rightClicked()
|
||||
|
||||
implicitHeight: parent.height - 5
|
||||
implicitWidth: parent.height + (hovered ? textDisplay.width : 0)
|
||||
implicitWidth: parent.height + (_expand ? textDisplay.width : 0)
|
||||
|
||||
Loader {
|
||||
id: connectionLoader
|
||||
|
||||
active: expandOnValueChange
|
||||
|
||||
sourceComponent: Connections {
|
||||
function onValueChanged() {
|
||||
root.forceExpand = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
|
||||
target: root
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
|
||||
interval: parent.hideTimeOut
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
root.forceExpand = false;
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
@@ -114,7 +144,7 @@ Item {
|
||||
id: textDisplay
|
||||
|
||||
implicitHeight: parent.height
|
||||
implicitWidth: root.hovered ? textLabel.implicitWidth + 10 : 0
|
||||
implicitWidth: root._expand ? textLabel.implicitWidth + 10 : 0
|
||||
clip: true
|
||||
|
||||
Text {
|
||||
@@ -127,7 +157,7 @@ Item {
|
||||
font.pointSize: Fonts.small
|
||||
font.family: Fonts.primary
|
||||
color: root.realColor
|
||||
opacity: root.hovered ? 1 : 0
|
||||
opacity: root._expand ? 1 : 0
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
|
||||
@@ -11,7 +11,7 @@ Singleton {
|
||||
id: process
|
||||
|
||||
running: true
|
||||
command: ["sh", "-c", "kquitapp6 kded6"]
|
||||
command: ["kquitapp6", "kded6"]
|
||||
onExited: (code, status) => {
|
||||
if (code !== 0)
|
||||
Logger.warn("NukeKded6", `Failed to kill kded6: ${code}`);
|
||||
|
||||
Reference in New Issue
Block a user