-
-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathmediacontrols.sh
More file actions
executable file
·149 lines (124 loc) · 3.11 KB
/
mediacontrols.sh
File metadata and controls
executable file
·149 lines (124 loc) · 3.11 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
set -e
nested() {
export MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768
dbus-run-session -- gnome-shell --unsafe-mode --nested --wayland --no-x11
}
build() {
echo "Copying..."
mkdir -p dist/temp
mkdir -p dist/builds
rm -rf dist/temp/*
cp -r $(find src -mindepth 1 -maxdepth 1 -not -name "assets") dist/temp/.
glib-compile-resources assets/org.gnome.shell.extensions.mediacontrols.gresource.xml --target=dist/temp/org.gnome.shell.extensions.mediacontrols.gresource --sourcedir=assets
if [ "$1" = "release" ]; then
echo "Stripping debug values..."
sed 's/const DEBUG = true;/const DEBUG = false;/g' ./dist/temp/utils/common.js >./dist/temp/utils/common.js.tmp
mv ./dist/temp/utils/common.js.tmp ./dist/temp/utils/common.js
fi
echo "Packing..."
EXTRASRCS=$(find dist/temp/ -mindepth 1 -maxdepth 1 ! -name "metadata.json" ! -name "extension.js" ! -name "prefs.js" ! -name "stylesheet.css")
ESFLAGS=()
for F in $EXTRASRCS; do
ESFLAGS+=("--extra-source=$PWD/$F")
done
SCHEMA="$PWD/assets/org.gnome.shell.extensions.mediacontrols.gschema.xml"
PODIR="$PWD/assets/locale"
gnome-extensions pack -f -o dist/builds/ --schema="$SCHEMA" --podir="$PODIR" "${ESFLAGS[@]}" dist/temp/
}
debug() {
echo "Debugging..."
build
install
nested
}
reload() {
echo "Reloading..."
build
install
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
pkill -HUP gnome-shell
else
echo "Reloading Wayland session is not supported yet."
fi
}
translations() {
echo "Updating translations..."
touch assets/locale/mediacontrols@cliffniff.github.com.pot
find . -type f -iname "*.ui" -o -iname "*.js" -not -path "./node_modules/*" | xargs xgettext --from-code=UTF-8 \
--add-comments \
--join-existing \
--keyword=_ \
--keyword=C_:1c,2 \
--language=Javascript \
--output=assets/locale/mediacontrols@cliffniff.github.com.pot
for pofile in assets/locale/*.po; do
echo "Updating: $pofile"
msgmerge -U "$pofile" "assets/locale/mediacontrols@cliffniff.github.com.pot"
done
rm assets/locale/*.po~ 2>/dev/null
echo "Done"
}
install() {
echo "Installing..."
gnome-extensions install --force ./dist/builds/mediacontrols@cliffniff.github.com.shell-extension.zip
}
uninstall() {
echo "Uninstalling..."
gnome-extensions uninstall mediacontrols@cliffniff.github.com
}
enable() {
echo "Enabling..."
gnome-extensions enable mediacontrols@cliffniff.github.com
}
disable() {
echo "Disabling..."
gnome-extensions disable mediacontrols@cliffniff.github.com
}
prefs() {
echo "Opening prefs..."
gnome-extensions prefs mediacontrols@cliffniff.github.com
}
watch() {
echo "Watching for setting changes..."
dconf watch /org/gnome/shell/extensions/mediacontrols/
}
case "$1" in
release)
build "release"
;;
build)
build
;;
debug)
debug
;;
reload)
reload
;;
translations)
translations
;;
install)
install
;;
uninstall)
uninstall
;;
enable)
enable
;;
disable)
disable
;;
prefs)
prefs
;;
watch)
watch
;;
*)
echo "Usage: $0 {release|build|reload|debug|translations|install|uninstall|enable|disable|prefs|watch}"
exit 1
;;
esac