-
Notifications
You must be signed in to change notification settings - Fork 9
/
watch
43 lines (36 loc) · 1.04 KB
/
watch
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
#!/bin/sh
#
# This is a helper script for development of the theme. It watches
# changes in the ‘src’ directory and refreshes GTK theme setup when
# any change occurred.
#
# Notes:
# - Works only for MATE Desktop.
# - Requires ‘inotifywait’ (the Debian ‘inotify-tools’ package).
ORIG_THEME=$(gsettings get org.mate.interface "gtk-theme")
WATCH_NAME=xxx-raleigh-reloaded
cleanup()
{
echo >&2 "\nInterrupted."
unlink "$HOME/.themes/$WATCH_NAME"
gsettings set org.mate.interface "gtk-theme" "$ORIG_THEME"
exit 0
}
cat >&2 <<EOF
Monitoring the ‘src’ directory for changes ...
Press ‘Ctrl+C’ to exit.
EOF
mkdir -p $HOME/.themes
ln -sf $(pwd)/src "$HOME/.themes/$WATCH_NAME"
test -n "$(which inotifywait)" || {
echo >&2 "fatal: executable ‘inotifywait’ not found."
exit 1
}
trap cleanup 2
while true
do
date +'%H:%M:%S - %d %b %Y - Reloading GTK theme ...'
gsettings set org.mate.interface "gtk-theme" "Adwaita"
gsettings set org.mate.interface "gtk-theme" "$WATCH_NAME"
inotifywait -qr -e modify -e create -e delete src
done