9 February 2012 0:00 AM (emacs | hlwm | guile)
I've been trying to get a more emacs~/~stumpwm
-y feel in my window manager since I discovered that I can use xbindkeys
to create
emacs
-like keybindings.
Today I got a little closer to that. I had some bash
scripts that
helped my xbindkeys
setup with things like switching tags and moving
windows, since that involved gathering some information and piping it
into dmenu
.
I figured out how I should do that, though. So now I've changed my
~/.xbindkeys.scm
to include some functions to do that for me. You
could look at it here.
I was having some trouble with calling dmenu
though. I started with
trying to use open-pipe
with OPEN_BOTH
argument so I could first write
to and afterwards read from it. I didn't get it to work, I think it's
because I didn't send an EOF
at the end of the input, but I haven't
found out how to do that yet. I ended up building a string that looks
like echo 'value1\nvalue2\nvalue3\n' | dmenu
and using that with
open-input-pipe
and using read-line
on it. This looks like:
(define list '("value1" "value2" "value3")) (let* ((file (open-input-pipe (string-append "echo '" (string-join list "\n") "' | dmenu"))) (tag (read-line file))) (close-port file)) (display tag)
That will give the result of the dmenu
call, it can be seen in the
choose-tag
function.
Of course you shouldn't forget that tag can still be nil
or something
that isn't in the list, so I use the string?
and member
functions to
check whether I got something at all and if it exists in list
.
Next up will be seeing what I can do with the information at
hand. First idea is to reorder the tags and such as they do in
emacs. I can (easily) keep track of the last picked value and I could
keep an eye on the current value. Another idea, not directly related
to all this is run-or-raise functionality, if I keep track what is
started/moved where I might be able to do that as well, although that
is not emacs
related.