You are not logged in.

#1 2012-09-24 19:44:52

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

xautolock makes laptop suspend twice

Hello,

i want my laptop to suspend after a certain time without user interaction, so i used the following xautolock command.
xautolock -time 20 -locker "systemctl suspend"
This leads to another suspend after manual suspend using the lid switch, because xautlock is triggered immediatly after waking up.
Obviously the time of 20 minutes has passed while the laptop was suspended and xautolock did not reset the timer.
Killall xautolock solves the issue, that means i will not use it. I wonder if there is an alternative solution.

Last edited by teateawhy (2012-09-24 19:46:47)

Offline

#2 2012-09-24 19:58:40

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: xautolock makes laptop suspend twice

Kill xautolock before lid suspend, restart it after lid resume.

Offline

#3 2012-09-24 22:14:24

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: xautolock makes laptop suspend twice

If i use
xautolock -exit
to stop xautolock before lid suspend, it does not change anything. What i have done so far is writing a script and a service file, but to no avail.
This is what i put in /usr/lib/systemd/system-sleep/xautolock-toggle.sh

#!/bin/bash
case "$1" in
  pre )
    xautolock -exit
    ;;
  post )
     xautolock -time 20 -locker "systemctl suspend"
    ;;
esac

Offline

#4 2012-10-28 23:07:38

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: xautolock makes laptop suspend twice

This was not an issue for me until recently when I made a fresh install on a new drive.  In fact, at first it was working as before.  But over the last couple of days it had started to suspend again when I opened my laptop lid. 

So presumably (I didn't check my logs or anything), it was suspending when I closed the lid, as it should.  But then when I opened the lid, xautolock would say, "Hey! Look how long it has been!  We need to be suspending, like right now!"

So I checked out the man page of xautolock, and sure enough, the author had already thought of this. 

 -detectsleep    Instructs xautolock to detect that computer has been put to sleep.  This is done by detecting that time has jumped by more than 3 seconds.  When  this  occurs,  the
                       lock  timer  is  reset  and  locker  program  is  not launched even if primary timeout has been reached. This option is typically used to avoid locker program to be
                       launched when awaking a laptop computer.

So after appending that flag to the end of my command, all is well!

I hope this might help you teateawhy.

Offline

#5 2012-10-29 19:52:45

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: xautolock makes laptop suspend twice

Thank you!!!

wonderwoofy wrote:

xautolock would say, "Hey! Look how long it has been!  We need to be suspending, like right now!"

I think you got the tone wrong :-P "No user activity detected on X Window display :0. Executing locker immedia--..."
Testing if it works right now.
EDIT: It works big_smile

Last edited by teateawhy (2012-10-29 20:59:59)

Offline

#6 2012-10-30 00:17:44

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: xautolock makes laptop suspend twice

Hey that is fantastic!  Yyou may be right about the tone... I really can't imagine xautolock being an excitable type of application.  I mean, it is not like (s)he is even multi-tallented or anything.

Edit: BTW, don't forget to mark as solved.

Last edited by WonderWoofy (2012-10-30 00:18:06)

Offline

#7 2012-10-30 03:27:25

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: xautolock makes laptop suspend twice

Are you two really discussing the personality of an application? smile I'll have to check h{er,im} out, maybe we'll get along, I'm not very excitable either.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB