Initial commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# rbwLockToggle — DMS bar plugin
|
||||||
|
|
||||||
|
Bar widget for [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell): shows Bitwarden vault lock state via [rbw](https://github.com/doy/rbw) and toggles lock/unlock on click.
|
||||||
|
|
||||||
|
Requires `rbw` and a working pinentry on PATH in the DMS session.
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
import qs.Modules.Plugins
|
||||||
|
|
||||||
|
PluginComponent {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool vaultUnlocked: false
|
||||||
|
|
||||||
|
function refreshLockState() {
|
||||||
|
if (!statusProcess.running)
|
||||||
|
statusProcess.exec(["rbw", "unlocked"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleLock() {
|
||||||
|
if (root.vaultUnlocked) {
|
||||||
|
Quickshell.execDetached(["rbw", "lock"]);
|
||||||
|
} else {
|
||||||
|
Quickshell.execDetached(["rbw", "unlock"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pillClickAction: () => root.toggleLock()
|
||||||
|
|
||||||
|
Component.onCompleted: refreshLockState()
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 2500
|
||||||
|
repeat: true
|
||||||
|
running: true
|
||||||
|
onTriggered: root.refreshLockState()
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: statusProcess
|
||||||
|
command: ["rbw", "unlocked"]
|
||||||
|
onExited: (exitCode, _exitStatus) => {
|
||||||
|
root.vaultUnlocked = exitCode === 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
horizontalBarPill: Component {
|
||||||
|
MouseArea {
|
||||||
|
implicitWidth: iconH.implicitWidth
|
||||||
|
implicitHeight: iconH.implicitHeight
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.toggleLock()
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: iconH
|
||||||
|
name: root.vaultUnlocked ? "lock_open_right" : "lock"
|
||||||
|
size: root.iconSize
|
||||||
|
color: parent.containsMouse ? Theme.primary : Theme.surfaceText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
verticalBarPill: Component {
|
||||||
|
MouseArea {
|
||||||
|
implicitWidth: iconV.implicitWidth
|
||||||
|
implicitHeight: iconV.implicitHeight
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.toggleLock()
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: iconV
|
||||||
|
name: root.vaultUnlocked ? "lock_open_right" : "lock"
|
||||||
|
size: root.iconSize
|
||||||
|
color: parent.containsMouse ? Theme.primary : Theme.surfaceText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Modules.Plugins
|
||||||
|
|
||||||
|
PluginSettings {
|
||||||
|
id: root
|
||||||
|
pluginId: "rbwLockToggle"
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: "Shows rbw vault state with a closed lock (locked) or open lock (unlocked). Click to run `rbw unlock` (pinentry) or `rbw lock`. Requires `rbw` on PATH in the DMS session and a working pinentry."
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"id": "rbwLockToggle",
|
||||||
|
"name": "Bitwarden (rbw) lock",
|
||||||
|
"description": "Bar control for rbw vault: locked/unlocked padlock; click to unlock or lock",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": "chiasson.cloud",
|
||||||
|
"type": "widget",
|
||||||
|
"capabilities": ["dankbar-widget"],
|
||||||
|
"component": "./RbwLockToggle.qml",
|
||||||
|
"settings": "./RbwLockToggleSettings.qml",
|
||||||
|
"icon": "lock_open",
|
||||||
|
"permissions": ["settings_read"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user