KWallet-Service Setup introduced

This commit is contained in:
Daniel Pätzold
2026-03-29 12:39:36 +02:00
parent 0067c7ebfd
commit 670f21526c
7 changed files with 176 additions and 4 deletions
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Daniel Pätzold
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Resets the KDE- Wallet
#
set -euo pipefail
#First, check if qdbus and kwallet is working via dbus
QB_CMD="qdbus-qt6"
if ! command -v ${QB_CMD} >/dev/null 2>&1; then
QB_CMD="qdbus"
if ! command -v ${QB_CMD} >/dev/null 2>&1; then
echo "qdbus-qt6 or qdbus not found; cannot create KWallet via DBus. Install Qt DBus tools."
exit 1
fi
fi
# Determine kwallet DBus service name (kwalletd6 on Plasma with KF6, else kwalletd5)
QB_SERVICE="org.kde.kwalletd"
if ( ${QB_CMD} "$QB_SERVICE" | grep -q "/modules/kwalletd6" ); then
QB_PATH="/modules/kwalletd6"
elif ( qdbus-qt6 "$QB_SERVICE" | grep -q "/modules/kwalletd5" ); then
QB_PATH="/modules/kwalletd5"
else
# Try calling directly — system may expose the service as org.kde.KWallet
QB_SERVICE="org.kde.KWallet"
QB_PATH=$( ${QB_CMD} "$QB_SERVICE" | grep -q "/modules/kwalletd" )
fi
#Now, run the command
${QB_CMD} "$QB_SERVICE" "$QB_PATH" $@
exit $?
#Check if kwalletd is enabled
${QB_CMD} "$QB_SERVICE" "$QB_PATH" reconfigure
QB_RESULT=$( ${QB_CMD} "$QB_SERVICE" "$QB_PATH" isEnabled 2>/dev/null || true)
if [[ "$QB_RESULT" != "true" ]]; then
echo "Error checking if kWallet service is activated. Cannot continue. Return of Check was:"
echo "$QB_RESULT"
exit 1
fi