top of page
Writer's pictureIGEL Community

Custom Firefox Refresher for IGEL Community

Written by Milan Potrok , IGEL COMMUNITY MEMBER OF THE YEAR

Introduction

In the IGEL community, optimizing user experience and efficiency is always a priority. One common need among users is the ability to refresh their Firefox browser automatically. Today, we are introducing a custom application that does just that: the Custom Firefox Refresher. This script ensures your Firefox browser refreshes at regular intervals, improving performance and ensuring you always have the latest content displayed.


Overview of Custom Firefox Refresher

The Custom Firefox Refresher is designed as a user-friendly custom application that runs on IGEL OS. It can be executed from a desktop shortcut or by using the hotkey "Ctrl-Alt-Shift q". The script includes a visual progress bar that shows the next refresh time, which can be disabled if not needed. This tool is particularly useful for environments where Firefox is used extensively and needs to remain updated and responsive.


Features

  • Refresh Interval: The script allows you to set the refresh interval through the FFRefreshSecs variable. The default is set to 300 seconds (5 minutes), but this can be customized to suit your needs.

  • Progress Bar: By default, a visual progress bar is displayed to indicate the time remaining until the next refresh. This can be turned off by setting the FFRefreshProgressbar variable to false.

  • Verbose Logging: For debugging purposes, verbose logging can be enabled by setting the FFRefreshDEBUG variable to true. This logs detailed messages in the system log (journalctl).


Implementation

To implement this custom application, follow the steps below:

  1. UMS Dynamic Variable Settings: Configure the necessary environment variables in the IGEL Universal Management Suite (UMS).

  • Variable name: FFRefreshSecs

  • Variable value: 300

  • Variable name: FFRefreshProgressbar

  • Variable value: true

  • Variable name: FFRefreshDEBUG

  • Variable value: false

  1. Script with Comments:

# DEBUG
DEBUG=${FFRefreshDEBUG:-false};  # when true, enables verbose logging (set from env variable or default)
if [ ."${DEBUG}". = .true. ]; then set -x; fi;   # set verbose logging - lots of messages in syslog
set -u;     # do not allow use of unset variables
# V0.2: With comments
VER=0.2;
# Variables
T="custom-firefox-refresher-v${VER}-ca";    # title for logging purposes
LOGIT="logger -it ${T}";
REFRESH_SECS=${FFRefreshSecs:-300};    # refresh interval in seconds: get from environmental variable, or if not found set to 300 seconds
if ! [ "${REFRESH_SECS}" -ge 5 ]; then REFRESH_SECS=300; fi;    # check that it's an integer >= 5 (seconds)
# Use visible countdown progress bar, or silent:  unless environmental variable is set to NON-true, then use "yad" for visible progress bar
if [ ."${FFRefreshProgressbar:-true}". = .true. ]; then
	WAIT="yad --timeout ${REFRESH_SECS} --geometry=+0+0  --timeout-indicator=top --no-buttons --no-escape --fixed --on-top --undecorated --skip-taskbar --no-focus";
else
	WAIT="sleep ${REFRESH_SECS}";
fi;
# iteration counter
i=0;
# loop until firefox closed
while true; do
	i=$((i+1));
	if ! xdotool search --onlyvisible firefox windowfocus 2> /dev/null; then
		${LOGIT} "visible firefox window not found, exiting custom app, iteration=${i}";
		exit 0;    # exit if firefox not running
	fi;

xdotool search --onlyvisible firefox key F5 2> /dev/null;
CODE=$?;
if [ ".${DEBUG}." = .true. ]; then ${LOGIT} "attempted firefox refresh via F5 key: returncode=${CODE}, iteration=${i}, REFRESH_SECS=${REFRESH_SECS}"; fi;
${WAIT};  # wait for next iteration
done;

Script Ready for Use: The script, ready to be copied and pasted into a custom application:

DEBUG=${FFRefreshDEBUG:-false}; if [ ."${DEBUG}". = .true. ]; then set -x; fi; set -u; VER=0.2; T="custom-firefox-refresher-v${VER}-ca"; LOGIT="logger -it ${T}"; REFRESH_SECS=${FFRefreshSecs:-300}; if ! [ "${REFRESH_SECS}" -ge 5 ]; then REFRESH_SECS=300; fi; if [ ."${FFRefreshProgressbar:-true}". = .true. ]; then WAIT="yad --timeout ${REFRESH_SECS} --geometry=+0+0  --timeout-indicator=top --no-buttons --no-escape --fixed --on-top --undecorated --skip-taskbar --no-focus"; else WAIT="sleep ${REFRESH_SECS}"; fi; i=0; while true; do i=$((i+1)); if ! xdotool search --onlyvisible firefox windowfocus 2> /dev/null; then ${LOGIT} "visible firefox window not found, exiting custom app, iteration=${i}"; exit 0; fi; xdotool search --onlyvisible firefox key F5 2> /dev/null; CODE=$?; if [ ".${DEBUG}." = .true. ]; then ${LOGIT} "attempted firefox refresh via F5 key: returncode=${CODE}, iteration=${i}, REFRESH_SECS=${REFRESH_SECS}"; fi; ${WAIT}; done;




Conclusion

The Custom Firefox Refresher script is a powerful tool for maintaining optimal performance and up-to-date content in your Firefox browser on IGEL OS. By following the steps outlined above, you can easily implement this solution in your environment. If you have any questions or need further assistance, please do not hesitate to reach out to the IGEL community.

We hope you find this tool useful and look forward to your feedback!


Disclaimer


The content of this post is provided without any warranty or support by IGEL Technology. This information is derived from the IGEL Community, and not IGEL Technology. IGEL Technology will not provide any packages, instructions, or support for processes, scripts, or other content contained in this post. Use at your own risk!



Hope it works well, please let me know if you have some questions or comments!


Comentários


bottom of page