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