1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

evdev: add evdev monitor for caps lock state

This commit is contained in:
bbedward
2025-11-13 22:24:27 -05:00
parent 6465b11e9b
commit 526c4092fd
16 changed files with 1215 additions and 50 deletions

View File

@@ -600,6 +600,14 @@ Item {
}
}
Variants {
model: SettingsData.getFilteredScreens("osd")
delegate: CapsLockOSD {
modelData: item
}
}
LazyLoader {
id: hyprlandOverviewLoader
active: CompositorService.isHyprland

View File

@@ -332,6 +332,7 @@ Item {
}
ColumnLayout {
id: passwordLayout
anchors.centerIn: parent
anchors.verticalCenterOffset: 50
spacing: Theme.spacingM
@@ -740,6 +741,35 @@ Item {
}
}
Row {
anchors.top: passwordLayout.bottom
anchors.topMargin: Theme.spacingS
anchors.horizontalCenter: passwordLayout.horizontalCenter
spacing: 4
opacity: DMSService.capsLockState ? 1 : 0
DankIcon {
name: "shift_lock"
size: 14
color: Theme.error
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "Caps Lock is on"
font.pixelSize: Theme.fontSizeSmall
color: Theme.error
anchors.verticalCenter: parent.verticalCenter
}
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
}
StyledText {
anchors.top: parent.top
anchors.left: parent.left

View File

@@ -0,0 +1,37 @@
import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
DankOSD {
id: root
osdWidth: Theme.iconSize + Theme.spacingS * 2
osdHeight: Theme.iconSize + Theme.spacingS * 2
autoHideInterval: 2000
enableMouseInteraction: false
property bool lastCapsLockState: false
Connections {
target: DMSService
function onCapsLockStateChanged() {
if (lastCapsLockState !== DMSService.capsLockState) {
root.show()
}
lastCapsLockState = DMSService.capsLockState
}
}
Component.onCompleted: {
lastCapsLockState = DMSService.capsLockState
}
content: DankIcon {
anchors.centerIn: parent
name: DMSService.capsLockState ? "shift_lock" : "shift_lock_off"
size: Theme.iconSize
color: Theme.primary
}
}

View File

@@ -49,8 +49,11 @@ Singleton {
signal brightnessDeviceUpdate(var device)
signal extWorkspaceStateUpdate(var data)
signal wlrOutputStateUpdate(var data)
signal evdevStateUpdate(var data)
property var activeSubscriptions: ["network", "network.credentials", "loginctl", "freedesktop", "gamma", "bluetooth", "bluetooth.pairing", "dwl", "brightness", "wlroutput"]
property bool capsLockState: false
property var activeSubscriptions: ["network", "network.credentials", "loginctl", "freedesktop", "gamma", "bluetooth", "bluetooth.pairing", "dwl", "brightness", "wlroutput", "evdev"]
Component.onCompleted: {
if (socketPath && socketPath.length > 0) {
@@ -349,6 +352,11 @@ Singleton {
extWorkspaceStateUpdate(data)
} else if (service === "wlroutput") {
wlrOutputStateUpdate(data)
} else if (service === "evdev") {
if (data.capsLock !== undefined) {
capsLockState = data.capsLock
}
evdevStateUpdate(data)
}
}