Link Here
|
1 |
--- util/fluxbox-generate_menu.in.orig 2015-02-08 10:44:45 UTC |
|
|
2 |
+++ util/fluxbox-generate_menu.in |
3 |
@@ -68,7 +68,7 @@ Options: |
4 |
-d Other path(s) to recursively search for *.desktop files |
5 |
-ds Wider search for *.desktop files (takes more time) |
6 |
-i Other path(s) to search for icons |
7 |
- e.g., "/usr/kde/3.3/share/icons/crystalsvg/16x16/*" |
8 |
+ e.g., "%%LOCALBASE%%/share/icons/crystalsvg/16x16/*" |
9 |
-is Wider search for icons (worth the extra time) |
10 |
-in Skip icon search |
11 |
|
12 |
@@ -85,7 +85,7 @@ Options: |
13 |
Only for packagers: |
14 |
|
15 |
-p Prefix; default is @PREFIX@ |
16 |
- -n Gnome-prefix; /opt, /usr, /usr/X11R6 and /usr/local autodetected |
17 |
+ -n Gnome-prefix; %%LOCALBASE%% autodetected |
18 |
-q KDE-prefix; idem dito |
19 |
|
20 |
|
21 |
@@ -145,13 +145,42 @@ testoption() { |
22 |
esac |
23 |
} |
24 |
|
25 |
-find_it() { |
26 |
- [ -n "$1" ] && hash $1 2> /dev/null && shift && "$@" |
27 |
-} |
28 |
+# some which's have a reliable return code, some don't |
29 |
+# Lets figure out which which we have. |
30 |
+if which this_program_does_not_exist-no_really-aA1zZ9 2> /dev/null 1> /dev/null; then |
31 |
+ # can't rely on return value |
32 |
+ find_it() { |
33 |
+ file=`which $1 2> /dev/null` |
34 |
+ if [ -x "$file" ]; then |
35 |
+ if [ $# -gt 1 ]; then |
36 |
+ shift |
37 |
+ "$@" |
38 |
+ fi |
39 |
+ return 0 |
40 |
+ else |
41 |
+ return 1 |
42 |
+ fi |
43 |
+ } |
44 |
|
45 |
-find_it_options() { |
46 |
- [ -n "$1" ] && hash $1 2> /dev/null |
47 |
-} |
48 |
+ find_it_options() { |
49 |
+ file=`which $1 2> /dev/null` |
50 |
+ if [ -x "$file" ]; then |
51 |
+ return 0 |
52 |
+ else |
53 |
+ return 1 |
54 |
+ fi |
55 |
+ } |
56 |
+ |
57 |
+else |
58 |
+ # can rely on return value |
59 |
+ find_it() { |
60 |
+ which $1 > /dev/null 2>&1 && shift && "$@" |
61 |
+ } |
62 |
+ |
63 |
+ find_it_options() { |
64 |
+ which $1 > /dev/null 2>&1 |
65 |
+ } |
66 |
+fi |
67 |
|
68 |
#echo "replaceWithinString: $1, $2, $3" >&2 |
69 |
#echo ${1//$2/$3} # causes error in BSD even though not used |
70 |
@@ -203,7 +232,7 @@ convertIcon(){ |
71 |
if [ -f "${entry_icon}" ]; then |
72 |
: echo "File exists. To overwrite, type: convert \"$1\" \"$entry_icon\"" >&2 |
73 |
else |
74 |
- if hash convert 2> /dev/null; then |
75 |
+ if which convert &> /dev/null; then |
76 |
convert "$1" "$entry_icon" |
77 |
# echo convert "$1" , "$entry_icon" >> $ICONMAPPING |
78 |
else |
79 |
@@ -275,7 +304,7 @@ doSearch(){ |
80 |
# echo -n "for $temp_icon" |
81 |
eval doSearchLoop $USER_ICONPATHS \ |
82 |
"$FB_ICONDIR" \ |
83 |
- "/usr/share/${execname%% *}" \ |
84 |
+ "%%LOCALBASE%%/share/${execname%% *}" \ |
85 |
${OTHER_ICONPATHS} \ |
86 |
|
87 |
|
88 |
@@ -558,7 +587,7 @@ rm -f ${MENUFILENAME}.tmp |
89 |
|
90 |
|
91 |
WHOAMI=`whoami` |
92 |
-[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin |
93 |
+[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin:%%LOCALBASE%%/bin |
94 |
|
95 |
# Check for Imlib2-support |
96 |
if @pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -info 2> /dev/null | grep -q "^IMLIB"; then |
97 |
@@ -1271,16 +1300,16 @@ if [ ! "${INSTALL}" = Yes ]; then |
98 |
# These are prefixes; So if fluxbox is installed in @PREFIX@/bin/fluxbox |
99 |
# your prefix is: @PREFIX@ |
100 |
|
101 |
-# fluxbox-generate already looks in /usr/X11R6, /usr, /usr/local and /opt so |
102 |
+# fluxbox-generate already looks in %%LOCALBASE%% so |
103 |
# there should be no need to specify them. |
104 |
# |
105 |
# PREFIX=@PREFIX@ |
106 |
-# GNOME_PREFIX=/opt/gnome |
107 |
-# KDE_PREFIX=/opt/kde |
108 |
+# GNOME_PREFIX=%%LOCALBASE%% |
109 |
+# KDE_PREFIX=%%LOCALBASE%% |
110 |
|
111 |
|
112 |
# Separate the list of background dirs with colons ':' |
113 |
-# BACKGROUND_DIRS="${USERFLUXDIR}/backgrounds/:@PREFIX@/share/fluxbox/backgrounds/:/usr/share/wallpapers" |
114 |
+# BACKGROUND_DIRS="${USERFLUXDIR}/backgrounds/:@PREFIX@/share/fluxbox/backgrounds/:%%LOCALBASE%%/share/wallpapers" |
115 |
|
116 |
|
117 |
# --- Boolean variables. |
118 |
@@ -1327,29 +1356,21 @@ while [ $# -gt 0 ]; do |
119 |
-g) GNOMEMENU=yes; shift;; |
120 |
-in) NO_ICON=yes; shift;; |
121 |
-is) OTHER_ICONPATHS=" |
122 |
- /usr/share/icons |
123 |
- /usr/share/icons/mini |
124 |
- /usr/share/pixmaps |
125 |
- /usr/local/share/icons |
126 |
- /usr/local/share/icons/mini |
127 |
- /usr/local/share/pixmaps |
128 |
- /usr/share/xclass/icons |
129 |
- /usr/share/xclass/pixmaps |
130 |
- /usr/local/share/xclass/icons |
131 |
- /usr/local/share/xclass/pixmaps |
132 |
- /usr/X11R6/share/icons/default/16x16 |
133 |
- /usr/X11R6/share/icons/kde/16x16 |
134 |
- /usr/X11R6/share/icons/hicolor/16x16 |
135 |
- /usr/local/X11R6/share/icons/default/16x16 |
136 |
- /usr/local/X11R6/share/icons/kde/16x16 |
137 |
- /usr/local/X11R6/share/icons/hicolor/16x16 |
138 |
+ %%LOCALBASE%%/share/icons |
139 |
+ %%LOCALBASE%%/share/icons/mini |
140 |
+ %%LOCALBASE%%/share/pixmaps |
141 |
+ %%LOCALBASE%%/share/xclass/icons |
142 |
+ %%LOCALBASE%%/share/xclass/pixmaps |
143 |
+ %%LOCALBASE%%/share/icons/default/16x16 |
144 |
+ %%LOCALBASE%%/share/icons/kde/16x16 |
145 |
+ %%LOCALBASE%%/share/icons/hicolor/16x16 |
146 |
" |
147 |
shift;; |
148 |
-ds) OTHER_DESKTOP_PATHS=" |
149 |
- /usr/share/mimelnk |
150 |
- /usr/share/applications |
151 |
- /usr/share/xsessions |
152 |
- /usr/share/services |
153 |
+ %%LOCALBASE%%/share/mimelnk |
154 |
+ %%LOCALBASE%%/share/applications |
155 |
+ %%LOCALBASE%%/share/xsessions |
156 |
+ %%LOCALBASE%%/share/services |
157 |
" |
158 |
# /usr/share/apps \ |
159 |
shift;; |
160 |
@@ -1420,13 +1441,12 @@ fi |
161 |
# prefix |
162 |
PREFIX="${PREFIX:=@PREFIX@}" |
163 |
if [ -z "${PREFIX}" -o ! -d "${PREFIX}" ]; then |
164 |
- hash @pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ |
165 |
- PREFIX=`hash | grep @pkgprefix@fluxbox@pkgsuffix@ | sed 's,.*\t/,/,' | sed 's,/bin/@pkgprefix@fluxbox@pkgsuffix@@EXEEXT@$,,'` |
166 |
+ PREFIX=`which fluxbox | sed 's,/bin/fluxbox$,,'` |
167 |
fi |
168 |
|
169 |
|
170 |
# gnome prefix |
171 |
-for GNOME_PREFIX in "${GNOME_PREFIX}" /usr/local /usr/X11R6 /usr /opt "${PREFIX}"; do |
172 |
+for GNOME_PREFIX in "${GNOME_PREFIX}" %%LOCALBASE%% "${PREFIX}"; do |
173 |
if [ -n "${GNOME_PREFIX}" -a -d "$GNOME_PREFIX/share/gnome" ]; then |
174 |
break; |
175 |
fi |
176 |
@@ -1434,7 +1454,7 @@ done |
177 |
# Will remain $PREFIX if all else fails |
178 |
|
179 |
# kde prefix |
180 |
-for KDE_PREFIX in "${KDE_PREFIX}" /usr/local /usr/X11R6 /usr /opt "${PREFIX}"; do |
181 |
+for KDE_PREFIX in "${KDE_PREFIX}" %%LOCALBASE%% "${PREFIX}"; do |
182 |
if [ -n "${KDE_PREFIX}" -a -d "$KDE_PREFIX/share/applnk" ]; then |
183 |
break; |
184 |
fi |
185 |
@@ -1522,7 +1542,7 @@ if find_it_options $MY_BROWSER; then |
186 |
else |
187 |
[ -n "$MY_BROWSER" ] && echo "Warning: you chose an invalid browser." >&2 |
188 |
#The precise order is up for debate. |
189 |
- for browser in firefox mozilla-firefox chrome chromium google-chrome mozilla-firebird MozillaFirebird opera skipstone mozilla seamonkey galeon konqueror dillo netscape w3m amaya links lynx; do |
190 |
+ for browser in firefox mozilla-firefox chrome chromium google-chrome mozilla-firebird MozillaFirebird linux-opera opera skipstone mozilla seamonkey galeon konqueror dillo netscape w3m amaya links lynx; do |
191 |
if find_it_options $browser; then |
192 |
DEFAULT_BROWSER=$browser |
193 |
break |
194 |
@@ -1589,6 +1609,7 @@ case "$DEFAULT_BROWSERNAME" in |
195 |
chrome|chromium) append "[exec] (${DEFAULT_BROWSERNAME}) {${DEFAULT_BROWSER}}" ;; |
196 |
google-chrome) append "[exec] (${DEFAULT_BROWSERNAME}) {${DEFAULT_BROWSER}}" ;; |
197 |
konqueror) append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" ;; |
198 |
+ linux-opera) append "[exec] (linux-opera) {env QT_XFT=true linux-opera}" ;; |
199 |
opera) append "[exec] (opera) {env QT_XFT=true opera}" ;; |
200 |
MozillaFirebird) append "[exec] (firebird) {MozillaFirebird}" ;; |
201 |
MozillaFirefox) append "[exec] (firefox) {MozillaFirefox}" ;; |
202 |
@@ -1608,6 +1629,7 @@ append_submenu "${NETMENU}" |
203 |
append_submenu "${BROWSERMENU}" |
204 |
normal_find chrome chromium firefox google-chrome mozilla-firefox MozillaFirefox galeon mozilla seamonkey dillo netscape vncviewer |
205 |
find_it links append "[exec] (links-graphic) {links -driver x ${HOMEPAGE}}" |
206 |
+ find_it linux-opera append "[exec] (linux-opera) {env QT_XFT=true linux-opera}" |
207 |
find_it opera append "[exec] (opera) {env QT_XFT=true opera}" |
208 |
find_it konqueror append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" |
209 |
find_it links append "[exec] (links) {${DEFAULT_TERM} -e links ${HOMEPAGE}}" |