You are not logged in.

#1 2015-10-21 22:14:01

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

i3lock is not being turned on with xautolock

Hello everyone.

Today i'm trying to find a solution for my small problem - i would like to use i3lock instead default one. I have always struggled when tried to properly setup i3lock and than do something in order it to autolock session in idle activity. I used xautlock but on plasa it just does not work, or i don't know how to do it.


I have installed
-xautolock
-i3lock

I created in ~/.config/autostart/i3lock.sh file and placed this:

#!/bin/bash

xautolock -time 1 -locker '/usr/bin/i3lock -c 111111' &

I did a chmod +x on i3lock.sh but after one minute in idle, it just does not lock session. Could somebody tell me what i did wrong here? I'm not asking about service files that should be in /etc/systemd/system because i do not ask about lock session after suspend/resume.

i3lock works with shortcut (i have ctrl+alt+b) and i see that it block with key combinations, but how to do this to automatically lock session? I tried to choose i3lock.sh with Plasma startup service in systemsettings but it does not work also. I did exacly the same thing that i always done for KDE4 but here i just cant set it.

Plase help.

Last edited by firekage (2015-10-26 21:25:25)

Offline

#2 2015-10-21 23:06:42

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: i3lock is not being turned on with xautolock

I don't use KDE, but according to the XDG specification, only .desktop files in $XDG_CONFIG_HOME/autostart are detected by whatever XDG-compliant environment is turning.


pkgs │ hacks │ cfg │ blag

Offline

#3 2015-10-26 16:58:34

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

Re: i3lock is not being turned on with xautolock

I added to .bashrc this:

/usr/bin/xautolock -time 1 -locker /usr/bin/i3lock -c 111111 &

Does not work.

I added something like this

[firekage@Arch_BX_100 /etc/systemd/system]$ cat i3lock_screenlocker.service 
[Unit]
Description=Lock the screen automatically after a timeout

[Service]
Type=simple
User=firekage
Environment=Display=:0
ExecStart=/usr/bin/xautolock -time 1 -locker /usr/bin/i3lock -c 111111

[Install]
WantedBy=graphical.target

[firekage@Arch_BX_100 /etc/systemd/system]$ 

to /etc/systemd/system/i3lock_screenlocker.service and it does not work at all. I rembember that i had once i3lock running fine, now i don't know where i should look for solution, what to change.



After many tries i found an solution to have working i3lock.

1. Firstly, create in /usr/lib file named, for an example, i3locker, so path sould be /usr/bin/i3locker

#!/bin/bash
i3lock -c 111111

2. The only one step to do is to edit ~/.bashrc and add

xautolock -time 1 -locker i3locker &

It works.

I tried to do many things based on Debian,. Manjaro, Ubuntu and so on - none of this works.  I tried to do a complete, in some way, copy of thread from our Arch forum with i3lock fancy setup based on systemd unit - also, does not work, maybe it works when all the things mentioned would be done but i just wanted to copy main unit file and check it with no i3lock from aur package or git, but default i3lock - does not work.

I don'kt know if my solution is a dirty workaround but it works.

Last edited by firekage (2015-10-26 18:14:21)

Offline

#4 2015-10-26 19:57:12

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: i3lock is not being turned on with xautolock

Well, .bashrc is definitely not the place to put these kinds of things, because it is sourced/executed each time you launch a new shell. I would personally put it into .xinitrc, but given that it's KDE, that probably won't work.

Again: a proper solution would be to create a .desktop file and putting it into share/autostart in $KDEHOME.


pkgs │ hacks │ cfg │ blag

Offline

#5 2015-10-26 21:14:41

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

Re: i3lock is not being turned on with xautolock

I created .desktop file and put it in ~/.config/autostart but it didn't work. Sorry for stupid question - i don't know where is $KDEHOME, i don't have it neutral I have ~/.kde4/share and in /share i have

apps  config  kde4

no autostart. Only in ~/.config/ i have /autostart but i placed a .desktop file and it did not work. This was my .desktop file in ~/.config/autostart

[Desktop Entry]
Type=Application
Exec=xautolock -time 1 -locker 'usr/bin/i3lock -c 111111' &
X-GNOME-Autostart-enabled=true
Name=i3lock

Last edited by firekage (2015-10-26 21:25:01)

Offline

#6 2015-10-26 21:38:38

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: i3lock is not being turned on with xautolock

What's the output of

echo $KDEHOME
echo $KDEDIR

?


pkgs │ hacks │ cfg │ blag

Offline

#7 2015-10-26 21:44:04

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

Re: i3lock is not being turned on with xautolock

1.

[firekage@Arch_BX_100 ~]$ echo $KDEHOME

[firekage@Arch_BX_100 ~]$ 

2.

[firekage@Arch_BX_100 ~]$ echo $KDEDIR

[firekage@Arch_BX_100 ~]$ 

Offline

#8 2015-10-26 22:15:33

bleach
Member
Registered: 2013-07-26
Posts: 264

Re: i3lock is not being turned on with xautolock

have you tried

    xautolock -time 1 -locker "/usr/bin/i3lock -c 111111"

    notice the syntax.

Last edited by bleach (2015-10-26 22:28:00)

Offline

#9 2015-10-26 22:23:10

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

Re: i3lock is not being turned on with xautolock

bleach wrote:

have you tried

xautolock -time 1 -locker "/usr/bin/i3lock -c 111111"

notice the syntax.

The syntax has "" in command. Yes i tried it with "" and with '' signs.  BTW, your command should be placed where?


I don't know if i did this time right, but i was able to do something like this, i created again file named i3lock.desktop and i put it in ~/.config/autostart:

[Desktop Entry]
Name=i3lock.desktop
Comment=i3lock desktop utility
Exec=xautolock -time 1 -locker i3locker
Type=Application
X-GNOME-Autostart-enabled=true
X-KDE-autostart-phase-1

As you can see, there is Exec=xautolock -time 1 -locker i3locker, and the "i3locker" is not a "i3lock" but i created in /usr/bin file called i3locker and put this there:

i3lock -c 111111 &

and this together works - still, don't know if this is dirty workaroud or ok solution.

Offline

#10 2015-10-26 22:28:17

bleach
Member
Registered: 2013-07-26
Posts: 264

Re: i3lock is not being turned on with xautolock

is not kde in ~/.kde/autostart

Last edited by bleach (2015-10-26 22:28:30)

Offline

#11 2015-10-26 22:31:42

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

Re: i3lock is not being turned on with xautolock

No, my working config that i created is in ~/.config/autostart.

Offline

#12 2015-10-26 22:38:55

bleach
Member
Registered: 2013-07-26
Posts: 264

Re: i3lock is not being turned on with xautolock

ok well the script works so I would say something is wrong there.

Offline

#13 2015-10-26 22:49:28

firekage
Member
From: Eastern Europe, Poland
Registered: 2013-06-30
Posts: 628

Re: i3lock is not being turned on with xautolock

There is no ./kde/autostart path with KF5 aka Plasma. You have ~/.config/autostart or ~/.kde4/ paths.

Offline

Board footer

Powered by FluxBB