[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] Add window title to WINID completion



Hi Gabor,

Thanks for your effort but I won't merge the feature you submitted. The
completion has to complete correct arguments. But your patch produces an
output like that:

  $ herbstclient raise 0x
  0x600009:\ herbstluftwm\ \(~/dev/c/herbstluftwm\)
  0xa00009:\ ~\ \(~\)
  0xc00009:\ /\ \(/\)

And the only reason your patch works is that the sscanf() in the
raise/bring/...-function is very tolerant (maybe too tolerant) and
ignores the window title after the id and the ":". So this is just an
unclean hack (which also also looks ugly because of the quotes) and thus
won't be merged.

For intuitive interactive usage (e.g. bring) one really needs the window
titles. The solution is to first select a window via the id and the
window title using wmctrl and dmenu and then passing it to the bring
command:

  case "$1" in
      bring)
          name=Bring:
          action() {
              herbstclient bring "$@"
              xdotool windowactivate "$@"
          }
          ;;
      select|*)
          action() { xdotool windowactivate "$@" ; }
          name=Select:
          ;;
  esac

  id=$(wmctrl -l | $dmenu_command -l $dmenu_lines -p "$name") \
      && action ${id%% *}

I've bound select to $Mod-semicolon and bring to $Mod-Shift-semicolon
and in my case $dmenu_command is e.g. set to this:

  export dmenu_command="dmenu -i -r -c -rs -ni"

This is in my opinion more usable and much cleaner than adding the
window title to the completion reply (which thus is rejected).

Thorsten