[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] Add window title to WINID completion
- To: herbstluftwm _minus_ devel _at_ lists _dot_ sourceforge _dot_ net
- Subject: [PATCH 3/4] Add window title to WINID completion
- From: Gabor Adam Toth <tg _at_ tgbit _dot_ net>
- Date: Tue, 7 Aug 2012 00:34:06 +0200
---
share/_herbstclient | 2 +-
share/herbstclient-completion | 9 ++++++---
src/command.c | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/share/_herbstclient b/share/_herbstclient
index 0741da6..e1b27dd 100644
--- a/share/_herbstclient
+++ b/share/_herbstclient
@@ -6,8 +6,8 @@
#compinit
_herbstclient() {
+ IFS=$'\n'
compadd "$@" $(herbstclient -q complete "$((CURRENT-2))" "${(@)words[ _at_ ]:1}")
}
compdef _herbstclient herbstclient
-
diff --git a/share/herbstclient-completion b/share/herbstclient-completion
index 3140c82..145e145 100644
--- a/share/herbstclient-completion
+++ b/share/herbstclient-completion
@@ -1,13 +1,16 @@
# bash completion for herbstclient
-
_herbstclient_complete() {
+ IFS=$'\n'
COMPREPLY=(
# just call the herbstclient complete .. but without herbstclient as argument
$(herbstclient -q complete "$((COMP_CWORD-1))" "${COMP_WORDS[ _at_ ]:1}")
)
+ i=0
+ for entry in ${COMPREPLY[*]}; do
+ COMPREPLY[$i]=$(printf %q "$entry")
+ (( i++ ))
+ done
}
-
complete -F _herbstclient_complete herbstclient
-
diff --git a/src/command.c b/src/command.c
index fee213a..a8d3a41 100644
--- a/src/command.c
+++ b/src/command.c
@@ -260,7 +260,7 @@ static void add_winid_completion(void* key, HSClient* client, struct wcd* data)
{
char buf[100];
GString** out = data->output;
- snprintf(buf, LENGTH(buf), "0x%lx\n", client->window);
+ snprintf(buf, LENGTH(buf), "0x%lx: %s\n", client->window, client->title->str);
if (!strncmp(buf, data->needle, data->needlelen)) {
*out = g_string_append(*out, buf);
}
--
1.7.8.6