qs: add capslock monitor

This commit is contained in:
2026-04-20 18:55:59 +02:00
parent 266ea92f4a
commit 454262a803
7 changed files with 260 additions and 33 deletions
@@ -634,6 +634,28 @@ Singleton {
Pipewire.preferredDefaultAudioSource = newSource;
}
onVolumeChanged: {
if (root.consumeOutputOSDSuppression()) {
return;
}
if (root.muted) {
TempNotificationService.showWithIcon("volume-mute", "Muted");
return;
}
TempNotificationService.showWithIcon(root.getOutputIcon(), Math.round(root.volume * 100) + "%");
}
onInputVolumeChanged: {
if (root.consumeInputOSDSuppression()) {
return;
}
if (root.inputMuted) {
TempNotificationService.showWithIcon("volume-mute", "Muted");
return;
}
TempNotificationService.showWithIcon(root.getInputIcon(), Math.round(root.inputVolume * 100) + "%");
}
onMutedChanged: {
if (root.muted) {
TempNotificationService.showWithIcon("volume-mute", "Muted");
@@ -0,0 +1,35 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Services
import qs.Utils
pragma Singleton
Singleton {
id: root
property bool isCapslockOn: false
onIsCapslockOnChanged: {
TempNotificationService.showWithIcon("letter-case", "Caps Lock " + (root.isCapslockOn ? "ON" : "OFF"));
}
Process {
id: capslockMonitorProcess
running: true
command: ["led_monitor", "-l", "capslock"]
stdout: SplitParser {
splitMarker: "\n"
onRead: (line) => {
if (line.trim() === "1")
root.isCapslockOn = true;
else if (line.trim() === "0")
root.isCapslockOn = false;
}
}
}
}
@@ -11,7 +11,7 @@ Singleton {
property bool dirsLoaded: false
property bool initialized: dirsLoaded && ImageCacheService.initialized && ShellState.isLoaded && SettingsService.isLoaded
Component.onCompleted: {
function mkdirs() {
let mkdirs = "";
for (const dir of [Paths.cacheDir, Paths.configDir, Paths.recordingDir, Paths.notesDir]) {
mkdirs += `mkdir -p "${dir}" && `;
@@ -22,6 +22,11 @@ Singleton {
process.running = true;
}
Component.onCompleted: {
ImageCacheService.init();
root.mkdirs();
}
Process {
id: process
@@ -10,10 +10,6 @@ import qs.Services
ShellRoot {
id: root
Component.onCompleted: {
ImageCacheService.init();
}
Loader {
id: loader
@@ -24,6 +20,7 @@ ShellRoot {
SunsetService;
NotesService;
WallpaperCycle;
CapslockService;
}
IPCService {