sites

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

dmenu-desktoponly-20230805-7ab0cb5.diff (2529B)


      1 From b15cc4ff72165dc24e6d08f4e5ec3a936b079195 Mon Sep 17 00:00:00 2001
      2 From: Maxim Mihaylin <slimbox.sdb@gmail.com>
      3 Date: Sat, 5 Aug 2023 23:26:15 +0600
      4 Subject: [PATCH] Changes dmenu behavior to show only desktop files. It is
      5  recommended to use the patch of the same name for dwm.
      6 
      7 ---
      8  Makefile           | 8 ++++++--
      9  dmenu_path_desktop | 7 +++++++
     10  dmenu_run_desktop  | 2 ++
     11  3 files changed, 15 insertions(+), 2 deletions(-)
     12  create mode 100755 dmenu_path_desktop
     13  create mode 100755 dmenu_run_desktop
     14 
     15 diff --git a/Makefile b/Makefile
     16 index a03a95c..752edc9 100644
     17 --- a/Makefile
     18 +++ b/Makefile
     19 @@ -34,7 +34,7 @@ clean:
     20  dist: clean
     21  	mkdir -p dmenu-$(VERSION)
     22  	cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
     23 -		drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
     24 +		drw.h util.h dmenu_path dmenu_path_desktop dmenu_run dmenu_run_desktop stest.1 $(SRC)\
     25  		dmenu-$(VERSION)
     26  	tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
     27  	gzip dmenu-$(VERSION).tar
     28 @@ -42,10 +42,12 @@ dist: clean
     29  
     30  install: all
     31  	mkdir -p $(DESTDIR)$(PREFIX)/bin
     32 -	cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin
     33 +	cp -f dmenu dmenu_path dmenu_path_desktop dmenu_run dmenu_run_desktop stest $(DESTDIR)$(PREFIX)/bin
     34  	chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
     35  	chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
     36 +	chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path_desktop
     37  	chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
     38 +	chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run_desktop
     39  	chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
     40  	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     41  	sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
     42 @@ -56,7 +58,9 @@ install: all
     43  uninstall:
     44  	rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
     45  		$(DESTDIR)$(PREFIX)/bin/dmenu_path\
     46 +		$(DESTDIR)$(PREFIX)/bin/dmenu_path_desktop\
     47  		$(DESTDIR)$(PREFIX)/bin/dmenu_run\
     48 +		$(DESTDIR)$(PREFIX)/bin/dmenu_run_desktop\
     49  		$(DESTDIR)$(PREFIX)/bin/stest\
     50  		$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
     51  		$(DESTDIR)$(MANPREFIX)/man1/stest.1
     52 diff --git a/dmenu_path_desktop b/dmenu_path_desktop
     53 new file mode 100755
     54 index 0000000..e6b1144
     55 --- /dev/null
     56 +++ b/dmenu_path_desktop
     57 @@ -0,0 +1,7 @@
     58 +#!/bin/bash
     59 +entries=$(ls /usr/share/applications/)
     60 +for entry in $entries; do
     61 +  if [[ $entry == *.desktop ]]; then
     62 +    echo "${entry%.*}"
     63 +  fi
     64 +done;
     65 diff --git a/dmenu_run_desktop b/dmenu_run_desktop
     66 new file mode 100755
     67 index 0000000..410b4b1
     68 --- /dev/null
     69 +++ b/dmenu_run_desktop
     70 @@ -0,0 +1,2 @@
     71 +#!/bin/sh
     72 +dmenu_path_desktop | dmenu "$@" | ${SHELL:-"/bin/sh"} &
     73 -- 
     74 2.40.1
     75