linuxShortcuts/start-firefox.sh

45 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2022-10-07 11:40:50 +00:00
#!/bin/sh
isFirefoxRunning=$(pgrep --exact "firefox" -a | grep -v "OXO")
2023-06-23 13:10:17 +00:00
if [[ -z $isFirefoxRunning ]]
2022-10-07 11:40:50 +00:00
then
echo "Starting Firefox..."
/usr/lib/firefox/firefox >/dev/null 2>&1 &
notify-send "Opening Firefox, please wait..."
sleep 20
fi
2023-06-23 13:10:17 +00:00
mainFirefox=$(wmctrl -l | grep -v "TickTick" | grep -v "OXO|" | awk '/Mozilla Firefox/ { print $1 }')
TickTickFirefox=$(wmctrl -l | grep "TickTick" | grep -v "OXO|" | awk '/Mozilla Firefox/ { print $1 }')
2022-10-07 11:40:50 +00:00
echo "Main Firefox window id: $mainFirefox"
echo " TickTick FF window id: $TickTickFirefox"
# MONITOR
TOP_LEFT_MONITOR="0,1935,0,570,973"
TOP_RIGHT_MONITOR="0,2560,0,1280,1046"
TOP_LEFT_MONITOR_BORDER="0,1935,15,570,973"
TOP_RIGHT_MONITOR_BORDER="0,2540,15,1265,973"
2023-06-23 13:10:17 +00:00
if [[ -z $mainFirefox ]]
then
notify-send "Main Firefox not found"
else
for w in "$mainFirefox"
do
sleep 0.5
wmctrl -i -r "$w" -b remove,maximized_vert,maximized_horz
sleep 0.5
wmctrl -i -r "$w" -e $TOP_RIGHT_MONITOR_BORDER
done
fi
2022-10-07 11:40:50 +00:00
sleep 1
2023-06-23 13:10:17 +00:00
if [[ -z $TickTickFirefox ]]
then
notify-send "TickTick Firefox not found"
else
wmctrl -i -r "$TickTickFirefox" -b remove,maximized_vert,maximized_horz
wmctrl -i -r "$TickTickFirefox" -e $TOP_LEFT_MONITOR_BORDER
fi