You are not logged in.
Hi,
I want to run a command when my monitor wakes up from suspend/sleep mode. To be precise, I want to lock the screen. I thought that I could simply put
system("slock");
somewhere into the code and it would do the trick (in a quick and dirty way - but that's a temporary solution). The problem is, I'm not sure where to put it. I thought of xfpm_dpms_force_level procedure in xfpm-dpms.c, but it doesn't work. At least I think it doesn't - my screen didn't lock after waking up.
I need to mention, that I have no experience in C programming, so be gentle. I'm only hoping for a little tip and I'll try to investigate the rest on my own.
Thank you,
Tom
Offline
Hello and welcome.
What version of Xfce and xfce4-power-manager are you running?
I'm curious because slock is supported (or should be - see the contents of /usr/bin/xflock). Are you using something else for the screensaver/screen locker program in addition to slock?
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
are you writing new code in a new .c file or are you modifying existing code you got from somewhere (where? so we can also look at it)?
Offline
I'm running Fedora 30, which uses xfce4-power-manager-1.6.3. I'm trying to modify its code and recompile it.
I'm not using any xscreensaver daemon (or any other screensaver) because it seems that it doesn't communicate with Chrome and keeps blanking screen while playing youtube. I'm relying only on xfce power manager, because DPMS is working fine. Except that it doesn't lock the screen. So I thought it should be easier to modify power manager to run one more command than fix xscreensaver (or Chrome? I'm not sure what's causing the problem).
@ToZ You're right. xflock supports slock, but how to run it on screen wake?
Offline
On Fedora you can install light-locker and it adds a Security tab to the power manager settings. That tab has an option to lock the screen. It says when going to sleep but that has the same result you are asking for.
Offline
@ozjd Bad luck seems to stay with me Security tab appears just like you said. But light-locker crashes on unlocking:
...
[update_geometry] gs-window-x11.c:205 (11:34:08): using geometry for monitor 1: x=2560 y=0 w=1920 h=1200
[gs_window_move_resize_window] gs-window-x11.c:238 (11:34:08): Move and/or resize window on monitor 1: x=2560 y=0 w=1920 h=1200
[update_geometry] gs-window-x11.c:192 (11:34:08): got geometry for monitor 1: x=2560 y=0 w=1920 h=1200
[update_geometry] gs-window-x11.c:205 (11:34:08): using geometry for monitor 1: x=2560 y=0 w=1920 h=1200
[gs_window_move_resize_window] gs-window-x11.c:238 (11:34:08): Move and/or resize window on monitor 1: x=2560 y=0 w=1920 h=1200
[xroot_filter] gs-listener-x11.c:124 (11:36:06): ScreenSaver stopped
[listener_x11_blanking_changed_cb] gs-monitor.c:454 (11:36:06): Blanking changed: 0
[gs_manager_timed_switch] gs-manager.c:445 (11:36:06): Start switch to greeter timer
[gs_listener_send_signal_active_changed] gs-listener-dbus.c:309 (11:36:06): Sending the ActiveChanged(FALSE) signal on the session bus
[gs_listener_send_lock_session] gs-listener-dbus.c:180 (11:36:06): Send lock session
[listener_dbus_handle_system_message] gs-listener-dbus.c:1339 (11:36:06): obj_path=(null) interface=(null) method=(null) destination=:1.4516
[switch_greeter_timeout] gs-manager.c:430 (11:36:17): Switch to greeter timeout
[gs_listener_send_switch_greeter] gs-listener-dbus.c:139 (11:36:17): Send switch greeter
dbus[434]: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file ../../dbus/dbus-message.c line 1362.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)
But I think this might be the way to go. One more thing (it's getting a bit off-topic, but maybe someone will find it useful). Filezilla is preventing screen blanking during file transfer. A bit strange.
Offline
The only thing I notice is mention of a screensaver. I don't use a screensaver and don't even have one installed. Do you use lighdm to log in? It is the default with Fedora Xfce.
Offline
I use sddm, because I switched to Xfce from Plasma. I'll change to lightdm as soon as I can to see if there's a difference.
I also don't use any screensaver. The only thing I'm interested in is locking screen after or before going to DPMS sleep state.
Offline
Is "Lock screen before sleep" selected in Settings Manager > Session and Startup > General tab? Or:
xfconf-query -c xfce4-session -lv | grep -i lock
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
No, it is not selected. I thought it relates to suspending/sleeping computer, not display. I'll turn it on and give it a go.
Offline
I use sddm, because I switched to Xfce from Plasma. I'll change to lightdm as soon as I can to see if there's a difference.
I also don't use any screensaver. The only thing I'm interested in is locking screen after or before going to DPMS sleep state.
There is a mention in the error message of 'Screensaver stopped'. I guess that could mean it was running the locking stopped it or that it wasn't running and the system was checking for it.
Offline
Great news! After switching to lightdm and installing lightlocker, everything works Thank you all for your help.
Last edited by tomek (2019-07-30 14:14:00)
Offline
i don't have that problem. here's why.
i make use of lightdm's ability to allow multiple users to be logged in on the console concurrently. i typically have about 10 different users logged it at the same time. different ones are used for different purposes. they are all members of the nopasswdlogin group (in /etc/group) so i can switch between them rapidly. one of these users is dedicated to watching videos. that user has the screen blanking disabled. so i can just sit there and watch anything there for hours (i have done that before for an NRK train ride from Bergen to Oslo). maybe you don't need as much as i do, but you could do just one dedicated user for videos. the way to switch user without logging out isthe command "dmtool switch-to-user <username>". i have a scripted command "stu <username>" that does it. i have desktop icons to do that, one for each user. i also have a few keyboard shortcuts to jump between users. Alt+F takes me to the forums user. Alt+V takes me to the videos user. Alt+A takes me to the admin user which can sudo to root privileges.
Last edited by Skaperen (2019-07-31 06:02:34)
Offline
[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 588.41 KiB (Peak: 605.26 KiB) ]