You are not logged in.

#226 2012-07-11 02:02:51

syngin
Member
From: Melbourne
Registered: 2011-03-29
Posts: 39

Re: herbstluftwm

Has anyone had any luck using function keys in bindings? I can't seem to get it to work.


Edit: nvm, typo.  hmm

Last edited by syngin (2012-07-11 02:03:53)

Offline

#227 2012-07-11 18:54:01

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

syngin wrote:

Has anyone had any luck using function keys in bindings? I can't seem to get it to work.

Yes. I had luck. You can bind all function keys recognized by X. Start xev in an terminal and press the desired function key. E.g. an output like

KeyRelease event, serial 33, synthetic NO, window 0xc00001,
    root 0xaf, subw 0x0, time 224535462, (-488,155), root:(239,180),
    state 0x0, keycode 213 (keysym 0x1008ffa7, XF86Suspend), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

tells you that the function key name is XF86Suspend

Offline

#228 2012-07-11 20:24:52

andmars
Member
Registered: 2012-03-13
Posts: 362

Re: herbstluftwm

syngin wrote:

Has anyone had any luck using function keys in bindings? I can't seem to get it to work.

mine looks like this (took the number instead of key name with xev)

hc keybind 0x1008ff14 spawn mpc toggle
hc keybind 0x1008ff16 spawn mpc prev
hc keybind 0x1008ff17 spawn mpc next
hc keybind 0x1008ff13 spawn amixer set Master 1+ unmute
hc keybind 0x1008ff11 spawn amixer set Master 1- unmute
hc keybind 0x1008ff12 spawn amixer set Master toggle
hc keybind Print spawn scrot

Offline

#229 2012-07-12 04:49:42

syngin
Member
From: Melbourne
Registered: 2011-03-29
Posts: 39

Re: herbstluftwm

This function key thing is weird; if I bind using the client (herbstclient), it works fine. From autostart, however, the "spawn" part of the binding is missing.
i.e., in autostart:

hc keybind $Mod-F1 spawn $HOME/bin/the_thing 1

But after a restart/reload, hc list_keybinds shows:

Mod4+F1 /home/username/bin/the_thing 1

Edit: IGNORE ME I AM NOOB. I wish I could delete posts... hmm
Which is to say, many moons ago I was fiddling with adding these keybindings and did so without the "spawn" argument in my workstation-specific startup script; this week I thought "I'll add that thing" and did so in autostart - my host-specific scripts execute after keybindings and thus the autostart bindings were being overwritten.

Last edited by syngin (2012-07-12 04:55:02)

Offline

#230 2012-07-12 05:00:07

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,200

Re: herbstluftwm

syngin wrote:

Edit: IGNORE ME I AM NOOB. I wish I could delete posts... hmm
...

Bah!.  You are doing just fine.  The point of these forums is support.  If you find you have done something silly, stating what was wrong and how it was resolved is still useful.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#231 2012-08-06 09:58:16

bootleg
Member
Registered: 2010-12-08
Posts: 38

Re: herbstluftwm

Hello, I found a bug:
- start with the default frame
- open one or more windows
- set the max layout
- split the frame horizontally or vertically
- focus the new empty frame
- open one or more windows
- set any layout except the max layout
- when setting any window in this frame fullscreened, the window takes the whole screen but is displayed behind the other frame

Offline

#232 2012-08-06 10:45:41

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

bootleg wrote:

Hello, I found a bug:
- start with the default frame
- open one or more windows
- set the max layout
- split the frame horizontally or vertically
- focus the new empty frame
- open one or more windows
- set any layout except the max layout
- when setting any window in this frame fullscreened, the window takes the whole screen but is displayed behind the other frame

That bug was known and is fixed in the current git-version. (Since the stacking branch has been merged).

Offline

#233 2012-08-06 12:30:25

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: herbstluftwm

I really love being able to set individual frames to "max" mode.  This really suits my workflow nicely.

Offline

#234 2012-08-15 23:21:37

ninjaaron
Member
Registered: 2010-12-10
Posts: 296

Re: herbstluftwm

I wrote some functions that sort of emulate "master" and "stack" behaviors from dynamic/auto tiling window managers.  It's not perfect, but it does what I need it to for my work flow.  These functions do weird (but not fatal) things when executed on empty frames.  Might be useful to others.

#!/bin/bash

# Moves current window to master and another window out. It then attempts to 
#move focus back to the first window.
swap_master() {
  # checks if the primary split is vertical or horizontal
	if [ $(hc dump|cut -b8) = "h" ];then
		hc shift -e l
		hc cycle -1
		hc shift -e r
		hc focus -e l
		hc focus -i d
	elif [ $(hc dump|cut -b8) = "v" ];then
		hc shift -e u
		hc cycle -1
		hc shift -e d
		hc focus -e u
		hc focus -i r
	fi
}

# Same as above, only in reverse.
swap_stack() {
  # checks if the primary split is vertical or horizontal
	if [ $(hc dump|cut -b8) = "h" ];then
		hc shift -e r
		hc cycle -1
		hc shift -e l
		hc focus -e r
		hc focus -i d
	elif [ $(hc dump|cut -b8) = "v" ];then
		hc shift -e d
		hc cycle -1
		hc shift -e u
		hc focus -e d
		hc focus -i r
	fi
}

I could do it better if frames could be given labels... wink

Last edited by ninjaaron (2012-08-16 01:44:40)

Offline

#235 2012-08-16 09:59:10

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

ninjaaron wrote:

I wrote some functions that sort of emulate "master" and "stack" behaviors from dynamic/auto tiling window managers.  It's not perfect, but it does what I need it to for my work flow.  These functions do weird (but not fatal) things when executed on empty frames.  Might be useful to others.

Thanks! I know someone who was waiting for this kind of script. The weirdest thing that happens here (on empty frames) is that the focus changes.

Although I didn't really notice the windows flickering here, it should flicker less if you do an ''hc lock'' before the first operation and an ''hc unlock'' after the last one. (So the clients aren't rearranged after the first ''hc shift'')

I could do it better if frames could be given labels... wink

Or if there also would be a herbstclient-binding for a language that can handle trees much better. (Which is nearly every non-shell-script language)

Offline

#236 2012-08-17 07:03:28

Heo Rung
Member
From: Viet Nam
Registered: 2011-08-08
Posts: 18
Website

Re: herbstluftwm

EDIT: fixed in version .4

Last edited by Heo Rung (2012-08-21 03:44:23)

Offline

#237 2012-08-20 16:47:17

srlang
Member
Registered: 2012-06-12
Posts: 8

Re: herbstluftwm

I am having my own issues with spacing between frames. When using the package in the AUR, there was absolutely no space between my frames. However, when I instead changed to start using the -git version in the AUR a little while back, I noticed there was a spacing of about 5px between my frames while using the same autostart config.

>Relevant config items:
>frame_border_width 0
>window_border_width 1
>snap_distance -1
>window_gap -1
>snap_gap 0
(Sorry, I haven't figured out how the code tags work)

Offline

#238 2012-08-20 17:07:55

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: herbstluftwm

srlang, in the newest release, window_gap was renamed to frame_gap, and window_gap is now actually the gap between windows in the same frame. So just change it to frame_gap and you should be good to go.


>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#239 2012-08-20 18:03:11

srlang
Member
Registered: 2012-06-12
Posts: 8

Re: herbstluftwm

Thanks,
That worked exactly as hoped.

While I may have somebody's attention, I'll ask this:
Has anybody found a way to implement a "nextTag()" and "previousTag()" keybinding yet? If not, I plan to add an integer parameter to my autostart and add a bash script to read this integer to go to the next higher or lower integer representing the next or previous tag, respectively. I just want to know if there's a better way or something that already exists.

Offline

#240 2012-08-20 18:28:12

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: herbstluftwm

just bind to  use_index +1  and  use_index -1 big_smile


>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#241 2012-08-30 02:43:11

syngin
Member
From: Melbourne
Registered: 2011-03-29
Posts: 39

Re: herbstluftwm

EDIT: I'm using herbstluftwm from git (manually updating and compiling).

So, I just updated my system (pacman -Syyu) and herbstclient breaks with the following:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  18 (X_ChangeProperty)
  Resource id in failed request:  0x6c6c6568
  Serial number of failed request:  9
  Current serial number in output stream:  9

If I comment out large (and seemingly unrelated) parts of my Xresources file, I can get up and running. As an example, the following line will render herbstclient unusable:

URxvt*termName:         rxvt-unicode

As will:

*color0: #011

There were kernel, xorg, and nvidia updates in the upgrade - I'm guessing that's where the issue lies. Anyone got any ideas on where I can start poking around?

EDIT:
I rolled back the kernel, nvidia driver, and xorg-server to no avail.

Further:
herbstclient is exiting with status code 2 when there're no Xresources loaded. With a "faulty" set of resources, the tail-end of an strace looks like:

munmap(0x7f0f92a05000, 4096)            = 0
access("/usr/share/X11/locale/C/XLC_LOCALE", R_OK) = 0
open("/usr/share/X11/locale/C/XLC_LOCALE", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=650, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0f92a05000
read(4, "#  XLocale Database Sample for C"..., 4096) = 650
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0x7f0f92a05000, 4096)            = 0
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\20\0\5\0\v\0\0\0UTF8_STRING_", 20}, {NULL, 0}, {"", 0}], 3) = 20
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "\1\0\10\0\0\0\0\0+\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096, 0, NULL, NULL) = 32
recvfrom(3, 0x2044484, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(3, 0x2044484, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\22\0\6\0Rxvt\227\1\0\0+\1\0\0\10NG_\0\0\0\0", 24}, {NULL, 0}, {"", 0}], 3) = 24
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "\0\3\t\0Rxvt\0\0\22\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096, 0, NULL, NULL) = 32
open("/usr/share/X11/XErrorDB", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=41495, ...}) = 0
read(4, "!\n! Copyright 1993, 1995, 1998  "..., 41495) = 41495
close(4)                                = 0
brk(0x208f000)                          = 0x208f000
write(2, "X Error of failed request:  BadW"..., 67X Error of failed request:  BadWindow (invalid Window parameter)
  ) = 67
write(2, "Major opcode of failed request: "..., 35Major opcode of failed request:  18) = 35
write(2, " (X_ChangeProperty)\n", 20 (X_ChangeProperty)
)   = 20
write(2, "  ", 2  )                       = 2
write(2, "Resource id in failed request:  "..., 42Resource id in failed request:  0x74767852) = 42
write(2, "\n", 1
)                       = 1
write(2, "  ", 2  )                       = 2
write(2, "Serial number of failed request:"..., 35Serial number of failed request:  9) = 35
write(2, "\n  ", 3
  )                     = 3
write(2, "Current serial number in output "..., 42Current serial number in output stream:  9) = 42
write(2, "\n", 1
)                       = 1
exit_group(1)                           = ?
+++ exited with 1 +++

Last edited by syngin (2012-08-30 03:49:39)

Offline

#242 2012-08-30 06:44:54

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: herbstluftwm

Hi thorsten

dont know if it's relative but with the last git version I have this error that repeats constantly:

herbstluftwm: warning herbstclient window 23068673 does not have the Atom "_HERBST_IPC_ARGS"set. Ignoring it.

Offline

#243 2012-08-30 16:20:13

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

mentat wrote:

dont know if it's relative but with the last git version I have this error that repeats constantly:

herbstluftwm: warning herbstclient window 23068673 does not have the Atom "_HERBST_IPC_ARGS"set. Ignoring it.

The ipc protocoll changed a little bit which made this warning meaningless. It is fixed in commit 9e1f356a1a4dc3365dd.

Offline

#244 2012-08-30 17:41:01

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: herbstluftwm

Thanks for the fix !

Offline

#245 2012-08-30 20:41:52

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

syngin wrote:

EDIT: I'm using herbstluftwm from git (manually updating and compiling).

So, I just updated my system (pacman -Syyu) and herbstclient breaks with the following:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  18 (X_ChangeProperty)
  Resource id in failed request:  0x6c6c6568
  Serial number of failed request:  9
  Current serial number in output stream:  9

Another User reported the same bug on ubuntu. Unfortunately i can't reproduce it. Your Xresources-problem seems like a different problem because herbstclient/herbstluftwm never explicitly uses those files.

I'm currently having two current 32bit-arch-systems (one with nvidia and one with intel graphics) but i never got that error. Do you have a 32 or a 64bit system? what are your compile flags?

Offline

#246 2012-08-30 21:08:31

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

syngin wrote:

EDIT: I'm using herbstluftwm from git (manually updating and compiling).

So, I just updated my system (pacman -Syyu) and herbstclient breaks with the following:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  18 (X_ChangeProperty)
  Resource id in failed request:  0x6c6c6568
  Serial number of failed request:  9
  Current serial number in output stream:  9

The problem was, that the window id wasn't properly initialized to 0 at startup. This problem has been fixed by this commit: 0e51182e9dc86c49697925fe2a68e40c5cdb13d7

Offline

#247 2012-09-05 18:52:22

insanum
Member
Registered: 2007-01-15
Posts: 26
Website

Re: herbstluftwm

I've noticed that the <CTRL-SPACE> key sequence isn't passed to an application properly in herbstluftwm.  It works under DWM.  Is herbstluftwm squashing certain key sequences?

Offline

#248 2012-09-05 23:41:06

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

insanum wrote:

I've noticed that the <CTRL-SPACE> key sequence isn't passed to an application properly in herbstluftwm.  It works under DWM.  Is herbstluftwm squashing certain key sequences?

Do you really mean key *sequence*? I just tested it with xev and the following custom application and it works.

It creates a window and tells you if Control (as a Modifier) and space is pressed. If i press Ctrl and space, Control=1 and Space=1 is printed.

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>

/**
 * Build it with:
 * gcc -Wall -pedantic -I/usr/X11R6/include -L/usr/X11R6/lib -L/usr/lib -lX11 ctrl-space.c
 */

int main() {
    Display* d = XOpenDisplay(NULL);
    Window root = DefaultRootWindow(d);
    Window win;
    XEvent event;
    XClassHint *hint;

    XGrabServer(d);
    win = XCreateSimpleWindow(d, root, 0, 0, 840, 840, 0, 0, 0);
    hint = XAllocClassHint();
    hint->res_name = "foo";
    hint->res_class = "bar";
    XSetClassHint(d, win, hint);
    XUngrabServer(d);
    XFree(hint);
    XSelectInput(d, win, KeyPressMask);
    XMapWindow(d, win);
    printf("Waiting for an event\n");
    while (1) {
        XNextEvent(d, &event);
        printf("Got it! Type: %d\n", event.type);
        if (event.type == KeyPress) {
            printf("win = %lx, keycode = %u, Control = %u, Space = %d\n",
                   event.xkey.window, event.xkey.keycode, !!(event.xkey.state & ControlMask),
                   event.xkey.keycode == XKeysymToKeycode(d, XK_space));
            if (event.xkey.keycode == XKeysymToKeycode(d, XK_q)) {
                break;
            }
        }
    }
    XDestroyWindow(d, win);
    XCloseDisplay(d);
    return 0;
}

And when using xev, it also prints:

    state 0x4, keycode 65 (keysym 0x20, space), same_screen YES,

(state 0x4 means, Control is pressed)

Do you get the same results using xev and this small example application?

Offline

#249 2012-09-10 20:27:20

ninjaaron
Member
Registered: 2010-12-10
Posts: 296

Re: herbstluftwm

thorsten wrote:

Or if there also would be a herbstclient-binding for a language that can handle trees much better. (Which is nearly every non-shell-script language)

Unfortunately, I only speak bash.  I don't have a CS background, so I don't even know what your talking about when you say "handle trees."

In other news, I wrote some scripts that allow hlwm and .Xresources (and my conky and dmenu) to be themed from a common source file:

# changes the theme for hlwm according to variables from an external file. If
# required variables are not assigned, asign them.
retheme() {
  # get current theme
  theme=$(cat ~/.themes/theme)

  # load settings from the theme file
  source ~/.themes/"$theme

  # set defaults from terminal colors if they are unspecified
  test -z "$frame_border_active_color" && frame_border_active_color="$fg_color"
  test -z "$frame_bg_active_color" && frame_bg_active_color="$bg_color"
  test -z"$frame_bg_normal_color" && frame_bg_normal_color="#000000"
  test -z "$frame_bg_transparent" && frame_bg_transparent=1
  test -z "$window_border_normal_color" && window_border_normal_color="$bg_color"
  test -z "$window_border_active_color" && window_border_active_color="$fg_color"
  test -z "$window_border_width" && window_border_width=1

  # run herbstclient commands
  # note that the alias of "hc" for `herbstclient` is assumed here, though I haven't bothered to define it in this posting.
  hc set frame_border_active_color "$frame_border_active_color"
  hc set frame_bg_active_color "$frame_bg_active_color"
  hc set frame_bg_normal_color "$frame_bg_normal_color"
  hc set frame_bg_transparent "$frame_bg_transparent"
  hc set window_border_normal_color "$window_border_normal_color"
  hc set window_border_active_color "$window_border_active_color"
  hc set window_border_width "$window_border_width"

  # create dmenu from terminal colors if there are none specified.
  test -z $dm_nb && dm_nb="$bg_color"
  test -z $dm_nf && dm_nf="$fg_color"
  test -z $dm_sb && dm_sb="$fg_color"
  test -z $dm_sf && dm_sf="$bg_color"
  test -z $dm_fn && dm_fn="-*-bitocra-*"

  # rebind dmenu
  hc keybind Mod4-d spawn dmenu_run -i -fn "$dm_fn" -nb "$dm_nb" -nf "$dm_nf" -sb "$dm_sb" -sf "$dm_sf"
}

an example input file looks like this:

theme_name="Neon"
date_modified="15.08.2012"

# settings for ~/.Xresources
bg_color="#151515"
fg_color="#aaaaaa"
black="#444444"
dark_grey="#666666"
red="#ff1155"
light_red="#ff4488"
green="#11ff55"
light_green="#44ff88"
blue="#1155ff"
light_blue="#4488ff"
magenta="#bb33ff"
light_magenta="#dd66ff"
yellow="#FFcc77"
light_yellow="#FFdd66"
cyan="#00ffbb"
light_cyan="#66ffdd"
light_gray="#cccccc"
white="#ffffff"

transparent="true"

# settings for herbstluftwm
frame_border_active_color="$yellow"
window_border_normal_color="#1e1e1e"
window_border_active_color="$yellow"

# settings for dmenu
dm_sb="$green"

The script that generates the .Xresources from this file is here, and one that generates my conky is here.  Obviously, these two scripts in particular are heavily biased toward my other local settings (rxvt-unicode, unusual preferred conky layout with mpd, etc.)

Using this method to switch color schemes saves typing and head-beating-against-desk-ing.  It also allows you to save old color schemes for reuse or modification.  Of course, there is no reason why the same idea couldn't be used to generate themes for other window managers or even gtk themes (that is sort of my next project, besides, like, finishing my degree).

Last edited by ninjaaron (2012-09-10 20:59:14)

Offline

#250 2012-09-10 20:58:09

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: herbstluftwm

thorsten wrote:

In other news, I wrote some scripts that allow hlwm and .Xresources (and my conky and dmenu) to be themed from a common source file

[...]

[Here is a simpler way to do this].  I use that in conjunction with [this script] that I wrote to generate Xresources color schemes from images.

Offline

Board footer

Powered by FluxBB