You are not logged in.

#51 2011-06-01 14:58:00

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

X-dark wrote:

Same as standby: blank both and then unblank secondary.

Well, I start to think that if nobody else is able to reproduce the behavior I get, maybe there is a problem somewhere else on my side.

Well, if I were to include an option in slimlock to set the power off timeout, I think it would work for you. It seems to be your second screen doesn't like any other power states.
Would you want me to give that a shot? I'm about to go now, but when I get a chance it would only take a minute or two to implement.

Offline

#52 2011-06-01 15:33:47

X-dark
Member
From: France
Registered: 2009-10-25
Posts: 135
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

I tried something like this:

diff --git a/cfg.cpp b/cfg.cpp
index 034ca73..9d5606d 100644
--- a/cfg.cpp
+++ b/cfg.cpp
@@ -87,7 +87,8 @@ Cfg::Cfg()
     options.insert(option("msg_shadow_color","#FFFFFF"));
 
     // slimlock-specific options
-    options.insert(option("dpms_timeout", "60"));
+    options.insert(option("dpms_standby_timeout", "60"));
+    options.insert(option("dpms_off_timeout", "120"));
     options.insert(option("wrong_passwd_timeout", "2"));
 
     error = "";
diff --git a/slimlock.cpp b/slimlock.cpp
index bae61f6..243195d 100644
--- a/slimlock.cpp
+++ b/slimlock.cpp
@@ -76,7 +76,8 @@ int main(int argc, char **argv) {
 
     CARD16 dpms_standby, dpms_suspend, dpms_off, dpms_level;
     BOOL dpms_state, using_dpms;
-    unsigned int cfg_dpms_timeout;
+    unsigned int cfg_dpms_standby_timeout;
+    unsigned int cfg_dpms_off_timeout;
 
     unsigned int cfg_passwd_timeout;
     // Read current user's theme
@@ -149,12 +150,13 @@ int main(int argc, char **argv) {
     bool panelClosed = true;
 
     // Set up DPMS
-    cfg_dpms_timeout = Cfg::string2int(cfg->getOption("dpms_timeout").c_str());
-    using_dpms = DPMSCapable(dpy) && (cfg_dpms_timeout > 0);
+    cfg_dpms_standby_timeout = Cfg::string2int(cfg->getOption("dpms_standby_timeout").c_str());
+    cfg_dpms_off_timeout = Cfg::string2int(cfg->getOption("dpms_off_timeout").c_str());
+    using_dpms = DPMSCapable(dpy) && (cfg_dpms_standby_timeout > 0) && (cfg_dpms_off_timeout > 0);
     if (using_dpms) {
         DPMSGetTimeouts(dpy, &dpms_standby, &dpms_suspend, &dpms_off);
-        DPMSSetTimeouts(dpy, cfg_dpms_timeout,
-                        dpms_suspend, dpms_off);
+        DPMSSetTimeouts(dpy, cfg_dpms_standby_timeout,
+                        dpms_suspend, cfg_dpms_off_timeout);
     
         DPMSInfo(dpy, &dpms_level, &dpms_state);
         if (!dpms_state)

But now it does not blank at all.


Cedric Girard

Offline

#53 2011-06-01 15:56:10

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

X-dark wrote:

I tried something like this:

But now it does not blank at all.

My guess is that it's because for it to work, standby <= suspend <= off. Try replacing

DPMSSetTimeouts(dpy, cfg_dpms_standby_timeout,
                        dpms_suspend, cfg_dpms_off_timeout);

with:

DPMSSetTimeouts(dpy, cfg_dpms_standby_timeout,
                        cfg_dpms_standby_timeout, cfg_dpms_off_timeout);

If that doesn't work, I'll have to take another look later. It looks right, though.

Offline

#54 2011-06-01 16:00:25

X-dark
Member
From: France
Registered: 2009-10-25
Posts: 135
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

You were right. It is now working. Thanks.


Cedric Girard

Offline

#55 2011-06-01 16:03:05

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

X-dark wrote:

You were right. It is now working. Thanks.

Oh, thank god. Good to hear.

When I get back, I'll push your changes to github. And I'll have to update slimlock.conf.

Offline

#56 2011-06-01 19:49:44

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Alright, slimlock-git now has support for turning the monitor off. I figured a reasonable default is ten minutes.
X-dark, obviously, since that's the only thing that works for you, you'll want a much smaller value. But I figure since suspend works for most everyone else, no need to power down the monitor that soon.

Also, the README.md has been updated with information about the configuration settings. Nothing I haven't covered in this thread, though.

Offline

#57 2011-06-05 13:45:36

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

After some tinkering, slimlock now uses PAM for authentication. This shouldn't matter for most users, but it should mean that slimlock is now portable to the BSDs without any hassle.

Also, there's new configuration options for feedback on entering an incorrect password: passwd_feedback_x and passwd_feedback_y control the relative positioning of the message, and passwd_feedback_msg is the message displayed.
One known bug is that the message is redrawn on top of itself on each failed attempt, introducing visual artifacts. Should be fixed soon.

Okay, so let me know if you encounter any issues.

Offline

#58 2011-06-05 15:44:29

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Hi Guff!

"slimlock& slimlock" is opening two instances again. Can you confirm this?

Offline

#59 2011-06-05 15:49:45

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Liquen wrote:

Hi Guff!

"slimlock& slimlock" is opening two instances again. Can you confirm this?

Yeah. Crap.

Alright, for everyone else I'd recommend against upgrading for now.

Offline

#60 2011-06-05 16:14:04

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Okay, I think I fixed the multiple instance thing. Anyone care to test?

Offline

#61 2011-06-05 19:35:42

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Fixed. Thanks!

Offline

#62 2011-06-05 20:04:42

Jelle
Member
From: Netherlands
Registered: 2011-01-30
Posts: 84

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Thanks Guff! Works and looks great :-)

Offline

#63 2011-06-05 21:12:07

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Would it be possible to also parse the halt/reboot/suspend options from slim.conf so that it can function as a session manager? I understand that this would pose a problem since slimlock only has a password field now, but maybe there is something simple and smart to do in this regard?


ᶘ ᵒᴥᵒᶅ

Offline

#64 2011-06-06 00:17:44

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

litemotiv wrote:

Would it be possible to also parse the halt/reboot/suspend options from slim.conf so that it can function as a session manager? I understand that this would pose a problem since slimlock only has a password field now, but maybe there is something simple and smart to do in this regard?

Hmm. That might maybe be outside the scope of slimlock, but it's somewhat intriguing.

Shutdown/reboot would be harder to do now I think, as slimlock is no longer setuid root. Could maybe use something like consolekit, but that would pull in another dependency. I dunno if there's a better way to shutdown without root privileges (and without having the user modify sudoers).

As for the lack of the user field, I figure it could make use of function keys to select what you want to do. Like, F1 would cycle forward through unlock/halt/reboot/suspend, F2 would cycle backwards.

I'll think about it. Suggestions/recommendations regarding this (or anything else) are welcome.

Also, thanks for the kind words guys.

Last edited by Guff (2011-06-06 00:18:28)

Offline

#65 2011-06-06 00:19:39

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Can anyone reproduce the following unwanted behavior:

(Warning: After the steps I had to reboot my computer to get rid of the effect.)

  1. (Optional step) Edit /etc/slimlock.conf and set dpms_standby_timeout to a low value (e.g., 5).

  2. Execute slimlock.

  3. Switch to a text terminal (ctrl-alt-F1) and killall slimlock.

  4. Now the screen will keep blanking every dpms_standby_timeout seconds without mouse/keyboard activity, even though slimlock is not running anymore.

I suspect this has something to do with the handling of SIGTERM by slimlock. I'm wondering what if slimlock receives SIGKILL. How to get rid of the countdown timer for DPMS standby?

Offline

#66 2011-06-06 00:44:10

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Liquen wrote:

Can anyone reproduce the following unwanted behavior:

(Warning: After the steps I had to reboot my computer to get rid of the effect.)

  1. (Optional step) Edit /etc/slimlock.conf and set dpms_standby_timeout to a low value (e.g., 5).

  2. Execute slimlock.

  3. Switch to a text terminal (ctrl-alt-F1) and killall slimlock.

  4. Now the screen will keep blanking every dpms_standby_timeout seconds without mouse/keyboard activity, even though slimlock is not running anymore.

I suspect this has something to do with the handling of SIGTERM by slimlock. I'm wondering what if slimlock receives SIGKILL. How to get rid of the countdown timer for DPMS standby?

Yeah, killing slimlock doesn't give it a chance to restore your previous DPMS settings.

FYI, instead of restarting, you could just use xset to get your DPMS settings back to normal, whatever that may be. For example, to disable DPMS altogether, I think

xset -dpms

should work.

I'll whip something up to deal with this issue in a little bit.

Offline

#67 2011-06-06 06:59:42

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Guff wrote:

Hmm. That might maybe be outside the scope of slimlock, but it's somewhat intriguing.

Shutdown/reboot would be harder to do now I think, as slimlock is no longer setuid root. Could maybe use something like consolekit, but that would pull in another dependency. I dunno if there's a better way to shutdown without root privileges (and without having the user modify sudoers).

As for the lack of the user field, I figure it could make use of function keys to select what you want to do. Like, F1 would cycle forward through unlock/halt/reboot/suspend, F2 would cycle backwards.

I'll think about it. Suggestions/recommendations regarding this (or anything else) are welcome.

Also, thanks for the kind words guys.

Hmm, thinking about this, it might actually be more sensible to fork Slim and extend it with a screenlock function instead?


ᶘ ᵒᴥᵒᶅ

Offline

#68 2011-06-06 14:29:07

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

litemotiv wrote:

Hmm, thinking about this, it might actually be more sensible to fork Slim and extend it with a screenlock function instead?

Maybe. In fact, SLiM has a preview function built in for displaying themes. Modifying that would likely be the easiest route, as it already handles authentication.

I don't see myself doing this, however, as I'm quite satisfied with slimlock. Plus, slimlock is quite a bit simpler than Slim. I'm not sure I would have an adequate understanding of Slim as a whole.

Also, Liquen:
I spent quite a while trying to fix that problem, but for some reason the DPMS functions just aren't working from the signal handler function. For the life of me, I can't figure out why. Unfortunately, I don't expect a fix anytime soon. I just can't figure it out; what it's doing should work.

Offline

#69 2011-06-08 16:04:20

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Okay, well, I've consolidated the two windows into one. This was done in the hope of eliminating any remaining focus issues, which, according to Joel, it seems to have done.

Previously, it had been using separate windows for the panel and background. This was slightly silly as that meant it had to render the background, then get the background image again, get the panel image, merge the panel image onto the background image, then position the result over the background window. And now, there's only one window competing for the keyboard, so hopefully that will help. I'll leave the lock file code in there as a precaution, though.

If anyone has any problems, let me know. And, let me apologize for the plethora of problems thus far.

Offline

#70 2011-06-08 19:34:40

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Hi, Guff.

Input locking is working great! It would be nice if this feature was merged into SLiM as well... wink

Also, is there a way to omit the "Welcome to <hostname>" and "User: <username>" messages?

Offline

#71 2011-06-08 20:09:25

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Liquen wrote:

Hi, Guff.

Input locking is working great! It would be nice if this feature was merged into SLiM as well... wink

Also, is there a way to omit the "Welcome to <hostname>" and "User: <username>" messages?

Thanks.

In slim.conf, find the line with welcome_msg and just delete everything after that part of the line. Don't delete the whole line, because then it will just default to the same thing.

As for the username bit, I just (several minutes ago) made it so that only shows on themes with a single input box. And since you asked, I just added an option to hide the username message. Just set show_username to 0 in slimlock.conf.

Interestingly, until I merged the two windows, the welcome message and username message were both hidden from me. As I use a netbook, my screen is tiny, so the messages were covered by the panel. This change means the text is now on top, so it suddenly became visible for me. And presumably, anyone else with a smallish screen.

Let me know if there are any issues.

Offline

#72 2011-06-08 20:40:00

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Thank you for the instructions on slim.conf and for implementing the new option on slimlock.conf. Everything perfectly fits my needs now.

Guff wrote:

Interestingly, until I merged the two windows, the welcome message and username message were both hidden from me. As I use a netbook, my screen is tiny, so the messages were covered by the panel. This change means the text is now on top, so it suddenly became visible for me. And presumably, anyone else with a smallish screen.

I guess this also happened to me, then.

Offline

#73 2011-06-09 02:59:25

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Guff wrote:

I spent quite a while trying to fix that problem, but for some reason the DPMS functions just aren't working from the signal handler function. For the life of me, I can't figure out why. Unfortunately, I don't expect a fix anytime soon. I just can't figure it out; what it's doing should work.

I apparently was able to solve this issue using something based on this code: Slimlock could catch SIGTERM and terminate in a clean fashion. I would send you some patch, but my code is a mess (I just duplicated the "//Get DPMS stuff back to normal" lines and set some variables to global---argh). Anyway, let me know if you are interested.

Offline

#74 2011-06-09 03:23:39

Guff
Member
Registered: 2009-09-30
Posts: 158
Website

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

Liquen wrote:

I apparently was able to solve this issue using something based on this code: Slimlock could catch SIGTERM and terminate in a clean fashion. I would send you some patch, but my code is a mess (I just duplicated the "//Get DPMS stuff back to normal" lines and set some variables to global---argh). Anyway, let me know if you are interested.

That sounds like what I tried, but yeah, didn't work.

Actually, I would like to see your code, I guess. I may have missed something.

Offline

#75 2011-06-09 04:15:04

Liquen
Member
Registered: 2009-01-04
Posts: 40

Re: Slimlock - fairly simple X screenlocker that looks like SLiM

There you are: http://pastebin.com/jck641C8

As I told you, it's ugly code (duplicated lines, global variables). But I'm sure it can be enhanced.

And, of course, this just works with SIGTERM (killall slimlock), since SIGKILL (killall -9 slimlock) can not be caught.

Offline

Board footer

Powered by FluxBB