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/

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.


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

zypper install xautolock


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

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 :


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

Thanks to all !


I wish to launch the script

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:

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):


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


For configuring the unit files see.

man 5 systemd.unit