Module Name: src
Committed By: nia
Date: Wed Sep 23 15:30:36 UTC 2020
Modified Files:
src/distrib/sets/lists/xbase: mi
src/external/mit/ctwm: Makefile
Added Files:
src/external/mit/ctwm/libexec: Makefile ctwm_app_menu
Log Message:
add a script for dynamically generating a menu in the ctwm desktop
this parses the files in /usr/pkg/share/applications and provides a
submenu for launching applications.
TODO: make /usr/pkg configurable somehow?
To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/distrib/sets/lists/xbase/mi
cvs rdiff -u -r1.1 -r1.2 src/external/mit/ctwm/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mit/ctwm/libexec/Makefile \
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/distrib/sets/lists/xbase/mi
diff -u src/distrib/sets/lists/xbase/mi:1.156 src/distrib/sets/lists/xbase/mi:1.157
--- src/distrib/sets/lists/xbase/mi:1.156 Sun Feb 23 11:17:03 2020
+++ src/distrib/sets/lists/xbase/mi Wed Sep 23 15:30:36 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.156 2020/02/23 11:17:03 mrg Exp $
+# $NetBSD: mi,v 1.157 2020/09/23 15:30:36 nia Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1262,6 +1262,7 @@
./usr/X11R7/lib/xorg/protocol.txt xbase-x11-lib xorg
./usr/X11R7/libexec base-x11-root xorg
./usr/X11R7/libexec/chooser xbase-chooser-bin xorg
+./usr/X11R7/libexec/ctwm_app_menu xbase-ctwm-bin xorg
./usr/X11R7/man base-x11-root xorg
./usr/X11R7/man/cat1 base-x11-root xorg
./usr/X11R7/man/cat1/appres.0 xbase-appres-catman .cat,xorg
Index: src/external/mit/ctwm/Makefile
diff -u src/external/mit/ctwm/Makefile:1.1 src/external/mit/ctwm/Makefile:1.2
--- src/external/mit/ctwm/Makefile:1.1 Thu Sep 3 22:24:02 2015
+++ src/external/mit/ctwm/Makefile Wed Sep 23 15:30:36 2020
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.1 2015/09/03 22:24:02 youri Exp $
+# $NetBSD: Makefile,v 1.2 2020/09/23 15:30:36 nia Exp $
# Top level Makefile to cross build xorg inside the NetBSD tree.
.include <bsd.own.mk>
-SUBDIR= bin
+SUBDIR= bin libexec
.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
BUILDTARGETS+= cleandir
Added files:
Index: src/external/mit/ctwm/libexec/Makefile
diff -u /dev/null src/external/mit/ctwm/libexec/Makefile:1.1
--- /dev/null Wed Sep 23 15:30:36 2020
+++ src/external/mit/ctwm/libexec/Makefile Wed Sep 23 15:30:36 2020
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2020/09/23 15:30:36 nia Exp $
+
+.include <bsd.own.mk>
+
+SCRIPTS= ctwm_app_menu
+
+SCRIPTSDIR= ${X11ROOTDIR}/libexec
+
+.include <bsd.prog.mk>
Index: src/external/mit/ctwm/libexec/ctwm_app_menu
diff -u /dev/null src/external/mit/ctwm/libexec/ctwm_app_menu:1.1
--- /dev/null Wed Sep 23 15:30:36 2020
+++ src/external/mit/ctwm/libexec/ctwm_app_menu Wed Sep 23 15:30:36 2020
@@ -0,0 +1,53 @@
+#!/bin/sh
+# $NetBSD: ctwm_app_menu,v 1.1 2020/09/23 15:30:36 nia Exp $
+OFS=$IFS
+IFS='
+'
+printf 'menu "appmenu"\n'
+printf '{\n'
+printf '\t"Applications"\tf.title\n'
+for app in $(find /usr/pkg/share/applications -name '*.desktop');
+do
+ name=""
+ exec=""
+ terminal=""
+ nodisplay=""
+ 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
+ if [ -n "$terminal" ];
+ then
+ printf '\t" %s" !"uxterm %s &" \n' "$name" "$exec"
+ else
+ printf '\t" %s" !"%s &" \n' "$name" "$exec"
+ fi
+ fi
+done | sort
+printf '}\n'
+IFS=$OIFS