You are not logged in.

#1 2017-08-11 14:16:06

dr1nkus
Member
Registered: 2017-05-09
Posts: 26

[SOLVED] Can dmenu identify aliases?

Hiya all, my question is quite simple: I use dmenu_run as my launcher, but I was wondering if there's a way to make it aware of my aliases (i.e.: I made aliases for command + arguments).

I've found this thread in the Arch forums and discovered that dmenu will not support aliases natively, but it would with a package (Arch wiki post).

But then I came across a Reddit post where a user stated that modifying dmenu_path would do the trick, as shown below:

#!/bin/bash
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
IFS=:
if stest -dqr -n "$cache" $PATH; then
	compgen -ac | sort -u | tee "$cache"
else
	cat "$cache"
fi

I've tried replacing the existing dmenu_path file with the contents above without success.

Can you help out a bit?

Last edited by dr1nkus (2017-08-11 17:58:54)

Offline

#2 2017-08-11 15:53:01

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: [SOLVED] Can dmenu identify aliases?

dr1nkus wrote:

I've found this thread in the Arch forums and discovered that dmenu will not support aliases natively, but it would with a package (Arch wiki post).

The AUR package to which ArchWiki refers simply installs a script to /usr/bin/

Here is the script:

https://github.com/jukil/dmenu-scripts- … nt_aliases

Copy that to /usr/bin/ (or ~/bin/) and make it executable with `chmod +x dmenu_recent_aliases` then run the command.

More here: https://github.com/jukil/dmenu-scripts- … nt-aliases

Offline

#3 2017-08-11 17:58:32

dr1nkus
Member
Registered: 2017-05-09
Posts: 26

Re: [SOLVED] Can dmenu identify aliases?

Thanks a lot Head_on_a_Stick!

In case anyone else may profit from this, I'll post the relevant section of my rc.xml:

    <!-- Keybindings for running applications -->
    <keybind key="C-space">
      <action name="Execute">
        <startupnotify>
          <enabled>false</enabled>
          <name>dmenu-bind</name>
        </startupnotify>
        <command>dmenu_recent_aliases</command>
      </action>
    </keybind>

Offline

Board footer

Powered by FluxBB