-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtchrome
More file actions
executable file
·37 lines (33 loc) · 920 Bytes
/
Copy pathtchrome
File metadata and controls
executable file
·37 lines (33 loc) · 920 Bytes
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
#!/bin/bash
declare -r myname='tchrome'
declare -r myver='1.2'
usage() {
echo "$myname : Close Chrome browser including background, or launch a version of Google Chrome/Chromium"
echo "Usage : $myname [-hv]"
echo " -h/--help Display this text and exit"
echo " -v/--version Display version and exit"
echo "Configure Chrome version launched by $myname in /etc/${myname}.conf"
echo "Make it 'clickable' by putting tchrome.desktop a.k.a 'Toggle Chrome (tchrome)' on a launcher"
}
version() {
printf "%s %s\n" "$myname" "$myver"
}
if [ $# -gt 0 ]; then
case $1 in
-v|--version)
version; exit 0;;
-h|--help)
usage; exit 0;;
*)
usage; exit 1;;
esac
fi
source /etc/tchrome.conf #get tchromecommand
if pgrep chrome &>/dev/null
then
CHROME_WIN_IDs=$(wmctrl -l | grep "Google Chrome" | cut -f1 -d' ')
for i in $CHROME_WIN_IDs; do wmctrl -ic "$i"; done
pkill chrome
else
eval $tchromecommand
fi