SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-12-13 13:46:56

joek
#! Junkie
Registered: 2011-09-06
Posts: 497

dmenu as file-launcher

Inspired by the Arch Fora's Dmenu Hacking Thread, and especially  this dmenu snippet for vim, I wrote a script to extend this functionality to all files in ~/

dmenufm:

#!/bin/sh
# A fuzzy file-finder and opener based on dmenu
# Requires: dmenu, exo-open
find ~/ | sed 's/ /\\ /g' | sort -f | dmenu -i -l 20 -nb '#2e3436' -nf '#9999CC' | xargs exo-open

However, the first time this is executed after you log on, if you have a large number of files in your home directory, this can take a noticeable amount of time - less than a second, but noticeable.

In order to speed this up, you can use this pair of scripts instead:

dmenufm_path:

#!/bin/sh
find ~/ | sed 's/ /\\ /g' | sort -f > ~/.dmenufm_cache

dmenufm:

#!/bin/sh
# A fuzzy file-finder and opener based on dmenu
# Requires: dmenu, exo-open
cat ~/.dmenufm_cache | dmenu -i -l 20 -nb '#2e3436' -nf '#9999CC' | xargs exo-open

And add this to your autostart script for whichever WM you use:
`exec dmenufm_path &` or equivalent
Making sure, of course, that dmenufm and dmenufm_path are executable and in your PATH.

The problem with the new version comes if you create a large number of files in a session, which will not be added to .dmenufm_cache. Next on the agenda is to extend the script to get around this.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo