commit cceac22496d7b4f69d1727929a8f667dd2181fa7 from: Benjamin Stürz date: Wed Dec 27 20:58:52 2023 UTC Minor changes - Add dmenu_run_app script (Super+R) - Move from TERM from master.h into config.h - make install: Replace TERM in scripts commit - b74734beb3bcc4e916680531dcc46a6dfb0da2ea commit + cceac22496d7b4f69d1727929a8f667dd2181fa7 blob - 6dcbb0e855c54d7eab0f73588c980e68e97b5e76 blob + 6503128fa94d82c7b7bf817f2407056390a81c09 --- Makefile +++ Makefile @@ -53,7 +53,7 @@ install: cp -f bin/* ${DESTDIR}${PREFIX}/bin/ cp -rf etc/* ${DESTDIR}/etc/ for f in scripts/*; do \ - sed 's#@PREFIX@#${PREFIX}#g; s#@SCRIPTS@#${SCRIPTDIR}#' < $$f \ + sed 's#@PREFIX@#${PREFIX}#g; s#@SCRIPTS@#${SCRIPTDIR}#; s#@TERM@#${TERM}#' < $$f \ > ${DESTDIR}${SCRIPTDIR}/$$(basename $$f); \ chmod +x ${DESTDIR}${SCRIPTDIR}/$$(basename $$f); \ done blob - 3b9838759d05b8255ac6ca041fb315e5d6b06a3f blob + ab93d78825553fe7cc7a7f2ae6bbd2d8e434f279 --- config.mk +++ config.mk @@ -1,9 +1,10 @@ PREFIX = /usr/local MANPREFIX = ${PREFIX}/man SCRIPTDIR = ${PREFIX}/libexec/desktop +TERM = st VERSION = "benni-0.1" -CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DPREFIX=\"${PREFIX}\" -DVERSION=\"${VERSION}\" -DXINERAMA +CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DPREFIX=\"${PREFIX}\" -DVERSION=\"${VERSION}\" -DTERM=\"${TERM}\" -DXINERAMA CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-sign-compare -O2 ${CPPFLAGS} blob - e3fbe7ff99f4dfe9040c243a4e696c8bef68ddc7 blob + 1001f684c7e00b88434bdc34e6fb4973c91ba3c9 --- dwm/config.h +++ dwm/config.h @@ -78,6 +78,7 @@ static const char *xkillcmd[] = { "xkill", NULL }; static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmscript("dmenu_run") } }, + { MODKEY, XK_r, spawn, {.v = dmscript("dmenu_run_app") } }, { MODKEY|ShiftMask, XK_p, spawn, {.v = dmscript("dmenu_pass", "paste") } }, { MODKEY|ControlMask, XK_p, spawn, {.v = dmscript("dmenu_pass", "copy") } }, { MODKEY, XK_a, spawn, {.v = dmscript("dmenu_pass", "login_tab") } }, blob - 506e665ade72b852722dc1eb7b5a00581ffe5f8f blob + 42274df1731f0174eb3ebd0a0b28cbb082e5267d --- master.h +++ master.h @@ -1,5 +1,4 @@ #define BUGREPORT "Benjamin Stürz " #define TOPBAR_FONT "monospace:size=6" -#define TERM "st" #define UNUSED __attribute__((unused)) blob - /dev/null blob + 87f11d42272b8c625809cfe2d2639cf9e5efbdab (mode 755) --- /dev/null +++ scripts/dmenu_run_app @@ -0,0 +1,28 @@ +#!/bin/sh + +apps() { + for f in /usr/local/share/applications/*.desktop; do + name=$(grep -m1 '^Name=' "$f" | sed 's/^Name=//') + [ "$name" ] && printf '%s;%s\n' "$f" "$name" + done +} + +run() { + grep -m1 '^Exec=' "$app" | sed 's/^Exec=//; s/%.//g; s/[[:space:]]*#//; s/\\\\/\\/g' +} + +app=$(apps | sort -uft ';' -k2 | dmenu -i -S -F -d ';' -l 20) +[ -e "$app" ] || exit 1 + +run + +shell=${SHELL:-"/bin/sh"} + +if grep -q '^Terminal=true$' "$app"; then + cmd=$(mktemp) + run > "$cmd" + printf '\nrm -f "%s"\n' "$cmd" >> "$cmd" + exec @TERM@ -e sh "$cmd" +else + run | "$shell" +fi