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:
@@ -600,6 +600,14 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: CapsLockOSD {
|
||||
modelData: item
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: hyprlandOverviewLoader
|
||||
active: CompositorService.isHyprland
|
||||
|
||||
@@ -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
|
||||
|
||||
37
quickshell/Modules/OSD/CapsLockOSD.qml
Normal file
37
quickshell/Modules/OSD/CapsLockOSD.qml
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user