You are not logged in.

#1 2013-08-04 22:22:38

DeletedUser210719
Banned
Registered: 2012-04-20
Posts: 68

[SOLVED] Changing Dmenu_run Behavior

I use gmrun to run graphical programs without having them attached to a console.  I would like to use dmenu_run instead, but every time I start a program with dmenu_run, it looks like it creates and forks a bash process.

To illustrate, here is the relevant pstree output from both methods:

Gmrun:

systemd───login───startx───xinit─┬─X
                                 └─openbox───leafpad

Dmenu_run:

systemd───bash───leafpad

Is there any way to have dmenu/dmenu_run fork the WM process like gmrun? (I refer to WM in general because this occurs in DWM as well)

Last edited by DeletedUser210719 (2013-08-10 14:46:12)

Offline

#2 2013-08-04 22:40:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: [SOLVED] Changing Dmenu_run Behavior

dmenu_run is a very short script.  Just edit it.  Remove the | ${SHELL:-/usr/bin/bash} on the last line and "exec" the result of the subshell in parentheses.

#!/bin/sh
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
	cache=$cachedir/dmenu_run
else
	cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
exec $(
	IFS=:
	if stest -dqr -n "$cache" $PATH; then
		stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@"
	else
		dmenu "$@" < "$cache"
	fi
)

Last edited by Trilby (2013-08-04 22:45:27)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB