-- Leo's gemini proxy

-- Connecting to republic.circumlunar.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Gracefully shutting down Firefox, to avoid the crash/session dialog


I normally have several Firefox profiles open, and when I log out without closing the Firefox windows I get the "session restore" dialog on my next login.


This is because of Bug 336193 which says that Firefox should shut down gracefully when it receives a SIGTERM signal, which is what happens when I log out (in Ubuntu MATE anyway). At the moment, it shuts down ungracefully, meaning it is treated as if Firefox crashed when it restarts.


Bug 336193


So, instead of my normal shutdown button, I have one that launches a script that closes all my Firefoxes first, like this:


#!/bin/bash

# Prerequisites:
# sudo apt-get install sysvinit-utils xdotool

set -x
set -u

function close_firefoxes()
{
   local PID
   local WID

   PID=$(pidof -s firefox)
   FOUND=$?

   while [ $FOUND ]; do
   {
       WID=$(xdotool search --pid "$PID" | tail -1)
       xdotool windowactivate --sync "$WID"
       xdotool key --clearmodifiers 'ctrl+q'
       sleep 1
       PID=$(pidof firefox)
       FOUND=$?
   }; done
}

close_firefoxes

mate-session-save --shutdown-dialog


Originally posted at 2016-06-16 11:47:22+00:00. Automatically generated from the original post : apologies for the errors introduced.


original post

-- Response ended

-- Page fetched on Sun May 19 03:48:56 2024