-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtogglecss.sh
executable file
·40 lines (37 loc) · 1.13 KB
/
togglecss.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
#!/bin/bash
# Toggle user stylesheet and restart Firefox
# Silas S. Brown 2011,2021-22,2024, public domain, no warranty
# Where to find history:
# on GitHub at https://github.com/ssb22/css-generator
# and on GitLab at https://gitlab.com/ssb22/css-generator
# and on BitBucket https://bitbucket.org/ssb22/css-generator
# and at https://gitlab.developers.cam.ac.uk/ssb22/css-generator
# and in China: https://gitee.com/ssb22/css-generator
if ! cd "$HOME/.mozilla/firefox"; then
echo "Could not find Firefox profiles directory"
exit 1
fi
Done=0
for D in *.default*; do
cd "$D/chrome" || continue
if test -e userContent.css; then
mv userContent.css userContent.css-disabled
Done=1
elif test -e userContent.css-disabled; then
mv userContent.css-disabled userContent.css
Done=1
fi
cd ../..
done
if test $Done == 1; then
if pidof firefox firefox-bin >/dev/null 2>/dev/null; then
kill $(pidof firefox firefox-bin) 2>/dev/null
firefox &
echo "Stylesheets toggled, Firefox restarted"
else
echo "Stylesheets toggled, no current Firefox to restart"
fi
else
echo "Could not find any stylesheets to toggle"
exit 1
fi