-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.sh
executable file
·61 lines (53 loc) · 1.57 KB
/
script.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Find default folder in /home/<user>/snap/firefox/common/.mozilla/firefox/
default_folder=$(find /home/*/snap/firefox/common/.mozilla/firefox -maxdepth 1 -type d -name '*.default' -print -quit)
# Using Zenity to open a file chooser restricted to images
file=$(zenity --file-selection --title="Select an image")
# Checking if a file was selected or if the user canceled
if [ -n "$file" ]; then
echo "You have selected the image: $file"
else
echo "No image selected."
exit 1
fi
cd "$default_folder"
touch user.js
echo "
user_pref('toolkit.legacyUserProfileCustomizations.stylesheets', true);
" > "./user.js"
if [ -d "chrome/img" ]; then
echo "Folder already exists"
else
mkdir -p chrome/img
fi
if [ chrome/img/*!=$file ]; then
read -p "Another file is found as a wallpaper want to delete it? y/n (case sensitive)" response
if [ "$response" == "y" ]; then
rm chrome/img/*
echo removed
else
echo Nothing done try removing the extra file if no wallpaper apperared.
fi
fi
cp "$file" chrome/img/
cd chrome
touch userContent.css
echo "
@-moz-document url(about:home), url(about:newtab), url(about:privatebrowsing) {
.click-target-container *, .top-sites-list * {
color: #fff !important ;
text-shadow: 2px 2px 2px #222 !important ;
}
body::before {
content: '' ;
z-index: -1 ;
position: fixed ;
top: 0 ;
left: 0 ;
background: #f9a no-repeat url(./img/$(basename "$file")) center ;
background-size: cover ;
width: 100vw ;
height: 100vh ;
}
} " > "./userContent.css"
echo "Done. Restart firefox and enjoy your wallpaper !"