Issue with keybind in autostart file.

Rob Pinder rob.pinder at outlook.com
Sun Aug 10 16:31:42 CEST 2014




-------- Forwarded Message --------
Subject: Re: Issue with keybind in autostart file.
Date: Sun, 10 Aug 2014 15:29:45 +0100
From: Rob Pinder <rob.pinder at outlook.com>
To: Thorsten Wißmann <edu at thorsten-wissmann.de>



On 10/08/14 14:58, Thorsten Wißmann wrote:
> Hi Rob,
>
> On Sun, Aug 10, 2014 at 11:27:15AM +0100, Rob Pinder wrote:
>> Comparing the output of hc list_keybinds | grep dme there's a differencein results between
>> the command run in my autostart and the command run in a terminal. Firstresult is for the
>> non-functioning autostart, second is for the working terminal command.Note the extra space
>> added in the font declaration.
>>
>> Mod4+d	spawn	dmenu_run	-q	-h	16	-fn	Ubuntu  Mono-10	-nb	black	-nf	white
>>
>> Mod4+d	spawn	dmenu_run	-q	-h	16	-fn	Ubuntu Mono-10	-nb	black	-nf	white
>>
>> [1] http://hastebin.com/pizobugebo.bash
>
> The problem is the following in your autostart:
>
> hc() {
>      cmds="$cmds , $@"
> }
>
> So you're creating one large string which is tokenized (cut into pieces)
> at the end:
>
> herbstclient chain $cmds&
>
> and your "extra space" actually isn't two spaces but one tab. The
> solution is to let the arrays stay arrays (i.e. don't make strings out
> of them). In autostart, this means:
>
> Replace the hc-definition by:
>
> hc() {
>      cmd+=( , "$@" )
> }
>
> (i.e. cmd is an array of strings and not just a single string). Then
> replace the "fireing" of the array by:
>
> herbstclient chain "${cmd[@]}"
>
> You should omit the "&" because it might be that the panel or loadstate
> depend on settings you have in your autostart.
>
> In general: only do that kind of collecting the hc-commands if you
> really know what you are doing. (It's not recommended and personally I
> don't do that).
>
> Cheers,
> Thorsten
>

Cheers Thorsten, that's fixed it.

Rob.





More information about the hlwm mailing list