-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-firefox.sh
executable file
·44 lines (38 loc) · 1.22 KB
/
start-firefox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
isFirefoxRunning=$(pgrep --exact "firefox" -a | grep -v "OXO")
if [[ -z $isFirefoxRunning ]]
then
echo "Starting Firefox..."
/usr/lib/firefox/firefox >/dev/null 2>&1 &
notify-send "Opening Firefox, please wait..."
sleep 20
fi
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 }')
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"
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
sleep 1
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