1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

dankbar: add caps lock indicator widget

This commit is contained in:
bbedward
2025-11-13 22:41:33 -05:00
parent 91da720c26
commit 0490794d6c
6 changed files with 75 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ Singleton {
property bool showNotificationButton: true
property bool showBattery: true
property bool showControlCenterButton: true
property bool showCapsLockIndicator: true
property bool controlCenterShowNetworkIcon: true
property bool controlCenterShowBluetoothIcon: true
@@ -775,6 +776,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
showNotificationButton = true
showBattery = true
showControlCenterButton = true
showCapsLockIndicator = true
saveSettings()
}

View File

@@ -47,6 +47,7 @@ var SPEC = {
showNotificationButton: { def: true },
showBattery: { def: true },
showControlCenterButton: { def: true },
showCapsLockIndicator: { def: true },
controlCenterShowNetworkIcon: { def: true },
controlCenterShowBluetoothIcon: { def: true },

View File

@@ -844,6 +844,7 @@ Item {
"battery": batteryComponent,
"layout": layoutComponent,
"controlCenterButton": controlCenterButtonComponent,
"capsLockIndicator": capsLockIndicatorComponent,
"idleInhibitor": idleInhibitorComponent,
"spacer": spacerComponent,
"separator": separatorComponent,
@@ -884,6 +885,7 @@ Item {
"batteryComponent": batteryComponent,
"layoutComponent": layoutComponent,
"controlCenterButtonComponent": controlCenterButtonComponent,
"capsLockIndicatorComponent": capsLockIndicatorComponent,
"idleInhibitorComponent": idleInhibitorComponent,
"spacerComponent": spacerComponent,
"separatorComponent": separatorComponent,
@@ -1428,6 +1430,16 @@ Item {
}
}
Component {
id: capsLockIndicatorComponent
CapsLockIndicator {
widgetThickness: barWindow.widgetThickness
section: topBarContent.getWidgetSection(parent) || "right"
parentScreen: barWindow.screen
}
}
Component {
id: idleInhibitorComponent

View File

@@ -192,6 +192,7 @@ Loader {
"notificationButton": components.notificationButtonComponent,
"battery": components.batteryComponent,
"controlCenterButton": components.controlCenterButtonComponent,
"capsLockIndicator": components.capsLockIndicatorComponent,
"idleInhibitor": components.idleInhibitorComponent,
"spacer": components.spacerComponent,
"separator": components.separatorComponent,

View File

@@ -0,0 +1,53 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import qs.Common
import qs.Modules.Plugins
import qs.Services
import qs.Widgets
BasePill {
id: root
opacity: DMSService.capsLockState ? 1 : 0
states: [
State {
name: "hidden_horizontal"
when: !DMSService.capsLockState && !isVerticalOrientation
PropertyChanges { target: root; width: 0 }
},
State {
name: "hidden_vertical"
when: !DMSService.capsLockState && isVerticalOrientation
PropertyChanges { target: root; height: 0 }
}
]
transitions: [
Transition {
NumberAnimation { properties: "width,height"; duration: Theme.shortDuration; easing.type: Theme.standardEasing }
}
]
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
content: Component {
Item {
implicitWidth: root.widgetThickness - root.horizontalPadding * 2
implicitHeight: root.widgetThickness - root.horizontalPadding * 2
DankIcon {
anchors.centerIn: parent
name: "shift_lock"
size: Theme.barIconSize(root.barThickness)
color: Theme.primary
}
}
}
}

View File

@@ -155,6 +155,12 @@ Item {
"description": I18n.tr("Prevent screen timeout"),
"icon": "motion_sensor_active",
"enabled": true
}, {
"id": "capsLockIndicator",
"text": I18n.tr("Caps Lock Indicator"),
"description": I18n.tr("Shows when caps lock is active"),
"icon": "shift_lock",
"enabled": true
}, {
"id": "spacer",
"text": I18n.tr("Spacer"),