mirror of
https://github.com/woodchen-ink/docker-firefox.git
synced 2025-07-18 13:52:02 +08:00
Improved graceful shutdown of Firefox:
- By default, disable confirmation when quitting using the ctrl+q shortcut. - Wait for Firefox to quit after sending ctrl+q key presses.
This commit is contained in:
parent
9e679b45a8
commit
e1d32c30f2
@ -2,3 +2,6 @@
|
|||||||
user_pref("toolkit.telemetry.reportingpolicy.firstRun", false);
|
user_pref("toolkit.telemetry.reportingpolicy.firstRun", false);
|
||||||
// Prevent closing Firefox when closing the last tab.
|
// Prevent closing Firefox when closing the last tab.
|
||||||
user_pref("browser.tabs.closeWindowWithLastTab", false);
|
user_pref("browser.tabs.closeWindowWithLastTab", false);
|
||||||
|
// Disable confirmation before quitting with Ctrl+Q. Needed to allow Firefox
|
||||||
|
// to quit cleanly when container is shutted down.
|
||||||
|
user_pref("browser.warnOnQuitShortcut", false);
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# When receiving SIGTERM, Firefox doesn't qui immediately and instead ask for
|
# Firefox doesn't gracefully shutdown when receiving SIGTERM. For example, last
|
||||||
# confirmation. Instead, terminate Firefox by sending the CTRL+q key presses.
|
# opened tabs may not be saved. Instead, terminate Firefox by sending the
|
||||||
|
# CTRL+q key presses.
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e # Exit immediately if a command exits with a non-zero status.
|
set -e # Exit immediately if a command exits with a non-zero status.
|
||||||
set -u # Treat unset variables as an error.
|
set -u # Treat unset variables as an error.
|
||||||
|
|
||||||
xdotool key "Escape"
|
xdotool key "Escape"
|
||||||
|
sleep 0.5
|
||||||
xdotool key "ctrl+q"
|
xdotool key "ctrl+q"
|
||||||
|
|
||||||
|
for i in $(seq 1 10)
|
||||||
|
do
|
||||||
|
if ! ps | grep "/usr/lib/firefox/firefox" | grep -q -v grep
|
||||||
|
then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
|
||||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user