Module Name: src Committed By: nia Date: Mon May 9 15:05:18 UTC 2022
Modified Files: src/external/mit/ctwm/etc: system.ctwmrc src/external/mit/ctwm/libexec: ctwm_app_menu Log Message: ctwmrc: Split the automatically generated pkgsrc applications menu into categories similarly to MATE and Xfce. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/external/mit/ctwm/etc/system.ctwmrc cvs rdiff -u -r1.3 -r1.4 src/external/mit/ctwm/libexec/ctwm_app_menu Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/mit/ctwm/etc/system.ctwmrc diff -u src/external/mit/ctwm/etc/system.ctwmrc:1.16 src/external/mit/ctwm/etc/system.ctwmrc:1.17 --- src/external/mit/ctwm/etc/system.ctwmrc:1.16 Mon May 9 07:15:25 2022 +++ src/external/mit/ctwm/etc/system.ctwmrc Mon May 9 15:05:18 2022 @@ -1,5 +1,5 @@ # -# $NetBSD: system.ctwmrc,v 1.16 2022/05/09 07:15:25 nia Exp $ +# $NetBSD: system.ctwmrc,v 1.17 2022/05/09 15:05:18 nia Exp $ # # ctwmrc by nia # @@ -260,16 +260,32 @@ Monochrome MapWindowBackground "white" } +syscmd(/usr/X11R7/libexec/ctwm_app_menu) + +menu "appmenu" +{ + "pkgsrc Applications" f.title + " Accessories" f.menu "Accessories" + " Games" f.menu "Games" + " Graphics" f.menu "Graphics" + " Internet" f.menu "Internet" + " Multimedia" f.menu "Multimedia" + " Office" f.menu "Office" + " Programming" f.menu "Programming" + " System" f.menu "System" + " Misc" f.menu "Misc" +} + menu "deskutils" { "Desktop utilities" f.title " Calculator" !"xcalc &" - " Clipboard" !"xclipboard &" " Text editor" !"xedit &" + " Manual pages" !"LC_ALL=en_US.ISO8859-1 xman -notopbox &" "" f.separator " XEyes" !"xeyes &" " OpenGL Gears" !"glxgears &" - " Icosahedron" !"ico -sleep 0.016 &" + " Spinning cube" !"ico -sleep 0.016 -obj cube -colors darkorange &" "" f.separator " Compositor (shadows)" !"pkill xcompmgr; xcompmgr -c &" " Compositor (simple)" !"pkill xcompmgr; xcompmgr -n &" @@ -299,7 +315,6 @@ menu "NetBSD" "NetBSD" f.title "" f.separator " Terminal" !"uxterm &" - " Manual pages" !"LC_ALL=en_US.ISO8859-1 xman -notopbox &" "" f.separator " Applications" f.menu "appmenu" " Desktop utilities" f.menu "deskutils" @@ -309,8 +324,6 @@ menu "NetBSD" " Quit" f.quit } -syscmd(/usr/X11R7/libexec/ctwm_app_menu) - menu "titleops" { "Window" f.title Index: src/external/mit/ctwm/libexec/ctwm_app_menu diff -u src/external/mit/ctwm/libexec/ctwm_app_menu:1.3 src/external/mit/ctwm/libexec/ctwm_app_menu:1.4 --- src/external/mit/ctwm/libexec/ctwm_app_menu:1.3 Mon Mar 1 15:40:40 2021 +++ src/external/mit/ctwm/libexec/ctwm_app_menu Mon May 9 15:05:18 2022 @@ -1,7 +1,7 @@ #!/bin/sh -# $NetBSD: ctwm_app_menu,v 1.3 2021/03/01 15:40:40 nia Exp $ +# $NetBSD: ctwm_app_menu,v 1.4 2022/05/09 15:05:18 nia Exp $ # -# Copyright (c) 2020 The NetBSD Foundation, Inc. +# Copyright (c) 2020-2022 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation @@ -29,54 +29,117 @@ # POSSIBILITY OF SUCH DAMAGE. # LOCALBASE=$(pkg_info -Q LOCALBASE pkg_install 2>/dev/null || echo /usr/pkg) +DESKTOPFILES=$(find $LOCALBASE/share/applications -name '*.desktop') OFS=$IFS IFS=' ' -printf 'menu "appmenu"\n' -printf '{\n' -printf '\t"Applications"\tf.title\n' -for app in $(find $LOCALBASE/share/applications -name '*.desktop'); -do - name="" - exec="" - terminal="" - nodisplay="" - while read line; +do_category() +{ + printf 'menu "%s"\n' "$1" + printf '{\n' + printf '\t"%s"\tf.title\n' "$1" + for app in $DESKTOPFILES; do - case $line in - Name=*) - if ! [ -n "$name" ]; - then - name=$(printf '%s' "$line" | cut -c6- | tr -d '\r') + name="" + exec="" + terminal="" + nodisplay="" + category=$(grep -m 1 '^Categories=' "$app") + case "$category" in + *Audio*) + if [ "$1" != "Multimedia" ]; then + continue fi ;; - Exec=*) - if ! [ -n "$exec" ]; - then - exec=$(printf '%s' "$line" | cut -c6- | sed -e 's/ %.*//g' | tr -d '\r') + *Development*) + if [ "$1" != "Programming" ]; then + continue fi ;; - Terminal=true) - terminal="true" + *Graphics*) + if [ "$1" != "Graphics" ]; then + continue + fi + ;; + *Game*) + if [ "$1" != "Games" ]; then + continue + fi + ;; + *Office*) + if [ "$1" != "Office" ]; then + continue + fi + ;; + *Network*) + if [ "$1" != "Internet" ]; then + continue + fi ;; - OnlyShowIn=*|NoDisplay=true) - nodisplay="true" + *System*) + if [ "$1" != "System" ]; then + continue + fi + ;; + *Utility*) + if [ "$1" != "Accessories" ]; then + continue + fi + ;; + *) + if [ "$1" != "Misc" ]; then + continue + fi ;; esac - done < "$app" - if [ -n "$nodisplay" ]; - then - continue - fi - if [ -n "$name" -a -n "$exec" ]; - then - if [ -n "$terminal" ]; + while read line; + do + case $line in + Name=*) + if ! [ -n "$name" ]; + then + name=$(printf '%s' "$line" | cut -c6- | tr -d '\r') + fi + ;; + Exec=*) + if ! [ -n "$exec" ]; + then + exec=$(printf '%s' "$line" | cut -c6- | sed -e 's/ %.*//g' | tr -d '\r') + fi + ;; + Terminal=true) + terminal="true" + ;; + OnlyShowIn=*|NoDisplay=true) + nodisplay="true" + ;; + esac + done < "$app" + if [ -n "$nodisplay" ]; + then + continue + fi + if [ -n "$name" -a -n "$exec" ]; then - printf '\t" %s" !"uxterm %s &" \n' "$name" "$exec" - else - printf '\t" %s" !"%s &" \n' "$name" "$exec" + if [ -n "$terminal" ]; + then + printf '\t" %s" !"xterm -class UXTerm -e %s &" \n' "$name" "$exec" + else + printf '\t" %s" !"%s &" \n' "$name" "$exec" + fi fi - fi -done | sort -printf '}\n' + done | sort + printf '}\n' +} + +do_category Accessories +do_category Games +do_category Graphics +do_category Internet +do_category Multimedia +do_category Office +do_category Programming +do_category System +do_category Misc + IFS=$OIFS