aboutsummaryrefslogtreecommitdiff
path: root/util/fluxbox-generate_menu
diff options
context:
space:
mode:
Diffstat (limited to 'util/fluxbox-generate_menu')
-rwxr-xr-xutil/fluxbox-generate_menu45
1 files changed, 27 insertions, 18 deletions
diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu
index b7215f1..2fbe73a 100755
--- a/util/fluxbox-generate_menu
+++ b/util/fluxbox-generate_menu
@@ -22,21 +22,26 @@
22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23# DEALINGS IN THE SOFTWARE. 23# DEALINGS IN THE SOFTWARE.
24# 24#
25# $Id: fluxbox-generate_menu,v 1.47 2003/08/04 14:13:33 rathnor Exp $ 25# $Id: fluxbox-generate_menu,v 1.48 2003/08/05 12:36:54 rathnor Exp $
26 26
27# 27#
28# Portability notes: 28# Portability notes:
29# To guarantee this script works on all platforms that support fluxbox 29# To guarantee this script works on all platforms that support fluxbox
30# please keep the following restrictions in mind: 30# please keep the following restrictions in mind:
31# 31#
32# don't use if ! command;, use command; if [ $? -ne 0 ]; 32# - don't use if ! command;, use command; if [ $? -ne 0 ];
33# don't use [ -e file ] use [ -r file ] 33# - don't use [ -e file ] use [ -r file ]
34# don't use $(), use `` 34# - don't use $(), use ``
35# don't use ~, use ${HOME} 35# - don't use ~, use ${HOME}
36# don't use id -u, use whoami 36# - don't use id -u, use whoami
37# getopts won't work on all platforms, but the config-file can 37# - getopts won't work on all platforms, but the config-file can
38# compensate for that. 38# compensate for that.
39# 39# - various software like grep/sed/perl may be not present or not
40# the version you have. for example grep '\W' only works on gnu-grep.
41# Keep this in mind, use bare basic defaults.
42# - Do _NOT_ suggest to use #!/bin/bash. Not everybody uses bash.
43# Non portable features like getopts in this script can be achieved in
44# other ways.
40 45
41 46
42WHOAMI=`whoami` 47WHOAMI=`whoami`
@@ -143,14 +148,12 @@ append_menu_end() {
143 148
144menu_entry() { 149menu_entry() {
145 if [ -f "$1" ]; then 150 if [ -f "$1" ]; then
146 append "[exec] (`grep '^[ ]*Name=' \"$1\" | head -1 | cut -d = -f 2`) \ 151 # space&tab here
147 {`grep '^[ ]*Exec=' \"$1\" | head -1 | cut -d = -f 2`}" 152 entry_name=`grep '^[ ]*Name=' "$1" | head -1 | cut -d = -f 2`
148 fi 153 entry_exec=`grep '^[ ]*Exec=' "$1" | head -1 | cut -d = -f 2`
149} 154 if [ -n "$entry_name" -a -n "$entry_exec" ]; then
150 155 append "[exec] ($entry_name) {$entry_exec}"
151menu_entry_dircheck() { 156 fi
152 if [ -d "$*" ]; then
153 menu_entry_dir "$*"
154 fi 157 fi
155} 158}
156 159
@@ -160,6 +163,12 @@ menu_entry_dir() {
160 done 163 done
161} 164}
162 165
166menu_entry_dircheck() {
167 if [ -d "$*" ]; then
168 menu_entry_dir "$*"
169 fi
170}
171
163 172
164# recursively build a menu from the listed directories 173# recursively build a menu from the listed directories
165# the dirs are merged 174# the dirs are merged
@@ -693,7 +702,7 @@ fi
693 702
694# find the default browser 703# find the default browser
695find_it $MY_BROWSER 704find_it $MY_BROWSER
696if [ $? -ne 0]; then 705if [ $? -ne 0 ]; then
697 echo "Warning: you chose an invalid browser." >&2 706 echo "Warning: you chose an invalid browser." >&2
698 #The precise order is up for debate. 707 #The precise order is up for debate.
699 for browser in MozillaFirebird firebird opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do 708 for browser in MozillaFirebird firebird opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do