sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 3fd2e2a5626d8c625919a79103937695171a7c52
parent 8329c089a5ddd384c49bca87241bb93714fe1d21
Author: Robert Bilski <robert@rbilski.com>
Date:   Sun, 11 Aug 2024 01:17:13 +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.

Diffstat:
Atools.suckless.org/dmenu/patches/desktoponly/dmenu-desktoponly-20240811-475d809.diff | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtools.suckless.org/dmenu/patches/desktoponly/index.md | 2++
2 files changed, 88 insertions(+), 0 deletions(-)

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 @@ -0,0 +1,86 @@ +From fada397413584331798a1a9b8703a10110450889 Mon Sep 17 00:00:00 2001 +From: Robert Bilski <robert@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 +@@ -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 +@@ -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 +@@ -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 +@@ -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 +@@ -0,0 +1,2 @@ ++#!/bin/sh ++dmenu_path_desktop | dmenu "$@" | 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 @@ -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@gmail.com> +* Robert Bilski - <robert at rbilski com>