feat: update osd for volume
This commit is contained in:
1 parent
ab09d46e66
commit
99abeabe75
4 files changed
+153
-75
No files matched your search
@@ -4,6 +4,7 @@ import Quickshell.Io
|
||||
|
||||
import "components/Bar"
|
||||
import "components/CommandPalette"
|
||||
import "components/OSD"
|
||||
import "components/Shared"
|
||||
|
||||
ShellRoot {
|
||||
@@ -11,45 +12,24 @@ ShellRoot {
|
||||
|
||||
// --- Global State ---
|
||||
property bool commandPaletteOpen: false
|
||||
property bool commandPaletteOsdMode: false
|
||||
|
||||
IpcHandler {
|
||||
target: "commandPalette"
|
||||
function toggle() {
|
||||
root.toggleCommandPalette();
|
||||
}
|
||||
function openOsd() {
|
||||
root.showOsd();
|
||||
commandPaletteOpen = !commandPaletteOpen;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCommandPalette() {
|
||||
if (commandPaletteOpen && !commandPaletteOsdMode) {
|
||||
commandPaletteOpen = false;
|
||||
} else {
|
||||
commandPaletteOsdMode = false;
|
||||
commandPaletteOpen = true;
|
||||
IpcHandler {
|
||||
target: "osd"
|
||||
function showVolume() {
|
||||
osd.show("volume");
|
||||
}
|
||||
function showBrightness() {
|
||||
osd.show("brightness");
|
||||
}
|
||||
}
|
||||
|
||||
function showOsd() {
|
||||
commandPaletteOsdMode = true;
|
||||
commandPaletteOpen = true;
|
||||
osdHideTimer.restart();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: osdHideTimer
|
||||
interval: 2000
|
||||
onTriggered: {
|
||||
if (root.commandPaletteOsdMode) {
|
||||
root.commandPaletteOpen = false;
|
||||
root.commandPaletteOsdMode = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// --------------------
|
||||
|
||||
Bar {
|
||||
id: bar
|
||||
rootState: root
|
||||
@@ -59,4 +39,8 @@ ShellRoot {
|
||||
id: commandPalette
|
||||
rootState: root
|
||||
}
|
||||
|
||||
OSD {
|
||||
id: osd
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user