mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
dankbar: add caps lock indicator widget
This commit is contained in:
@@ -95,6 +95,7 @@ Singleton {
|
|||||||
property bool showNotificationButton: true
|
property bool showNotificationButton: true
|
||||||
property bool showBattery: true
|
property bool showBattery: true
|
||||||
property bool showControlCenterButton: true
|
property bool showControlCenterButton: true
|
||||||
|
property bool showCapsLockIndicator: true
|
||||||
|
|
||||||
property bool controlCenterShowNetworkIcon: true
|
property bool controlCenterShowNetworkIcon: true
|
||||||
property bool controlCenterShowBluetoothIcon: true
|
property bool controlCenterShowBluetoothIcon: true
|
||||||
@@ -775,6 +776,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
|
|||||||
showNotificationButton = true
|
showNotificationButton = true
|
||||||
showBattery = true
|
showBattery = true
|
||||||
showControlCenterButton = true
|
showControlCenterButton = true
|
||||||
|
showCapsLockIndicator = true
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ var SPEC = {
|
|||||||
showNotificationButton: { def: true },
|
showNotificationButton: { def: true },
|
||||||
showBattery: { def: true },
|
showBattery: { def: true },
|
||||||
showControlCenterButton: { def: true },
|
showControlCenterButton: { def: true },
|
||||||
|
showCapsLockIndicator: { def: true },
|
||||||
|
|
||||||
controlCenterShowNetworkIcon: { def: true },
|
controlCenterShowNetworkIcon: { def: true },
|
||||||
controlCenterShowBluetoothIcon: { def: true },
|
controlCenterShowBluetoothIcon: { def: true },
|
||||||
|
|||||||
@@ -844,6 +844,7 @@ Item {
|
|||||||
"battery": batteryComponent,
|
"battery": batteryComponent,
|
||||||
"layout": layoutComponent,
|
"layout": layoutComponent,
|
||||||
"controlCenterButton": controlCenterButtonComponent,
|
"controlCenterButton": controlCenterButtonComponent,
|
||||||
|
"capsLockIndicator": capsLockIndicatorComponent,
|
||||||
"idleInhibitor": idleInhibitorComponent,
|
"idleInhibitor": idleInhibitorComponent,
|
||||||
"spacer": spacerComponent,
|
"spacer": spacerComponent,
|
||||||
"separator": separatorComponent,
|
"separator": separatorComponent,
|
||||||
@@ -884,6 +885,7 @@ Item {
|
|||||||
"batteryComponent": batteryComponent,
|
"batteryComponent": batteryComponent,
|
||||||
"layoutComponent": layoutComponent,
|
"layoutComponent": layoutComponent,
|
||||||
"controlCenterButtonComponent": controlCenterButtonComponent,
|
"controlCenterButtonComponent": controlCenterButtonComponent,
|
||||||
|
"capsLockIndicatorComponent": capsLockIndicatorComponent,
|
||||||
"idleInhibitorComponent": idleInhibitorComponent,
|
"idleInhibitorComponent": idleInhibitorComponent,
|
||||||
"spacerComponent": spacerComponent,
|
"spacerComponent": spacerComponent,
|
||||||
"separatorComponent": separatorComponent,
|
"separatorComponent": separatorComponent,
|
||||||
@@ -1428,6 +1430,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: capsLockIndicatorComponent
|
||||||
|
|
||||||
|
CapsLockIndicator {
|
||||||
|
widgetThickness: barWindow.widgetThickness
|
||||||
|
section: topBarContent.getWidgetSection(parent) || "right"
|
||||||
|
parentScreen: barWindow.screen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: idleInhibitorComponent
|
id: idleInhibitorComponent
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ Loader {
|
|||||||
"notificationButton": components.notificationButtonComponent,
|
"notificationButton": components.notificationButtonComponent,
|
||||||
"battery": components.batteryComponent,
|
"battery": components.batteryComponent,
|
||||||
"controlCenterButton": components.controlCenterButtonComponent,
|
"controlCenterButton": components.controlCenterButtonComponent,
|
||||||
|
"capsLockIndicator": components.capsLockIndicatorComponent,
|
||||||
"idleInhibitor": components.idleInhibitorComponent,
|
"idleInhibitor": components.idleInhibitorComponent,
|
||||||
"spacer": components.spacerComponent,
|
"spacer": components.spacerComponent,
|
||||||
"separator": components.separatorComponent,
|
"separator": components.separatorComponent,
|
||||||
|
|||||||
53
quickshell/Modules/DankBar/Widgets/CapsLockIndicator.qml
Normal file
53
quickshell/Modules/DankBar/Widgets/CapsLockIndicator.qml
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -155,6 +155,12 @@ Item {
|
|||||||
"description": I18n.tr("Prevent screen timeout"),
|
"description": I18n.tr("Prevent screen timeout"),
|
||||||
"icon": "motion_sensor_active",
|
"icon": "motion_sensor_active",
|
||||||
"enabled": true
|
"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",
|
"id": "spacer",
|
||||||
"text": I18n.tr("Spacer"),
|
"text": I18n.tr("Spacer"),
|
||||||
|
|||||||
Reference in New Issue
Block a user