[openbox] Run dialog

Mikael Magnusson mangosoft at comhem.se
Tue Jun 13 10:17:06 EDT 2006


On Tue, 13 Jun 2006, Myles Green wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Mon, 12 Jun 2006 01:37:18 +0200 (CEST)
> Mikael Magnusson <mangosoft at comhem.se> wrote:
>
>> The other week, I wrote a little shellcode and made a keybinding to turn
>> my terminal and zsh into the fastest and bestest run dialog ever.
>> rc.xml:
>>    <keybind key="W-r">
>>      <action name="execute"><execute>sh -c 'ZSHRUN=1 urxvt -geometry 100x5+335+446'</execute></action>
>>    </keybind>
>>
>> .zshrc:
>> #change the part where you assign HISTFILE to this
>> if [[ -n "$ZSHRUN" ]]
>> then
>>    HISTFILE=~/.zrunhistory
>> else
>>    HISTFILE=~/.history
>> fi
>>
>> #put this somewhere
>> if [[ -n "$ZSHRUN" ]]; then
>>    unset ZSHRUN
>>    function _accept_and_quit() {
>>      zsh -c "${BUFFER}" &|
>>      exit
>>    }
>>    zle -N _accept_and_quit
>>    bindkey "^M" _accept_and_quit
>> fi
>> #if you want to run a command, like cd, without closing the dialog, you
>> #can press ctrl-j instead.
>>
>> #if you have any time consuming commands or ones that print info about
>> new #mail etc, wrap them like this:
>> if [[ ! -n "$ZSHRUN" ]]; then
>>    echo hi
>>    PS1=elaborate\ prompt
>> else
>>    PS1="zshrun %~> "
>> fi
>>
>> now i magically have a run dialog with tab completion, history and ultra
>> fast startup.
>
> This looks totally cool! Thanks for posting it :) I have a couple of
> questions regarding the rc.xml bit though: where should it be located? in
> ~/rc.xml? Should it be named something like ~/zshrunrc.xml? Sorry, my
> shell scripting skills are embarrassingly poor :(

As this is the openbox mailing list, perhaps a good first guess would be 
rc.xml in your openbox config directory, by default ~/.config/openbox/rc.xml
If you happen to use another window manager though, adding something 
similar in their config file should have the wanted effect.

-- 
Mikael Magnusson



More information about the openbox mailing list