slitaz-tools view jwm/jwm-menu @ rev 989
tazbox video: disable screensaver
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat May 28 14:02:15 2016 +0200 (2016-05-28) |
parents | 95727d7587e7 |
children |
line source
1 #!/bin/sh
2 #
3 # JWM Menus generator
4 # (C) 2014-2015 SliTaz GNU/Linux - BSD Licence
5 #
7 menus="/etc/xdg/jwm/menus.jwmrc"
8 apps="/usr/share/applications"
10 categories() {
11 cat << EOT
12 Accessories
13 Internet
14 Graphics
15 Multimedia
16 Games
17 Development
18 Documentation
19 System
20 EOT
21 }
23 header() {
24 cat > ${menus} << EOT
25 <?xml version="1.0"?>
26 <JWM>
27 <!-- Applications menu -->
28 <RootMenu height="22" onroot="12">
29 EOT
30 }
32 footer() {
33 cat >> ${menus} << EOT
34 <!-- System menus -->
35 <RootMenu height="22" onroot="3">
36 <Program icon="terminal.png" label="Terminal Emulator">terminal</Program>
37 <Program icon="file-manager.png" label="File Manager">file-manager</Program>
38 <Separator/>
39 <Restart label="Restart JWM" icon="system-restart.png" />
40 <Exit label="Exit JWM" confirm="true" icon="system-suspend.png" />
41 <Program icon="system-restart.png" label="Reboot system">reboot</Program>
42 <Program icon="system-shut-down.png" label="Shutdown system">poweroff</Program>
43 </RootMenu>
44 </JWM>
45 EOT
46 }
48 header
49 for cat in $(categories)
50 do
51 case "$cat" in
52 Accessories)
53 icon="applications-accessories.png"
54 name="Utility" not="System" ;;
55 Internet)
56 icon="applications-internet.png"
57 name="Network" ;;
58 Graphics)
59 icon="applications-graphics.png"
60 name="$cat" ;;
61 Multimedia)
62 icon="applications-multimedia.png"
63 name="AudioVideo" not="Utility" ;;
64 Games)
65 icon="applications-games.png"
66 name="Game" ;;
67 Development)
68 icon="applications-development.png"
69 name="$cat" ;;
70 Documentation)
71 icon="text-x-generic.png"
72 name="$cat" ;;
73 System)
74 cat="System Tools"
75 icon="applications-system.png"
76 name="System" ;;
77 esac
78 echo " <Menu icon=\"$icon\" label=\"$cat\">" >> ${menus}
79 # Parse *.desktop files
80 for app in $(fgrep -l "${name}" $apps/*.desktop)
81 do
82 # Skip OnlyShowIn
83 if fgrep -q 'OnlyShowIn=' ${app}; then
84 continue
85 fi
86 # Skip not shown in category
87 if fgrep -q "$not" ${app}; then
88 continue
89 fi
90 name="$(grep '^Name=' $app | cut -d '=' -f 2)"
91 icon="$(grep '^Icon=' $app | cut -d '=' -f 2)"
92 exec="$(grep '^Exec=' $app | cut -d '=' -f 2)"
93 echo " <Program icon=\"$icon\" label=\"$name\">$exec</Program>" \
94 >> ${menus}
95 unset name icon exec
96 done
97 echo ' </Menu>' >> ${menus}
98 done
99 footer
100 exit 0