This forum has been archived. All content is frozen. Please use KDE Discuss instead.

how to detect lockscreen is actived?

Tags: None
(comma "," separated)
flwwater
Registered Member
Posts
1
Karma
0
hi,everyone:
my OS: kubuntu 20.04
my Qt: 5.12

I very like video wallpaer(QML language), so i install it. everything is ok,but when lockscreen is actived, video cannot auto pause.(my media contain audio,because audio still playing)

so i want to modify some code of videowallpaper.

i encount a problem that how to receive signal from lockscreen event?
i research several days and no solution found.
now i want to monitor process named "kscreenlocker_greet".
but I don't know whick QML component can be use to monitor process ?
I try use "import QtApplicationManager 1.0" but qtcreator says : module "QtApplicationManager" is not installed,I don't know which package should i install whit "sudo apt-get".
If there is no way to solve this problem,Is there any component provide by KDE-framework ?
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
You can use the dbus-methods provided by either ksmserver or freedesktop.org:
Code: Select all
qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver GetActive

which also provides a signal called «ActiveChanged» you can listen on with DBus-monitor.
QML does not provide a dbus-method afair, but you can use a c++ approach or a system call via exec.

Another way would be to use systemd-inhibit to disable the screensaver while your media-stuff is running.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]