Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src add a script for dynamically generating a menu in the ctwm d...



details:   https://anonhg.NetBSD.org/src/rev/96f6ef6b31fc
branches:  trunk
changeset: 955203:96f6ef6b31fc
user:      nia <nia%NetBSD.org@localhost>
date:      Wed Sep 23 15:30:36 2020 +0000

description:
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?

diffstat:

 distrib/sets/lists/xbase/mi             |   3 +-
 external/mit/ctwm/Makefile              |   4 +-
 external/mit/ctwm/libexec/Makefile      |   9 +++++
 external/mit/ctwm/libexec/ctwm_app_menu |  53 +++++++++++++++++++++++++++++++++
 4 files changed, 66 insertions(+), 3 deletions(-)

diffs (103 lines):

diff -r 87e90b37ded4 -r 96f6ef6b31fc distrib/sets/lists/xbase/mi
--- a/distrib/sets/lists/xbase/mi       Wed Sep 23 14:39:23 2020 +0000
+++ b/distrib/sets/lists/xbase/mi       Wed Sep 23 15:30:36 2020 +0000
@@ -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
diff -r 87e90b37ded4 -r 96f6ef6b31fc external/mit/ctwm/Makefile
--- a/external/mit/ctwm/Makefile        Wed Sep 23 14:39:23 2020 +0000
+++ b/external/mit/ctwm/Makefile        Wed Sep 23 15:30:36 2020 +0000
@@ -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
diff -r 87e90b37ded4 -r 96f6ef6b31fc external/mit/ctwm/libexec/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/ctwm/libexec/Makefile        Wed Sep 23 15:30:36 2020 +0000
@@ -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>
diff -r 87e90b37ded4 -r 96f6ef6b31fc external/mit/ctwm/libexec/ctwm_app_menu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/ctwm/libexec/ctwm_app_menu   Wed Sep 23 15:30:36 2020 +0000
@@ -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



Home | Main Index | Thread Index | Old Index