closing automatically firefox after 3 or 5 minutes of inactivity

Hello, fellowship of Suse !

uname -ar
Linux localhost.localdomain 5.3.18-57-default #1 SMP Wed Apr 28 10:54:41 UTC 2021 (ba3c2e9) x86_64 x86_64 x86_64 GNU/Linux

i wish to find solutions for : closing automatically firefox after 3 or 5 minutes of inactivity of session or surfing with firefox.

Do you know tips, or line command, or script for that ? and launch automatically at boot ?

Thanks !

As you use Firefox, you use a desktop environment. But you fail to explain which one (KDE, Gnome, …).

I use KDE and Lxde opensuse leap 15.3

And closes Firefox in both DEs?

Whatever desktop environment…

I mean the solution should not depend on desktop environment…:sarcastic:

Detecting if Firefox is idling is best and easiest done from the context of Firefox but I can not find a Extension to do that.

You could try the last post from this page you could try on use “sudo zypper in xautoloack” instead of “sudo apt-get install xautolock”

What is the reason you like it to shut down automatically?

Because i use commercial vpn, and it disconnect : disconnection occurs of vpn because : killswitch option often do not working…:X

It works well : now integrated at boot in /etc/init.d/xautolock.sh

Thanks !

Thanks, good to hear it helped.

I see you have another thread on this, I think the better solution is to block network access if the VPN goes down, but let’s use the other thread for that.

Hello,

On one machine, it works well, but : on 2 linux opensuse machine, script xautolock.sh does not work :X :


zypper install xautolock


cat xautolock.sh 
#!/bin/bash

xautolock -notify 10 -notifier 'notify-send -i firefox "Firefox will close in 10 seconds"' -time 1 -locker "pkill firefox"

./xautolock.sh
Couldn't connect to 

xautolock -notify 10 -notifier 'notify-send -i firefox "Firefox will close in 10 seconds"' -time 10 -locker "pkill firefox"
Couldn't connect to 



Any idea ?:sarcastic:

Resolved : curiously, script launched :

./xautolock.sh

only works by local terminal not working on remote terminal machine !:sarcastic:

Thanks to all !

Hello,

I wish to launch the script

#!/bin/bash
xautolock -notify 10 -notifier 'notify-send -i firefox "Firefox will close in 10 seconds"' -time 1 -locker "pkill firefox

at boot as service automatically; this tutorial is interesting, but a little bit short …:expressionless:

https://www.suse.com/support/kb/doc/?id=000019672

Do you have advises or links more documented ?

Thanks !

For posting a link, use the Globe icon that says Link when hovered over (not the HTML tags):
https://www.suse.com/support/kb/doc/?id=000019672

Hi,

Did you at least tried that instruction on that link? It should get you started. You can examine the logs later if and when there are issued/problems. Also the documentation is available at the man pages, systemd(1) and systemd.unit(5) You could start with

man 1 systemd

At the bottom the section has some more links to the man pages

SEE ALSO 

For configuring the unit files see.

man 5 systemd.unit