bar/statusicons: add lock keys indicator (#514)
* [StatusIcons] Add caps lock indicator * Seprate CapsLock icon * Use material icon * fixes --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
This commit is contained in:
parent
dbf87354af
commit
04d867b149
5 changed files with 106 additions and 10 deletions
|
|
@ -349,7 +349,8 @@ The module automatically adds Caelestia shell to the path with **full functional
|
||||||
"showBattery": true,
|
"showBattery": true,
|
||||||
"showBluetooth": true,
|
"showBluetooth": true,
|
||||||
"showKbLayout": false,
|
"showKbLayout": false,
|
||||||
"showNetwork": true
|
"showNetwork": true,
|
||||||
|
"showLockStatus": true
|
||||||
},
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
"background": false,
|
"background": false,
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ JsonObject {
|
||||||
property bool showNetwork: true
|
property bool showNetwork: true
|
||||||
property bool showBluetooth: true
|
property bool showBluetooth: true
|
||||||
property bool showBattery: true
|
property bool showBattery: true
|
||||||
|
property bool showLockStatus: true
|
||||||
}
|
}
|
||||||
|
|
||||||
component Clock: JsonObject {
|
component Clock: JsonObject {
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,88 @@ StyledRect {
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
implicitWidth: Config.bar.sizes.innerWidth
|
implicitWidth: Config.bar.sizes.innerWidth
|
||||||
implicitHeight: iconColumn.implicitHeight + Appearance.padding.normal * 2
|
implicitHeight: iconColumn.implicitHeight + Appearance.padding.normal * 2 - (Config.bar.status.showLockStatus && !Hypr.capsLock && !Hypr.numLock ? iconColumn.spacing : 0)
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: iconColumn
|
id: iconColumn
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: Appearance.padding.normal
|
||||||
|
|
||||||
spacing: Appearance.spacing.smaller / 2
|
spacing: Appearance.spacing.smaller / 2
|
||||||
|
|
||||||
|
// Lock keys status
|
||||||
|
WrappedLoader {
|
||||||
|
name: "lockstatus"
|
||||||
|
active: Config.bar.status.showLockStatus
|
||||||
|
|
||||||
|
sourceComponent: ColumnLayout {
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
implicitWidth: capslockIcon.implicitWidth
|
||||||
|
implicitHeight: Hypr.capsLock ? capslockIcon.implicitHeight : 0
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: capslockIcon
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
scale: Hypr.capsLock ? 1 : 0.5
|
||||||
|
opacity: Hypr.capsLock ? 1 : 0
|
||||||
|
|
||||||
|
text: "keyboard_capslock_badge"
|
||||||
|
color: root.colour
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.topMargin: Hypr.capsLock && Hypr.numLock ? iconColumn.spacing : 0
|
||||||
|
|
||||||
|
implicitWidth: numlockIcon.implicitWidth
|
||||||
|
implicitHeight: Hypr.numLock ? numlockIcon.implicitHeight : 0
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: numlockIcon
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
scale: Hypr.numLock ? 1 : 0.5
|
||||||
|
opacity: Hypr.numLock ? 1 : 0
|
||||||
|
|
||||||
|
text: "looks_one"
|
||||||
|
color: root.colour
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Audio icon
|
// Audio icon
|
||||||
WrappedLoader {
|
WrappedLoader {
|
||||||
name: "audio"
|
name: "audio"
|
||||||
|
|
@ -68,6 +142,8 @@ StyledRect {
|
||||||
|
|
||||||
// Bluetooth section
|
// Bluetooth section
|
||||||
WrappedLoader {
|
WrappedLoader {
|
||||||
|
Layout.preferredHeight: implicitHeight
|
||||||
|
|
||||||
name: "bluetooth"
|
name: "bluetooth"
|
||||||
active: Config.bar.status.showBluetooth
|
active: Config.bar.status.showBluetooth
|
||||||
|
|
||||||
|
|
@ -124,6 +200,10 @@ StyledRect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on Layout.preferredHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battery icon
|
// Battery icon
|
||||||
|
|
@ -157,13 +237,6 @@ StyledRect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
|
||||||
Anim {
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component WrappedLoader: Loader {
|
component WrappedLoader: Loader {
|
||||||
required property string name
|
required property string name
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,11 @@ Item {
|
||||||
source: "KbLayout.qml"
|
source: "KbLayout.qml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
name: "lockstatus"
|
||||||
|
source: "LockStatus.qml"
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: [...SystemTray.items.values]
|
values: [...SystemTray.items.values]
|
||||||
|
|
|
||||||
16
modules/bar/popouts/LockStatus.qml
Normal file
16
modules/bar/popouts/LockStatus.qml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import qs.components
|
||||||
|
import qs.services
|
||||||
|
import qs.config
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Capslock: %1").arg(Hypr.capsLock ? "Enabled" : "Disabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Numlock: %1").arg(Hypr.numLock ? "Enabled" : "Disabled")
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue