From me at the-compiler.org Wed Jun 11 21:09:27 2014 From: me at the-compiler.org (Florian Bruhin) Date: Wed, 11 Jun 2014 21:09:27 +0200 Subject: [PATCH] Add -- to zsh compadd Message-ID: <20140611190927.GX19485@lupin> As discussed in IRC, see attached patch :) -- http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP) GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-to-zsh-compadd.patch Type: text/x-diff Size: 923 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From edu at thorsten-wissmann.de Wed Jun 11 21:19:06 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 11 Jun 2014 21:19:06 +0200 Subject: [PATCH] Add -- to zsh compadd In-Reply-To: <20140611190927.GX19485@lupin> References: <20140611190927.GX19485@lupin> Message-ID: <20140611191906.GB28434@hoth.roethelheim.stw.uni-erlangen.de> On Wed, Jun 11, 2014 at 09:09:27PM +0200, Florian Bruhin wrote: > - compadd -QS '' "$@" $(herbstclient -q complete_shell "$((CURRENT-2))" "${(@)words[@]:1}") > + compadd -QS '' -- "$@" $(herbstclient -q complete_shell "$((CURRENT-2))" "${(@)words[@]:1}") Looks reasonable. 68aa44a Add -- to zsh compadd. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From snabieel at gmail.com Thu Jun 12 02:03:11 2014 From: snabieel at gmail.com (Suhaib Nabeil) Date: Wed, 11 Jun 2014 20:03:11 -0400 Subject: Eclipse 4.3 doesn't work with herbstluftwm... Message-ID: I'm using the version of herbstluftwm which is found Ubuntu 14.04 repo. Then I downloaded the latest version of eclipse from their website and tried to run it but it didn't run well. Here is a screenshot of it: http://imgur.com/QmmubV8 The space between below the grey window cannot be removed. It is as if there is an invisible window that is taking this place I switch to Unity and run the eclipse from there and there weren't any problem. I also installed eclipse from the repo and it worked in herb window. It might be worth mentioning that I'm using dark theme of eclipse. Here is a screenshot of the theme: http://imgur.com/cwFTeZb The source of the theme:https://github.com/guari/eclipse-ui-theme -------------- next part -------------- An HTML attachment was scrubbed... URL: From manuel at mzerpies.de Thu Jun 12 08:31:10 2014 From: manuel at mzerpies.de (manuel at mzerpies.de) Date: Thu, 12 Jun 2014 08:31:10 +0200 Subject: Eclipse 4.3 doesn't work with herbstluftwm... In-Reply-To: References: Message-ID: <20140612063110.GA12705@mzerpies.de> Hi Suhaib, have you tried to set the wmname to "LG3D" like in xmonad or so? To do this use the command "wmname LG3D". Maybe you have to install suckless-tools to get the command wmname. Have a nice day, Manuel On Wed, Jun 11, 2014 at 08:03:11PM -0400, Suhaib Nabeil wrote: > I'm using the version of herbstluftwm which is found Ubuntu 14.04 repo. > > Then I downloaded the latest version of eclipse from their website and > tried to run it but it didn't run well. Here is a screenshot of it: > http://imgur.com/QmmubV8 > > The space between below the grey window cannot be removed. It is as if > there is an invisible window that is taking this place > > > I switch to Unity and run the eclipse from there and there weren't any > problem. > > I also installed eclipse from the repo and it worked in herb window. > > > It might be worth mentioning that I'm using dark theme of eclipse. Here is > a screenshot of the theme: http://imgur.com/cwFTeZb > > The source of the theme:https://github.com/guari/eclipse-ui-theme -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From me at the-compiler.org Thu Jun 12 08:49:11 2014 From: me at the-compiler.org (Florian Bruhin) Date: Thu, 12 Jun 2014 08:49:11 +0200 Subject: Eclipse 4.3 doesn't work with herbstluftwm... In-Reply-To: <20140612063110.GA12705@mzerpies.de> References: <20140612063110.GA12705@mzerpies.de> Message-ID: <20140612064911.GB19485@lupin> Whoops, noticed I didn't write my earlier mail to the list. * manuel at mzerpies.de [2014-06-12 08:31:10 +0200]: > Hi Suhaib, > > have you tried to set the wmname to "LG3D" like in xmonad or so? > > To do this use the command "wmname LG3D". Maybe you have to install > suckless-tools to get the command wmname. > > Have a nice day, > Manuel No need for wmname/suckless-tools, simply "hc set wmname LG3D" will do the job ;) Florian -- http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP) GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From hnknta at gmail.com Mon Jun 23 17:27:49 2014 From: hnknta at gmail.com (=?UTF-8?B?0J3QuNC60LjRgtCw?=) Date: Mon, 23 Jun 2014 18:27:49 +0300 Subject: panel.sh Message-ID: Hello! Line 121 in file panel.sh: right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') sed regex are drop line with cyrillic symbols. Unfortunately I don't know sed regex syntax. please help me if you can -------------- next part -------------- An HTML attachment was scrubbed... URL: From edu at thorsten-wissmann.de Mon Jun 23 19:24:53 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Mon, 23 Jun 2014 19:24:53 +0200 Subject: panel.sh In-Reply-To: References: Message-ID: <20140623172453.GB2333@ghul> Hi ??????, On Mon, Jun 23, 2014 at 06:27:49PM +0300, ?????? wrote: > Hello! Line 121 in file panel.sh: > right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') > sed regex are drop line with cyrillic symbols. Unfortunately I don't know > sed regex syntax. please help me if you can Can you give me an example text where the cyrillic symbols are dropped? I tried the following but no symbols where lost: $ right='??????' $ right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') $ echo $right_text_only ?????? Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From flo at geekplace.eu Wed Jun 25 11:33:51 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 11:33:51 +0200 Subject: hlwm patches Message-ID: <1403688835-22967-1-git-send-email-flo@geekplace.eu> Hi, Patch 1 und 2 are meant to extend herbstclient when used as message source for a panel applet. For example you can now use herbstclient -0 -l -i '(focus_changed|window_title_changed)' as *null character* delimited String source of the current window title. Side Note: I'm currently building such an applet for mate, gnome2/3 and xfce4. Patch 3 is simply another FAQ entry bragging about how easy it is to create a IM layout with just a few lines of 'herbstclient' code, where other window managers need whole modules. :) Finally Patch 4 is a dmenu run script that places the windows in the tag that was active at the time the script was invoked. Best Florian From flo at geekplace.eu Wed Jun 25 11:33:54 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 11:33:54 +0200 Subject: [PATCH 3/4] Add FAQ entry about IM layout In-Reply-To: <1403688835-22967-1-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> Message-ID: <1403688835-22967-4-git-send-email-flo@geekplace.eu> --- www/faq.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/faq.txt b/www/faq.txt index 89459dd..354be69 100644 --- a/www/faq.txt +++ b/www/faq.txt @@ -121,6 +121,16 @@ hc rule class=Gimp windowrole=gimp-toolbox focus=off index=00 hc rule class=Gimp windowrole=gimp-dock focus=off index=1 ---- +Q: What about an layout for Instant Messaging applications (Gajim, Pidgin, ?)? +------------------------------------------------------------------------------ +A good layout for Instant Messaging applications where one frame on the left displays the roster, consuming ~15% of the monitor space, while the right side is used for the conversations can be configured easily with herbstluftwm. The following example configures such a layout on tag '7' and creates the rules to automatically move Gajim's windows to the right frame: + +---- +hc load 7 '(split horizontal:0.15:1 (clients horizontal:0) (clients grid:4))' +hc rule class="Gajim" tag=7 index=1 +hc rule class="Gajim" windowrole="roster" tag=7 index=0 +---- + [[TEMP_RULES]] Q: How can I add rules temporarily for some special clients? -- 1.9.1 From flo at geekplace.eu Wed Jun 25 11:33:55 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 11:33:55 +0200 Subject: [PATCH 4/4] Add share/dmenu_run_hlwm In-Reply-To: <1403688835-22967-1-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> Message-ID: <1403688835-22967-5-git-send-email-flo@geekplace.eu> --- Makefile | 2 ++ share/dmenu_run_hlwm | 38 ++++++++++++++++++++++++++++++++++++++ www/faq.txt | 22 ++++++++++++++++++++-- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100755 share/dmenu_run_hlwm diff --git a/Makefile b/Makefile index 43ac860..ebaf151 100644 --- a/Makefile +++ b/Makefile @@ -125,6 +125,7 @@ install-nodoc: all-nodoc $(INSTALL) -m 644 share/herbstclient-completion '$(DESTDIR)$(BASHCOMPLETIONDIR)/' $(INSTALL) -m 644 share/_herbstclient '$(DESTDIR)$(ZSHCOMPLETIONDIR)/' $(INSTALL) -m 644 share/herbstluftwm.desktop '$(DESTDIR)$(XSESSIONSDIR)/' + $(INSTALL) -m 755 share/dmenu_run_hlwm '$(DESTDIR)$(BINDIR)/' $(INSTALL) -m 644 scripts/README '$(DESTDIR)$(EXAMPLESDIR)/' $(INSTALL) -m 755 scripts/*.sh '$(DESTDIR)$(EXAMPLESDIR)/' @@ -133,6 +134,7 @@ install-nodoc: all-nodoc uninstall: @echo "==> deleting files..." -$(foreach TARGET,$(TARGETS),$(RM) '$(DESTDIR)$(BINDIR)/$(TARGET)';) + -$(RM) '$(DESTDIR)$(BINDIR)/dmenu_run_hlwm' -$(RM) '$(DESTDIR)$(LICENSEDIR)/LICENSE' -$(RM) '$(DESTDIR)$(MAN1DIR)/herbstclient.1' -$(RM) '$(DESTDIR)$(MAN1DIR)/herbstluftwm.1' diff --git a/share/dmenu_run_hlwm b/share/dmenu_run_hlwm new file mode 100755 index 0000000..ec20972 --- /dev/null +++ b/share/dmenu_run_hlwm @@ -0,0 +1,38 @@ +#!/bin/bash + +if ! command -v dmenu > /dev/null 2>/dev/null ; then + echo "Error: Requirement dmenu not found in your PATH." >&2 + exit 1 +fi + +# Get the currently active tag +tag=$(herbstclient attr tags.focus.name) + +# Prints the path of of the binary in path selected by dmenu +dmenuPrintPath() { + cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} + if [ -d "$cachedir" ]; then + cache=$cachedir/dmenu_run + else + cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~ + fi + IFS=: + if stest -dqr -n "$cache" $PATH; then + stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@" + else + dmenu "$@" < "$cache" + fi +} + +selectedPath=$(dmenuPrintPath) + +# Ensure that the tag exists +herbstclient add "$tag" + +# Move next window from this process to this tag. Prepend the rule so +# that it may be overwritten by existing custom rules e.g. in the +# autostart. Also set a maximum age for this rule of 120 seconds and +# mark it as one-time-only rule. +herbstclient rule prepend maxage="120" pid="$$" tag="$tag" once + +exec $selectedPath diff --git a/www/faq.txt b/www/faq.txt index 354be69..fbe5e3d 100644 --- a/www/faq.txt +++ b/www/faq.txt @@ -123,7 +123,13 @@ hc rule class=Gimp windowrole=gimp-dock focus=off index=1 Q: What about an layout for Instant Messaging applications (Gajim, Pidgin, ?)? ------------------------------------------------------------------------------ -A good layout for Instant Messaging applications where one frame on the left displays the roster, consuming ~15% of the monitor space, while the right side is used for the conversations can be configured easily with herbstluftwm. The following example configures such a layout on tag '7' and creates the rules to automatically move Gajim's windows to the right frame: + +A good layout for Instant Messaging applications. where one frame on +the left displays the roster and consuming ~15% of the monitor space +while the right side is used for the conversations, can be configured +easily with herbstluftwm. The following example configures such a +layout on tag '7' and creates the rules to automatically move Gajim's +windows to the right frame: ---- hc load 7 '(split horizontal:0.15:1 (clients horizontal:0) (clients grid:4))' @@ -131,7 +137,6 @@ hc rule class="Gajim" tag=7 index=1 hc rule class="Gajim" windowrole="roster" tag=7 index=0 ---- - [[TEMP_RULES]] Q: How can I add rules temporarily for some special clients? ------------------------------------------------------------ @@ -250,3 +255,16 @@ Q: I'm using a compositing manager like xcompmgr and get ugly artifacts when swi You probably have an old version of herbstluftwm and +frame_bg_transparent+ enabled. Disable this setting and use +frame_active_opacity+ and/or +frame_normal_opacity+ instead or upgrade to the current git version. + +Q: How can I keybind a simple "Run" dialog? +------------------------------------------- +Install dmenu and keybind +dmenu_run_hlwm+ by adding the following line to +your autostart file: + +---- +hc keybind $Mod-p spawn dmenu_run_hlwm +---- + +Note that +$Mod-p+ is bound to +pseudotile toggle+ in the default +autostart of herbstluftwm, so you either need to change that binding or +use a different one for +spawn dmenu_run_hlwm+. -- 1.9.1 From flo at geekplace.eu Wed Jun 25 11:33:52 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 11:33:52 +0200 Subject: [PATCH 1/4] Add '-0 / --print0' to herbstclient In-Reply-To: <1403688835-22967-1-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> Message-ID: <1403688835-22967-2-git-send-email-flo@geekplace.eu> --- doc/herbstclient.txt | 3 +++ ipc-client/main.c | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/herbstclient.txt b/doc/herbstclient.txt index ceb3282..2b2173d 100644 --- a/doc/herbstclient.txt +++ b/doc/herbstclient.txt @@ -35,6 +35,9 @@ OPTIONS *-n*, *--no-newline*:: Do not print a newline if output does not end with a newline. +*-0*, *--print0*:: + Use the null character as output delimiter. This option implies *-n*. + *-i*, *--idle*:: Wait for hooks instead of executing commands. diff --git a/ipc-client/main.c b/ipc-client/main.c index 61471d8..2df482f 100644 --- a/ipc-client/main.c +++ b/ipc-client/main.c @@ -24,6 +24,7 @@ void init_hook_regex(int argc, char* argv[]); void destroy_hook_regex(); int g_ensure_newline = 1; // if set, output ends with a newline +bool g_null_char_as_delim = false; // if true, the null character is used as delimiter int g_wait_for_hook = 0; // if set, do not execute command but wait bool g_quiet = false; regex_t* g_hook_regex = NULL; @@ -80,6 +81,8 @@ void print_help(char* command, FILE* file) { "Options:\n" "\t-n, --no-newline: Do not print a newline if output does not end " "with a newline.\n" + "\t-0, --print0: Use the null character as output delimiter. " + "This option implies '-n'.\n" "\t-i, --idle: Wait for hooks instead of executing commands.\n" "\t-w, --wait: Same as --idle but exit after first --count hooks.\n" "\t-c, --count COUNT: Let --wait exit after COUNT hooks were " @@ -129,7 +132,11 @@ int main_hook(int argc, char* argv[]) { for (int i = 0; i < hook_argc; i++) { printf("%s%s", i ? "\t" : "", hook_argv[i]); } - printf("\n"); + if (g_null_char_as_delim) { + putchar(0); + } else { + printf("\n"); + } fflush(stdout); } argv_free(hook_argc, hook_argv); @@ -151,6 +158,7 @@ int main_hook(int argc, char* argv[]) { int main(int argc, char* argv[]) { static struct option long_options[] = { {"no-newline", 0, 0, 'n'}, + {"print0", 0, 0, '0'}, {"wait", 0, 0, 'w'}, {"count", 1, 0, 'c'}, {"idle", 0, 0, 'i'}, @@ -162,7 +170,7 @@ int main(int argc, char* argv[]) { // parse options while (1) { int option_index = 0; - int c = getopt_long(argc, argv, "+nwc:iqhv", long_options, &option_index); + int c = getopt_long(argc, argv, "+n0wc:iqhv", long_options, &option_index); if (c == -1) break; switch (c) { case 'i': @@ -179,6 +187,11 @@ int main(int argc, char* argv[]) { case 'n': g_ensure_newline = 0; break; + case '0': + g_null_char_as_delim = true; + // '-0' implies '-n' + g_ensure_newline = 0; + break; case 'q': g_quiet = true; break; @@ -217,7 +230,9 @@ int main(int argc, char* argv[]) { file = stderr; } fputs(output->str, file); - if (g_ensure_newline) { + if (g_null_char_as_delim) { + fputc(0, file); + } else if (g_ensure_newline) { if (output->len > 0 && output->str[output->len - 1] != '\n') { fputs("\n", file); } -- 1.9.1 From flo at geekplace.eu Wed Jun 25 11:33:53 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 11:33:53 +0200 Subject: [PATCH 2/4] Add '-l / --last-arg' to herbstclient In-Reply-To: <1403688835-22967-1-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> Message-ID: <1403688835-22967-3-git-send-email-flo@geekplace.eu> --- doc/herbstclient.txt | 3 +++ ipc-client/main.c | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/herbstclient.txt b/doc/herbstclient.txt index 2b2173d..28c83d5 100644 --- a/doc/herbstclient.txt +++ b/doc/herbstclient.txt @@ -38,6 +38,9 @@ OPTIONS *-0*, *--print0*:: Use the null character as output delimiter. This option implies *-n*. +*-l*, *--last-arg*:: + When using *-i* or *-w*, only print the last argument of the hook. + *-i*, *--idle*:: Wait for hooks instead of executing commands. diff --git a/ipc-client/main.c b/ipc-client/main.c index 2df482f..51c4048 100644 --- a/ipc-client/main.c +++ b/ipc-client/main.c @@ -25,6 +25,7 @@ void destroy_hook_regex(); int g_ensure_newline = 1; // if set, output ends with a newline bool g_null_char_as_delim = false; // if true, the null character is used as delimiter +bool g_print_last_arg_only = false; // if true, prints only the last argument of a hook int g_wait_for_hook = 0; // if set, do not execute command but wait bool g_quiet = false; regex_t* g_hook_regex = NULL; @@ -83,6 +84,7 @@ void print_help(char* command, FILE* file) { "with a newline.\n" "\t-0, --print0: Use the null character as output delimiter. " "This option implies '-n'.\n" + "\t-l, --last-arg: Print only the last argument of a hook.\n" "\t-i, --idle: Wait for hooks instead of executing commands.\n" "\t-w, --wait: Same as --idle but exit after first --count hooks.\n" "\t-c, --count COUNT: Let --wait exit after COUNT hooks were " @@ -128,9 +130,14 @@ int main_hook(int argc, char* argv[]) { } } if (print_signal) { - // just print as list - for (int i = 0; i < hook_argc; i++) { - printf("%s%s", i ? "\t" : "", hook_argv[i]); + if (g_print_last_arg_only) { + // This assumes that hook_argc is always > 0! + printf("%s", hook_argv[hook_argc-1]); + } else { + // just print as list + for (int i = 0; i < hook_argc; i++) { + printf("%s%s", i ? "\t" : "", hook_argv[i]); + } } if (g_null_char_as_delim) { putchar(0); @@ -159,6 +166,7 @@ int main(int argc, char* argv[]) { static struct option long_options[] = { {"no-newline", 0, 0, 'n'}, {"print0", 0, 0, '0'}, + {"last-arg", 0, 0, 'l'}, {"wait", 0, 0, 'w'}, {"count", 1, 0, 'c'}, {"idle", 0, 0, 'i'}, @@ -170,7 +178,7 @@ int main(int argc, char* argv[]) { // parse options while (1) { int option_index = 0; - int c = getopt_long(argc, argv, "+n0wc:iqhv", long_options, &option_index); + int c = getopt_long(argc, argv, "+n0lwc:iqhv", long_options, &option_index); if (c == -1) break; switch (c) { case 'i': @@ -192,6 +200,9 @@ int main(int argc, char* argv[]) { // '-0' implies '-n' g_ensure_newline = 0; break; + case 'l': + g_print_last_arg_only = true; + break; case 'q': g_quiet = true; break; -- 1.9.1 From edu at thorsten-wissmann.de Wed Jun 25 12:21:27 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 25 Jun 2014 12:21:27 +0200 Subject: [PATCH 1/4] Add '-0 / --print0' to herbstclient In-Reply-To: <1403688835-22967-2-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> <1403688835-22967-2-git-send-email-flo@geekplace.eu> Message-ID: <20140625102127.GA17858@hoth.roethelheim.stw.uni-erlangen.de> Hi Florian, On Wed, Jun 25, 2014 at 11:33:52AM +0200, Florian Schmaus wrote: > *-n*, *--no-newline*:: > Do not print a newline if output does not end with a newline. > > +*-0*, *--print0*:: > + Use the null character as output delimiter. This option implies *-n*. That isn't stated quite clear in the man page (my mistake). The -n option only affects the mode of executing some hlwm command but not the mode of listening for hooks (So I have to fix this later). Furthermore, I don't know what an ouptut delimiter is: is it the delimiter between hooks or between the arguments of a hook? > + case '0': > + g_null_char_as_delim = true; > + // '-0' implies '-n' > + g_ensure_newline = 0; > + break; As stated above, g_ensure_newline never occurs in the hook-code, so we can just drop this. > - if (g_ensure_newline) { > + if (g_null_char_as_delim) { > + fputc(0, file); > + } else if (g_ensure_newline) { Well this code is senseless: 'hc -0 CMD' acts like 'hc CMD' and then appends the null-byte to its output. If you don't have an application where you need this, I'd suggest: - make -0 affect only the --idle/--wait mode - state it clear in the man page - adjust code accordingly If you want me to do that (in your name) while applying your patch, just ping me via irc/mail. Otherwise just resubmit the new patch. Afterwards I'll merge the --last-arg-patch (it looks fine). Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 213 bytes Desc: not available URL: From edu at thorsten-wissmann.de Wed Jun 25 12:28:25 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 25 Jun 2014 12:28:25 +0200 Subject: [PATCH 3/4] Add FAQ entry about IM layout In-Reply-To: <1403688835-22967-4-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> <1403688835-22967-4-git-send-email-flo@geekplace.eu> Message-ID: <20140625102825.GA22420@hoth.roethelheim.stw.uni-erlangen.de> Hi Florian, Thanks, it's now in the online faq[1]. I've also added my setup for pidgin. Cheers, Thorsten [1] http://herbstluftwm.org/faq.html#_q_what_about_an_layout_for_instant_messaging_applications_gajim_pidgin -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 213 bytes Desc: not available URL: From edu at thorsten-wissmann.de Wed Jun 25 12:41:26 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 25 Jun 2014 12:41:26 +0200 Subject: [PATCH 4/4] Add share/dmenu_run_hlwm In-Reply-To: <1403688835-22967-5-git-send-email-flo@geekplace.eu> References: <1403688835-22967-1-git-send-email-flo@geekplace.eu> <1403688835-22967-5-git-send-email-flo@geekplace.eu> Message-ID: <20140625104126.GB22420@hoth.roethelheim.stw.uni-erlangen.de> Hi Flo, On Wed, Jun 25, 2014 at 11:33:55AM +0200, Florian Schmaus wrote: > --- a/www/faq.txt > +++ b/www/faq.txt > @@ -123,7 +123,13 @@ hc rule class=Gimp windowrole=gimp-dock focus=off index=1 > > Q: What about an layout for Instant Messaging applications (Gajim, Pidgin, ?)? > ------------------------------------------------------------------------------ > -A good layout for Instant Messaging [?] > + > +A good layout for Instant Messaging applications. where one frame on > +the left displays the roster and consuming ~15% of the monitor [?] > > - > [[TEMP_RULES]] > Q: How can I add rules temporarily for some special clients? > ------------------------------------------------------------ I guess these two hunks are junk ;) I'll discard them for the current commit but will use your new Pidgin-FAQ-phrasing. It's now merged as afe35f4. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 213 bytes Desc: not available URL: From flo at geekplace.eu Wed Jun 25 13:09:42 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 13:09:42 +0200 Subject: hlwm patches V@ Message-ID: <1403694584-12368-1-git-send-email-flo@geekplace.eu> Hi, Re-worked my previos Patch 1 so that - '-0' to only affects output when run in --idle/--wait mode - clarified '-0' documentation: "delimiter between the output of hooks" Best Florian From flo at geekplace.eu Wed Jun 25 13:09:43 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 13:09:43 +0200 Subject: [PATCH 1/2] Add '-0 / --print0' to herbstclient In-Reply-To: <1403694584-12368-1-git-send-email-flo@geekplace.eu> References: <1403694584-12368-1-git-send-email-flo@geekplace.eu> Message-ID: <1403694584-12368-2-git-send-email-flo@geekplace.eu> --- doc/herbstclient.txt | 3 +++ ipc-client/main.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/herbstclient.txt b/doc/herbstclient.txt index ceb3282..8375607 100644 --- a/doc/herbstclient.txt +++ b/doc/herbstclient.txt @@ -35,6 +35,9 @@ OPTIONS *-n*, *--no-newline*:: Do not print a newline if output does not end with a newline. +*-0*, *--print0*:: + Use the null character as delimiter between the output of hooks. + *-i*, *--idle*:: Wait for hooks instead of executing commands. diff --git a/ipc-client/main.c b/ipc-client/main.c index 61471d8..ff3557f 100644 --- a/ipc-client/main.c +++ b/ipc-client/main.c @@ -24,6 +24,7 @@ void init_hook_regex(int argc, char* argv[]); void destroy_hook_regex(); int g_ensure_newline = 1; // if set, output ends with a newline +bool g_null_char_as_delim = false; // if true, the null character is used as delimiter int g_wait_for_hook = 0; // if set, do not execute command but wait bool g_quiet = false; regex_t* g_hook_regex = NULL; @@ -80,6 +81,8 @@ void print_help(char* command, FILE* file) { "Options:\n" "\t-n, --no-newline: Do not print a newline if output does not end " "with a newline.\n" + "\t-0, --print0: Use the null character as delimiter between the " + "output of hooks.\n" "\t-i, --idle: Wait for hooks instead of executing commands.\n" "\t-w, --wait: Same as --idle but exit after first --count hooks.\n" "\t-c, --count COUNT: Let --wait exit after COUNT hooks were " @@ -129,7 +132,11 @@ int main_hook(int argc, char* argv[]) { for (int i = 0; i < hook_argc; i++) { printf("%s%s", i ? "\t" : "", hook_argv[i]); } - printf("\n"); + if (g_null_char_as_delim) { + putchar(0); + } else { + printf("\n"); + } fflush(stdout); } argv_free(hook_argc, hook_argv); @@ -151,6 +158,7 @@ int main_hook(int argc, char* argv[]) { int main(int argc, char* argv[]) { static struct option long_options[] = { {"no-newline", 0, 0, 'n'}, + {"print0", 0, 0, '0'}, {"wait", 0, 0, 'w'}, {"count", 1, 0, 'c'}, {"idle", 0, 0, 'i'}, @@ -162,7 +170,7 @@ int main(int argc, char* argv[]) { // parse options while (1) { int option_index = 0; - int c = getopt_long(argc, argv, "+nwc:iqhv", long_options, &option_index); + int c = getopt_long(argc, argv, "+n0wc:iqhv", long_options, &option_index); if (c == -1) break; switch (c) { case 'i': @@ -179,6 +187,9 @@ int main(int argc, char* argv[]) { case 'n': g_ensure_newline = 0; break; + case '0': + g_null_char_as_delim = true; + break; case 'q': g_quiet = true; break; -- 1.9.1 From flo at geekplace.eu Wed Jun 25 13:09:44 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Wed, 25 Jun 2014 13:09:44 +0200 Subject: [PATCH 2/2] Add '-l / --last-arg' to herbstclient In-Reply-To: <1403694584-12368-1-git-send-email-flo@geekplace.eu> References: <1403694584-12368-1-git-send-email-flo@geekplace.eu> Message-ID: <1403694584-12368-3-git-send-email-flo@geekplace.eu> --- doc/herbstclient.txt | 3 +++ ipc-client/main.c | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/herbstclient.txt b/doc/herbstclient.txt index 8375607..48603d4 100644 --- a/doc/herbstclient.txt +++ b/doc/herbstclient.txt @@ -38,6 +38,9 @@ OPTIONS *-0*, *--print0*:: Use the null character as delimiter between the output of hooks. +*-l*, *--last-arg*:: + When using *-i* or *-w*, only print the last argument of the hook. + *-i*, *--idle*:: Wait for hooks instead of executing commands. diff --git a/ipc-client/main.c b/ipc-client/main.c index ff3557f..429ef29 100644 --- a/ipc-client/main.c +++ b/ipc-client/main.c @@ -25,6 +25,7 @@ void destroy_hook_regex(); int g_ensure_newline = 1; // if set, output ends with a newline bool g_null_char_as_delim = false; // if true, the null character is used as delimiter +bool g_print_last_arg_only = false; // if true, prints only the last argument of a hook int g_wait_for_hook = 0; // if set, do not execute command but wait bool g_quiet = false; regex_t* g_hook_regex = NULL; @@ -83,6 +84,7 @@ void print_help(char* command, FILE* file) { "with a newline.\n" "\t-0, --print0: Use the null character as delimiter between the " "output of hooks.\n" + "\t-l, --last-arg: Print only the last argument of a hook.\n" "\t-i, --idle: Wait for hooks instead of executing commands.\n" "\t-w, --wait: Same as --idle but exit after first --count hooks.\n" "\t-c, --count COUNT: Let --wait exit after COUNT hooks were " @@ -128,9 +130,14 @@ int main_hook(int argc, char* argv[]) { } } if (print_signal) { - // just print as list - for (int i = 0; i < hook_argc; i++) { - printf("%s%s", i ? "\t" : "", hook_argv[i]); + if (g_print_last_arg_only) { + // This assumes that hook_argc is always > 0! + printf("%s", hook_argv[hook_argc-1]); + } else { + // just print as list + for (int i = 0; i < hook_argc; i++) { + printf("%s%s", i ? "\t" : "", hook_argv[i]); + } } if (g_null_char_as_delim) { putchar(0); @@ -159,6 +166,7 @@ int main(int argc, char* argv[]) { static struct option long_options[] = { {"no-newline", 0, 0, 'n'}, {"print0", 0, 0, '0'}, + {"last-arg", 0, 0, 'l'}, {"wait", 0, 0, 'w'}, {"count", 1, 0, 'c'}, {"idle", 0, 0, 'i'}, @@ -170,7 +178,7 @@ int main(int argc, char* argv[]) { // parse options while (1) { int option_index = 0; - int c = getopt_long(argc, argv, "+n0wc:iqhv", long_options, &option_index); + int c = getopt_long(argc, argv, "+n0lwc:iqhv", long_options, &option_index); if (c == -1) break; switch (c) { case 'i': @@ -190,6 +198,9 @@ int main(int argc, char* argv[]) { case '0': g_null_char_as_delim = true; break; + case 'l': + g_print_last_arg_only = true; + break; case 'q': g_quiet = true; break; -- 1.9.1 From edu at thorsten-wissmann.de Mon Jun 30 11:50:14 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Mon, 30 Jun 2014 11:50:14 +0200 Subject: [PATCH 1/2] Add '-0 / --print0' to herbstclient In-Reply-To: <1403694584-12368-2-git-send-email-flo@geekplace.eu> References: <1403694584-12368-1-git-send-email-flo@geekplace.eu> <1403694584-12368-2-git-send-email-flo@geekplace.eu> Message-ID: <20140630095013.GA11195@hoth.roethelheim.stw.uni-erlangen.de> On Wed, Jun 25, 2014 at 01:09:43PM +0200, Florian Schmaus wrote: > +*-0*, *--print0*:: > + Use the null character as delimiter between the output of hooks. > + Can you give some example application where you need that? Do you use it together with --last-arg for the window-title-applet? Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 213 bytes Desc: not available URL: From edu at thorsten-wissmann.de Mon Jun 30 11:55:46 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Mon, 30 Jun 2014 11:55:46 +0200 Subject: [PATCH 2/2] Add '-l / --last-arg' to herbstclient In-Reply-To: <1403694584-12368-3-git-send-email-flo@geekplace.eu> References: <1403694584-12368-1-git-send-email-flo@geekplace.eu> <1403694584-12368-3-git-send-email-flo@geekplace.eu> Message-ID: <20140630095545.GB11195@hoth.roethelheim.stw.uni-erlangen.de> Hi, On Wed, Jun 25, 2014 at 01:09:44PM +0200, Florian Schmaus wrote: > if (print_signal) { > - // just print as list > - for (int i = 0; i < hook_argc; i++) { > - printf("%s%s", i ? "\t" : "", hook_argv[i]); > + if (g_print_last_arg_only) { > + // This assumes that hook_argc is always > 0! > + printf("%s", hook_argv[hook_argc-1]); > + } else { Don't assume it, check it :). I've just added a check for it such that "empty" hooks are simply dropped. BTW I totally forgot to tell in the last mail that I merged your previous commit as well as this one: 24bc774 Add '-l / --last-arg' to herbstclient 2ca6ab9 Add '-0 / --print0' to herbstclient Thanks & Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 213 bytes Desc: not available URL: From flo at geekplace.eu Mon Jun 30 12:09:37 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Mon, 30 Jun 2014 12:09:37 +0200 Subject: [PATCH 2/2] Add '-l / --last-arg' to herbstclient In-Reply-To: <20140630095545.GB11195@hoth.roethelheim.stw.uni-erlangen.de> References: <1403694584-12368-1-git-send-email-flo@geekplace.eu> <1403694584-12368-3-git-send-email-flo@geekplace.eu> <20140630095545.GB11195@hoth.roethelheim.stw.uni-erlangen.de> Message-ID: On Mon, Jun 30, 2014 at 11:55 AM, Thorsten Wi?mann wrote: > Hi, > > On Wed, Jun 25, 2014 at 01:09:44PM +0200, Florian Schmaus wrote: > > if (print_signal) { > > - // just print as list > > - for (int i = 0; i < hook_argc; i++) { > > - printf("%s%s", i ? "\t" : "", hook_argv[i]); > > + if (g_print_last_arg_only) { > > + // This assumes that hook_argc is always > 0! > > + printf("%s", hook_argv[hook_argc-1]); > > + } else { > > Don't assume it, check it :). I've just added a check for it such that > "empty" hooks are simply dropped. > I figured you would guarantee it. :) But of course, checking the preconditions is always a good idea! Best, Florian -------------- next part -------------- An HTML attachment was scrubbed... URL: From flo at geekplace.eu Mon Jun 30 12:10:31 2014 From: flo at geekplace.eu (Florian Schmaus) Date: Mon, 30 Jun 2014 12:10:31 +0200 Subject: [PATCH 1/2] Add '-0 / --print0' to herbstclient In-Reply-To: <20140630095013.GA11195@hoth.roethelheim.stw.uni-erlangen.de> References: <1403694584-12368-1-git-send-email-flo@geekplace.eu> <1403694584-12368-2-git-send-email-flo@geekplace.eu> <20140630095013.GA11195@hoth.roethelheim.stw.uni-erlangen.de> Message-ID: On Mon, Jun 30, 2014 at 11:50 AM, Thorsten Wi?mann wrote: > On Wed, Jun 25, 2014 at 01:09:43PM +0200, Florian Schmaus wrote: > > +*-0*, *--print0*:: > > + Use the null character as delimiter between the output of hooks. > > + > > Can you give some example application where you need that? Do you use it > together with --last-arg for the window-title-applet? > That is correct, the log-applet uses popen(, "r") and getdelim(...,...,0,...), where hc := herbstclient -0 -l -i '(focus_changed|window_title_changed)' to retrieve the window title of the focused window. Best, Florian -------------- next part -------------- An HTML attachment was scrubbed... URL: From edu at thorsten-wissmann.de Mon Jun 30 12:36:44 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Mon, 30 Jun 2014 12:36:44 +0200 Subject: Migration to C++ (?) Message-ID: <20140630103643.GA22123@hoth.roethelheim.stw.uni-erlangen.de> Hi Friends, I'm strongly considering migrating herbstluftwm from C99 to C++11. The reason is, that I felt becoming more and more conservative when mergin patches because I feared that they will let herbstluftwm crash. (An example would be Florian's frame-objects patch). I blame the lack of the following features in C99: - No templates/generics or not much type safety: I have to deal with void* pointers everywhere and have to cast them and hope that it doesn't break. - No real modules: Everything is one huge namespace so the global symbol names get messier and messier. - No implicit freeing of objects. If I have multiple returns within a single function I have to manually free dynamically allocated things at every return. - No anonymous functions or function nesting: If I need a helper function (e.g. to do something with each element of a list), I have to find a new name which is unique within the C-file... By now, I see the following solutions: - Rewrite the whole thing in some nice language which has all this. - Migrate it to a language which is mostly compatible to C99 (e.g. C++11). - Ignore those problems ("The kernel developers don't have these problems although using C99 as well. hlwm is much smaller and we should be able to deal with these things while enjoying the simplicity and speed of C."). Personally, I would choose the compromise of migrating to C++11. I don't like C++ with all it's properties, but it seems to solve the Software-Engineering-Problems of C99. You can find the C++11 version in the "cpp" branch[1]. What do you think? Cheers, Thorsten [1] https://git.cs.fau.de/?p=hlwm;a=shortlog;h=refs/heads/cpp -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 213 bytes Desc: not available URL: