commit 3fd2e2a5626d8c625919a79103937695171a7c52
Author: Robert Bilski <robert_AT_rbilski.com>
Date: Sun Aug 11 01:17:13 2024 +0200
[dmenu][patch][desktoponly] Improve retrieving files and use gtk-launch
Added an alternative patch implementation that respects XDG_DATA_DIRS and
uses gtk-launch to launch the .desktop files.
diff --git a/tools.suckless.org/dmenu/patches/desktoponly/dmenu-desktoponly-20240811-475d809.diff b/tools.suckless.org/dmenu/patches/desktoponly/dmenu-desktoponly-20240811-475d809.diff
new file mode 100644
index 00000000..bc6698e3
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/desktoponly/dmenu-desktoponly-20240811-475d809.diff
_AT_@ -0,0 +1,86 @@
+From fada397413584331798a1a9b8703a10110450889 Mon Sep 17 00:00:00 2001
+From: Robert Bilski <robert_AT_rbilski.com>
+Date: Sun, 4 Aug 2024 22:07:35 +0200
+Subject: [PATCH] Handle .desktop files
+
+Retrieve files from applications/ and open them using gtk-launch
+---
+ Makefile | 8 ++++++--
+ dmenu_path_desktop | 18 ++++++++++++++++++
+ dmenu_run_desktop | 2 ++
+ 3 files changed, 26 insertions(+), 2 deletions(-)
+ create mode 100755 dmenu_path_desktop
+ create mode 100755 dmenu_run_desktop
+
+diff --git a/Makefile b/Makefile
+index 458c524..f157bb1 100644
+--- a/Makefile
++++ b/Makefile
+_AT_@ -28,7 +28,7 @@ clean:
+ dist: clean
+ mkdir -p dmenu-$(VERSION)
+ cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
+- drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
++ drw.h util.h dmenu_path dmenu_path_desktop dmenu_run dmenu_run_desktop stest.1 $(SRC)\
+ dmenu-$(VERSION)
+ tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
+ gzip dmenu-$(VERSION).tar
+_AT_@ -36,10 +36,12 @@ dist: clean
+
+ install: all
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+- cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin
++ cp -f dmenu dmenu_path dmenu_path_desktop dmenu_run dmenu_run_desktop stest $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
++ chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path_desktop
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
++ chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run_desktop
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
+ mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+ sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
+_AT_@ -50,7 +52,9 @@ install: all
+ uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
+ $(DESTDIR)$(PREFIX)/bin/dmenu_path\
++ $(DESTDIR)$(PREFIX)/bin/dmenu_path_desktop\
+ $(DESTDIR)$(PREFIX)/bin/dmenu_run\
++ $(DESTDIR)$(PREFIX)/bin/dmenu_run_desktop\
+ $(DESTDIR)$(PREFIX)/bin/stest\
+ $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
+ $(DESTDIR)$(MANPREFIX)/man1/stest.1
+diff --git a/dmenu_path_desktop b/dmenu_path_desktop
+new file mode 100755
+index 0000000..5ff74b3
+--- /dev/null
++++ b/dmenu_path_desktop
+_AT_@ -0,0 +1,18 @@
++#!/bin/sh
++
++cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}"
++cache="$cachedir/dmenu_run_desktop"
++
++[ ! -e "$cachedir" ] && mkdir -p "$cachedir"
++
++dirs=""
++IFS=:
++for dir in "${XDG_DATA_DIRS:-"/usr/local/share:/usr/share"}"; do
++ dirs="${dirs}:${dir}/applications"
++done;
++
++if stest -dqr -n "$cache" $PATH; then
++ stest -fl $dirs | grep -v 'mimeinfo.cache' | sed 's/\.[^./]*$//' | sort -u | tee "$cache"
++else
++ cat "$cache"
++fi
+diff --git a/dmenu_run_desktop b/dmenu_run_desktop
+new file mode 100755
+index 0000000..a90aceb
+--- /dev/null
++++ b/dmenu_run_desktop
+_AT_@ -0,0 +1,2 @@
++#!/bin/sh
++dmenu_path_desktop | dmenu "$_AT_" | xargs gtk-launch &
+--
+2.46.0
+
diff --git a/tools.suckless.org/dmenu/patches/desktoponly/index.md b/tools.suckless.org/dmenu/patches/desktoponly/index.md
index 3088133f..81524d5c 100644
--- a/tools.suckless.org/dmenu/patches/desktoponly/index.md
+++ b/tools.suckless.org/dmenu/patches/desktoponly/index.md
_AT__AT_ -12,8 +12,10 @@ It is recommended to use with a patch [desktoponly](
https://dwm.suckless.org/pat
Download
--------
* [dmenu-desktoponly-20230805-7ab0cb5.diff](dmenu-desktoponly-20230805-7ab0cb5.diff) (2.5K) (2023-08-05)
+* [dmenu-desktoponly-20240811-475d809.diff](dmenu-desktoponly-20240811-475d809.diff) (2.8K) (2024-08-11)
Author
------
* Maxim Mihaylin - <slimbox.sdb_AT_gmail.com>
+* Robert Bilski - <robert at rbilski com>
Received on Sun Aug 11 2024 - 01:20:37 CEST