Accessing the KDE Wallet from the command line kde 5 version


I was trying to read some password ON KDE5 from google-chrome through kwallet and it was a bit a pain with qdbusviewer , actually i can’t get it right now,but i found  luckly an old blog entry for kwallet 4 so … here it is a simply scheme to create write and read password for my silly application kde-service-menu-nowardev-scanner

#create a wallet folder kde-service-menu-storage
qdbus org.kde.kwalletd5 /modules/kwalletd5 createFolder "$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.open kdewallet 0 "kde-service-menu-nowardev-scanner")" "kde-service-menu-storage" "kde-service-menu-nowardev-scanner" 
#write an entry for password 
qdbus org.kde.kwalletd5 /modules/kwalletd5 writeEntry "$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.open kdewallet 0 "kde-service-menu-nowardev-scanner")" "kde-service-menu-storage" "mymail@gmail.com" test 1 "kde-service-menu-nowardev-scanner" 
#write the pasword
qdbus org.kde.kwalletd5 /modules/kwalletd5 writePassword "$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.open kdewallet 0 "kde-service-menu-nowardev-scanner")" "kde-service-menu-storage" "mymail@gmail.com" "silly" "kde-service-menu-nowardev-scanner"
#list the folders
 qdbus org.kde.kwalletd5 /modules/kwalletd5 folderList "$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.open kdewallet 0 "kde-service-menu-nowardev-scanner")" "kde-service-menu-nowardev-scanner"
#read the entry
qdbus org.kde.kwalletd5 /modules/kwalletd5 entryList "$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.open kdewallet 0 "kde-service-menu-nowardev-scanner")" "kde-service-menu-storage" "kde-service-menu-nowardev-scanner"
#read the password 
 qdbus org.kde.kwalletd5 /modules/kwalletd5 readPassword "$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.open kdewallet 0 "kde-service-menu-nowardev-scanner")" "kde-service-menu-storage" "mymail@gmail.com" "kde-service-menu-nowardev-scanner"
Advertisements

sleep reboot shutdown from terminal


add these lines to bashrc

ksleep(){
dbus-send --print-reply --dest='org.freedesktop.PowerManagement' /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend
}

kshutdown(){
qdbus org.kde.ksmserver /KSMServer logout 0 2 0

}

kreboot(){
qdbus org.kde.ksmserver /KSMServer logout 0 1 0
}

then do

source ~/.bashrc in your terminal … now you have :

kreboot kshutdown and ksleep commands

how to set a shortcut to open the k menu?


the standard launcher doesn’t allow to use qdbus to show itself , but it allows to set a shortcut

but if you plan yo use this in a script you could try to use this:

xdotool key alt+F1

the only way to get something of similar to what you have done with dcop it’s this : using lancelot laucher and creating a shortcuts with this command

qdbus org.kde.lancelot /Lancelot show 0 0

or

qdbus org.kde.lancelot /MainApplication org.kde.lancelot.App.show 0 0