summaryrefslogtreecommitdiffstats
path: root/scripts/firstrun/10-firefox/main
blob: 3f95169a485909499c267e0173b3f70f0d8a0a02 (plain)
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
150
151
152
153
154
155
156
157
# TODO: move .pentadactyrc-firstrun to script-local dir

WGET="wget -N"
DELETE=0

# plugins
plugins+="     59"  #   *** User Agent Switcher
plugins+="    722"  #   *** NoScript
plugins+="    748"  #   *** Greasemonkey
plugins+="   1027"  #  **** All-in-One Sidebar
plugins+="   1368"  #  **** ColorfulTabs
plugins+="   1843"  #  **** Firebug
plugins+="   1865"  #   *** Adblock Plus
plugins+="   3880"  #  **** Add Bookmark Here
plugins+="   6366"  # ***** FireGestures
plugins+="   7765"  #     ? IdentFavIcon
plugins+="   9609"  #    ** Ghostery
# unfortunately, this much needed extension will not work with Tree Style Tab:
# https://addons.mozilla.org/en-us/firefox/addon/bug489729-disable-detach-and-t/versions/?page=1#version-2.0
# https://addons.mozilla.org/cs/thunderbird/addon/tree-style-tab/reviews/310061/
# https://bugzilla.mozilla.org/show_bug.cgi?id=489729#c93
# https://github.com/piroor/treestyletab/issues/305
#plugins+="  12276"  #     ? bug489729 (Disable detach and tear off tab)
plugins+="  12632"  #  **** FireQuery
plugins+="  13784"  #  **** Open Bookmarks in New Tab
plugins+="  71411"  #    ** Tile Tabs
#plugins+=" 184566"  # ***** Tree Style Tab
plugins+=" 193270"  #     ? Print Edit -> http://piro.sakura.ne.jp/xul/xpi/treestyletab.xpi
#plugins+=" 235854"  # ***** Pentadactyl -> http://5digits.org/nightly/pentadactyl-latest.xpi
plugins+=" 318228"  #  **** Super Start
#plugins+=" 395282"  #    ** Capture & Print

# current issue w/ FF22: http://code.google.com/p/dactyl/issues/detail?id=1003#c4
plugins_extra+=" http://5digits.org/nightly/pentadactyl-latest.xpi"

plugins_extra+=" http://piro.sakura.ne.jp/xul/xpi/treestyletab.xpi"
plugins_extra+=" https://addons.mozilla.org/firefox/downloads/file/164485/remove_google_search_redirects-0.5-fx.xpi"

searches+=" 161972" #  **** DuckDuckGo (HTTPS / SSL)

if ( test ! -d "${HOME}/.mozilla" || test ! -d "${HOME}/.mozilla/firefox" ); then
	mkdir -p "${HOME}/.mozilla/firefox"
	touch -- "${HOME}/.mozilla/firefox/profiles.ini"
fi

while read -p "Enter name of the profile: " profile; do
	test ! -d "${HOME}/.mozilla/firefox/${profile}" && break
	echo "Exists: ${HOME}/.mozilla/firefox/${profile}"
done

touch -- "${HOME}/.mozilla/firefox/profiles.ini"
PROFILE="${HOME}/.mozilla/firefox/${profile}"
FIREFOX="firefox -P ${profile}"
mkdir "${PROFILE}"
echo created "${PROFILE}"

( python | sed 's| = |=|' > "${HOME}/.mozilla/firefox/profiles.ini" ) <<-EOF
	from sys import stdout
	from ConfigParser import RawConfigParser as RCP
	cp = RCP()
	cp.optionxform = str
	f = open('${HOME}/.mozilla/firefox/profiles.ini', 'r')
	cp.readfp(f)
	if not cp.has_section('General'):
	    cp.add_section('General')
	    cp.set('General', 'StartWithLastProfile', '1')
	new_sec = 'Profile' + str(len(cp.sections()) - 1)
	cp.add_section(new_sec)
	cp.set(new_sec, 'Name', '${profile}')
	cp.set(new_sec, 'IsRelative', '1')
	cp.set(new_sec, 'Path', '${profile}')
	cp.write(stdout)
EOF

echo "Please set security.dialog_enable_delay to zero (recommended to save time)"
${FIREFOX} about:config

for plugin in $plugins; do
	${WGET} "https://addons.mozilla.org/firefox/downloads/latest/${plugin}/addon-${plugin}-latest.xpi"
	${FIREFOX} "addon-${plugin}-latest.xpi" &
done

for plugin in $plugins_extra; do
	${WGET} "${plugin}"
	${FIREFOX} "$(echo "${plugin}" | sed 's|.*/\([^/]\+\)|\1|')" &
done

SEARCHPLUGINS="${PROFILE}/searchplugins"
mkdir "${SEARCHPLUGINS}"
for search in $searches; do
	${WGET} -P "${SEARCHPLUGINS}" "https://addons.mozilla.org/firefox/downloads/latest/${plugin}/addon-${plugin}-latest.xml"
done
cat > "${PROFILE}/search-metadata.json"  <<-EOF
	{
	    "[app]/duckduckgo.xml": {
	        "alias": "ddg", 
	        "order": 1
	    }, 
	    "[app]/google.xml": {
	        "alias": "g", 
	        "order": 2
	    }, 
	    "[app]/wikipedia.xml": {
	        "alias": "we", 
	        "order": 3
	    }, 
	    "[app]/amazondotcom.xml": {
	        "alias": null, 
	        "hidden": true, 
	        "order": 4
	    }, 
	    "[app]/bing.xml": {
	        "alias": null, 
	        "hidden": true, 
	        "order": 5
	    }, 
	    "[app]/eBay.xml": {
	        "alias": null, 
	        "hidden": true, 
	        "order": 6
	    }, 
	    "[app]/twitter.xml": {
	        "alias": null, 
	        "hidden": true, 
	        "order": 7
	    }, 
	    "[app]/yahoo.xml": {
	        "alias": null, 
	        "hidden": true, 
	        "order": 8
	    }
	}
EOF

[ "${DELETE}" -ne 0 ] && rm -I *.xpi || read -p "Press any key to continue " x

mkdir -p "${PROFILE}/chrome"
cat > "${PROFILE}/chrome/userContent.css" <<-EOF
        /* increase the size of checkboxes */
	input[type=checkbox]
	{
	  -moz-transform: scale(1.5);
	  padding: 10px;
	}
EOF

mv "${PROFILE}/localstore.rdf{,.orig}"
# add feed button to bottom toolbar
xsltproc toolbar-layout.xsl -o "${PROFILE}/localstore.rdf{,.orig}"
rm -f -- "${PROFILE}/localstore.rdf.orig"

sleep 2 \
  && ${FIREFOX} -pentadactyl "++cmd 'source pentadactylrc-firstrun' +c 'mkvimruntime'"

# HTML5 for youtube
#${FIREFOX} http://userscripts.org/scripts/source/105433.user.js
${FIREFOX} https://youtube.com/html5