|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | +# This is an example wrapper script for `labwc-menu-generator` which aims to |
| 4 | +# demonstrate how a user can customize the menu with entries before/after the |
| 5 | +# directories and to ignore certain applications. |
| 6 | +# |
| 7 | +# `labwc-menu-generator` does the hard work of parsing system application |
| 8 | +# .desktop files and categorizing them into directories. Technically it would |
| 9 | +# of course be possible to add options for further customisation such as what |
| 10 | +# is achieved by this script, but that would mostly likely result in a couple |
| 11 | +# of undesireable outcomes: |
| 12 | +# |
| 13 | +# 1. Significantly extend project scope to cater for unusual and obscure |
| 14 | +# requirements (including translations), thus making it harder to maintain |
| 15 | +# and less likely to survive in the long-run. |
| 16 | +# |
| 17 | +# 2. Make the user-interface disproportionately more complicated compared with |
| 18 | +# writing a simple wrapper script. |
| 19 | +# |
| 20 | + |
| 21 | +ignore_files=$(mktemp) |
| 22 | +trap "rm -f $ignore_files" EXIT |
| 23 | +cat <<'EOF' >${ignore_files} |
| 24 | +gammastep-indicator.desktop |
| 25 | +libreoffice-startcenter.desktop |
| 26 | +cmake-gui.desktop |
| 27 | +electron27.desktop |
| 28 | +org.gtk.IconBrowser4.desktop |
| 29 | +org.gtk.gtk4.NodeEditor.desktop |
| 30 | +org.gtk.PrintEditor4.desktop |
| 31 | +org.gtk.WidgetFactory4.desktop |
| 32 | +bssh.desktop |
| 33 | +bvnc.desktop |
| 34 | +qv4l2.desktop |
| 35 | +qvidcap.desktop |
| 36 | +pcmanfm-qt-desktop-pref.desktop |
| 37 | +pcmanfm-desktop-pref.desktop |
| 38 | +libfm-pref-apps.desktop |
| 39 | +org.xfce.mousepad-settings.desktop |
| 40 | +avahi-discover.desktop |
| 41 | +org.codeberg.dnkl.footclient.desktop |
| 42 | +org.codeberg.dnkl.foot-server.desktop |
| 43 | +lstopo.desktop |
| 44 | +gtk-lshw.desktop |
| 45 | +urxvtc.desktop |
| 46 | +urxvt-tabbed.desktop |
| 47 | +xterm.desktop |
| 48 | +rofi.desktop |
| 49 | +rofi-theme-selector.desktop |
| 50 | +EOF |
| 51 | + |
| 52 | +printf '%b\n' '<?xml version="1.0" encoding="UTF-8"?> |
| 53 | +<openbox_menu> |
| 54 | +<menu id="root-menu" label="root-menu"> |
| 55 | + <item label="Web Browser"> |
| 56 | + <action name="Execute"><command><![CDATA[firefox labwc.github.io]]></command></action> |
| 57 | + </item> |
| 58 | + <item label="Terminal"> |
| 59 | + <action name="Execute" command="sakura -e zsh" /> |
| 60 | + </item> |
| 61 | + <item label="Tweaks"> |
| 62 | + <action name="Execute" command="labwc-tweaks"/> |
| 63 | + </item> |
| 64 | + <separator />' |
| 65 | + |
| 66 | +# -b|--bare Disables header and footer |
| 67 | +# -i|--ignore Excludes all .desktop files listed at the top of this file |
| 68 | +labwc-menu-generator -b -i "${ignore_files}" |
| 69 | + |
| 70 | +printf '%b\n' '<separator /> |
| 71 | + <item label="Reconfigure"> |
| 72 | + <action name="Reconfigure" /> |
| 73 | + </item> |
| 74 | + <item label="Exit"> |
| 75 | + <action name="Exit" /> |
| 76 | + </item> |
| 77 | +</menu> <!-- root-menu --> |
| 78 | +</openbox_menu>' |
0 commit comments