You are not logged in.
Couldn't find one of these yet. Please contribute your own herbstluft stuff as well!
First things first: Herbstluft is German for "Autumn air." I'm not sure what Autumn air has to do with window management, but it's a lovely name nonetheless.
btw, Doomicide already has a nice thread about herbstluftwm on the #! forums. He's covered some good stuff there, so I won't repeat it. Doom, if you ever read this, I've used some of your stuff in setting up mine, but I'm not registered at #!. Your effort is appreciated nonetheless.
Anyway, I've recently switched from scrotwm to herbstluftwm. This wasn't for any fault of scrotwm. I just saw some screenshots of herbstluftwm, and it looked like it gave greater possibilities in terms of tiling layouts. I tried it. That was true. I also found out that it has one particular feature that makes it capable of doing all kinds of crazy stuff.
herbstluftwm is completely controlled and configured by shell commands. There is literally no other way to get it to do anything. You can map keybidings with it, but you do that with a shell command, and those bindings lauch other shell commands. As you might guess, the config file is just a bash script (could be any shell language, I'm sure) that turns on your settings. This means, of course, that you can use bash functions in the config file. Not a super big deal. awesome, dwm, and xmonad all use more powerful languages for configuration.
What is a big deal is the fact that you can create additional scripts to preform rather sophisticated window management functions. You could theoretically have an entirely new configuration file set to a keybiding to call whenever you wanted. I haven't quite gone this far, but I did go pretty nuts with it.
[edit]ok, I've actually gone farther now. I've written a script that allows hlwm to do some of the things dynamic tilers do. see "swap" script here
[UPDATE]
We've figured something out that will make the herbstluftwm autostart file run faster for everyone with a version of the program that includes the "chain" command:
There is a line like this in the default autostart file:
function hc() {
herbstclient "$@"
}
Comment it out and/or replace it with this:
hc() {
cmds="$cmds , $@"
}
Then, at the end of the file, before the "# find the panel" section, add this line:
herbstclient chain $cmds&
This pipes all of your settings to herbstluftwm with a single instance of herbstclient rather than dozens of them. It also forks that process so it can find the panel while it's loading your settings. This should offer a noticeable increase in load speed on most systems. May have to modify some things if your autostart has anything wacky in it (like mine).
Not that herbstluftwm loads slowly by default, but no reason not to squeeze out every ounce of performance, especially if you use an older system.
***
original post follows
So, by default, I like to have a sort of "solid wall" kind of look to my tilers, so I set it up to look more or less like this:
Dzen with conky info came later, but we'll get there. This shot also shows a frame layout that I like to work with, which I have set to a keybiding. You do this with the 'dump' and 'load' commands as detailed in the man page.
Anyway, then I decided that sometimes I might want to see my wallpaper a little bit, so I added a binding for an alternative, translucent terminal and created bindings to change the gap between frames. It actually uses the number keys, so I can set the gap to any even number of pixels between 0 and 18.
I noticed that my default window and frame border settings didn't look right with the gap, so I wrote a script that changes the borders according to whether or not there is a frame gap. (I also did a script to adjust the border settings for when herbstluftwm is in floating mode, and those colors also get adjusted according to the snapping gap)
So then I figured out how to add the status bar, and I wrote a script to toggle it on and off. Here it is off:
I also decided that I wanted it to be different colors to go with adjusted border colors with and without the frame gaps, so I wrote a some scripts to handle giving dzen the right color to go with the gap size. You can see a different shade of grey on the bar in the first two pictures. This is probably more pedantic than what anyone else would want to do, but it makes me happy.
There is one thing that herbstluftwm doesn't have build-in handling for that you might want, and that is fullscreen applications. You can make an application take up an entire frame and put it in fullscreen mode, but it won't hide the other frames or the bar (one of the reasons I wanted a binding to hide the status bar). This isn't such a big deal, but it did prompt me to create one additional script that changes several config settings to make a better environment for watching movies. It changes the border colors to black and a very dark grey, and it changes the terminal launch command to launch a back terminal with dark grey text. I did this so I could leave up the mplayer output in a way that wasn't distracting. This script also turns off dzen by default, but it can be brought back with the same subdued color scheme as the terminal.
And finally, here's a scrot from two days ago showing how the floating mode looks (or rather, can look).
Scripts in the next post.
Last edited by ninjaaron (2012-11-27 22:05:39)
Offline
Ok, so here are the scripts. First, the normal startup script, ~/.config/herbstluftwm/autostart
#!/bin/bash
function hc() {
herbstclient "$@"
}
# keybindings
Mod=Mod4
hc keybind $Mod-Shift-q quit
hc keybind $Mod-i reload
hc keybind $Mod-x close
hc keybind $Mod-Return spawn urxvtc
hc keybind $Mod-p spawn dmenu_run -i -fn -*-bitocra -nb '#1e1e1e' -nf '#888888' -sb '#FFFF84' -sf '#1e1e1e'
hc keybind $Mod-f spawn urxvtc -tr -sh 20 -fg rgb:bb/bb/bb
# tags
hc rename default 1 || true
for i in {1..9} ; do
hc add "$i"
hc keybind "$Mod-$i" use "$i"
hc keybind "$Mod-Shift-$i" move "$i"
#commands dealing with spaces and borders
hc keybind "$Mod-Alt-$i" spawn ~/.config/herbstluftwm/mindthegap "$(($i*2))"
done
hc keybind $Mod-Alt-0 spawn ~/.config/herbstluftwm/mindthegap 0
hc keybind $Mod-0 spawn ~/.config/herbstluftwm/autogap
# layouting
hc keybind $Mod-r remove
hc keybind $Mod-space cycle_layout 1
hc keybind $Mod-Alt-space cycle_layout -1
hc keybind $Mod-u split vertical 0.5
hc keybind $Mod-o split horizontal 0.5
hc keybind $Mod-s spawn ~/.config/herbstluftwm/float
hc keybind $Mod-d spawn ~/.config/herbstluftwm/dzen
hc keybind $Mod-m load '(split horizontal:0.710000:0 (split vertical:0.820000:0 (clients horizontal:1 0x100001e 0x801fa3) (clients horizontal:0)) (clients vertical:0 0x801ff3 0x80207d))'
hc keybind $Mod-v spawn .config/herbstluftwm/vidmode
# resizing
RESIZESTEP=0.02
hc keybind $Mod-Control-h resize left +$RESIZESTEP
hc keybind $Mod-Control-j resize down +$RESIZESTEP
hc keybind $Mod-Control-k resize up +$RESIZESTEP
hc keybind $Mod-Control-l resize right +$RESIZESTEP
# mouse
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
# focus
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-c cycle
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus right
hc keybind $Mod-Shift-h shift left
hc keybind $Mod-Shift-j shift down
hc keybind $Mod-Shift-k shift up
hc keybind $Mod-Shift-l shift right
# defaults
hc set frame_border_active_color '#101010'
hc set frame_border_normal_color '#101010'
hc set frame_bg_normal_color '#1e1e1e'
hc set frame_bg_active_color '#000000'
hc set window_border_width 1
hc set window_border_active_color '#666666'
hc set focus_follows_shift 1
hc set snap_distance 8
echo 1 > ~/.config/herbstluftwm/dz
~/.config/herbstluftwm/mindthegap $(cat ~/.config/herbstluftwm/gap)
Ok, I've changed some of the default settings and keybindings, and I added dmenu. I also added a second terminal launch command with different settings, cause sometimes I like to see my wallpaper, and sometimes not. That's pretty standard stuff that you can read about in the man page.
First non-standard thing is in for loop that controls workspace switching, I've added a call for ~/.config/herbstluftwm/mindthegap.
#!/bin/bash
if [ $1 = 0 ]; then
herbstclient set frame_border_width 0
herbstclient set window_border_normal_color '#1e1e1e'
echo 1 > ~/.config/herbstluftwm/dcolor
else
herbstclient set frame_border_width 1
herbstclient set window_border_normal_color '#101010'
echo 2 > ~/.config/herbstluftwm/dcolor
fi
pkill conky
if [ `cat ~/.config/herbstluftwm/dz` = 1 ];then
~/bin/dzen
sleep .2
fi
herbstclient set window_gap "$1"
herbstclient set snap_gap "$1"
echo $1 > ~/.config/herbstluftwm/gap
This script is busy. Changes the frame gap and the snap gap (being called in the for loop like it is, it means I any gap size I want from 0-18 on the fly. Not necessary, but it makes me happy, and I wasn't using the bindings for anything anyway), and it adujsts some border colors and widths to fit the way it should look with the gap (according to my tastes, at least). It also sets the color option for dzen (in the dcolor file) and kills dzen if it's running and if it's supposed to be on, resets the color and redraws it. 'dz' is just a file that contains either 1 or 0, depending on if dzen is running. This brings us to ~/bin/dzen
#!/bin/bash
color=`cat ~/.config/herbstluftwm/dcolor`
if [ $color = 1 ];then
conky|dzen2 -fn '-*-bitocra' -bg '#1e1e1e' -fg '#888888'&
elif [ $color = 2 ];then
conky|dzen2 -fn '-*-bitocra' -bg '#101010' -fg '#888888'&
elif [ $color = 3 ];then
conky|dzen2 -fn '-*-bitocra' -bg '#000000' -fg '#1e1e1e'&
fi
This script checks the 'dcolor' file for a number which tells it which color scheme to use, which 'mindthegap' has just set. It also makes a space the "pad" command so windows won't cover dzen.
Ok, what's next? back to the config file. The next thing of interest is ~/.config/herbstluftwm/autogap
#!/bin/bash
if [ "$(cat ~/.config/herbstluftwm/gap)" = "0" ];then
~/.config/herbstluftwm/mindthegap 4
else
~/.config/herbstluftwm/mindthegap 0
fi
Just a simple script to toggle the gap on and off without having to think about pixel sizes.
Next is ~/.config/herbstluftwm/float
#!/bin/bash
if [ `cat ~/.config/herbstluftwm/wb` = 1 ];then
herbstclient set window_border_width 1
herbstclient floating off
echo 0 > ~/.config/herbstluftwm/wb
else
herbstclient set window_border_width 2
herbstclient floating on
echo 1 > ~/.config/herbstluftwm/wb
fi
This script toggles floating and tiling modes. There is a command to do this automatically, so you don't need a script, but I wanted to change the border settings when I toggled, so this lets me do that.
Then comes ~/.config/herbstluftwm/dzen. It's just another simple toggle script that doesn't really need to be quoted. It checks ~/.config/herbstluftwm/dz to see if dzen is on or not and switches it. If it turns it on, it uses ~/bin/dzen so the color will match gap and border settings. Nothing you wouldn't expect to find in a toggle script.
There is a 'load' command after that. You can (and should) read about it in the man page. After that is a binding for my movie-viewing mode via ~/.config/herbstluftwm/vidmode.
#!/bin/bash
pkill conky
herbstclient pad 0 0
echo 0 > ~/.config/herbstluftwm/dz
herbstclient set frame_border_width 0
herbstclient set window_border_normal_color '#000000'
herbstclient set window_border_active_color '#060606'
echo 3 > ~/.config/herbstluftwm/dcolor
p
herbstclient set window_gap 0
echo 0 > ~/.config/herbstluftwm/gap
herbstclient load '(split vertical:0.900000:1 (clients max:0 0x8024d4) (clients horizontal:0 0x8024f4))'
herbstclient keybind Mod4-Return spawn urxvtc -fg rgb:1e/1e/1e -bg rgb:00/00/00
This just changes a bunch of settings (including some contained in files called by the scripts) and loads a frame layout that I think is good for movies. It also changes the color of terminal that the binding launches to something really dark. The only way to get all the settings back after this is to reload the autostart file.
It also calls the 'mindthegap' script to finish off the settings, so all the gap, border, and dzen settings will be persistent between sessions. I've opted to have dzen start in every session regardless of how I left it by echoing a new value to ~/.config/herbstluftwm/dz. I could leave it out, and that would also be persistent. I could also echo a set a specific gap size instead of cat-ing the old one.
So, I guess that's it.
Offline
Thanks for starting this thread. I was debating starting one, and I'm glad it was you cuz your scripts are fantastic. I might get around to posting some tidbits from my autostart one of these days.
Offline
Just stumbled upon this thread, nice scripts! Thanks for mentioning my thread, I'll make sure to mention yours in mine
Offline
I might be registering at #! pretty soon myself. I've never tried the distro, but there seem to be a lot of folks over there who have similar taste in software as I do. Everyone's scrots look like my desktop . Plus, since everyone over there uses console apps and bitmap fonts for everything, I could probably get a few more people to try out my font.
Last edited by ninjaaron (2011-10-20 22:20:23)
Offline
I can only encourage you to do this, #! is the nicest community on the web and the distro is cool, you feel someone gave a lot of thought to it. Do you have an example screenshot of your font somewhere, btw?
Offline
Why, I'm glad you asked
Left to right:
Some code, sample latin-based characters, some Hebrew above a gtk widget about a bit of ascii art. Conky on top.
Also there is an AUR package, but I just pushed a new update yesterday, and the package isn't updated. I want to call it 1.0 soon, but I'm waiting for more feedback.
Last edited by ninjaaron (2011-10-21 17:48:16)
Offline
Just discovered this WM today and absolutely love it! Switched from xmonad and solved loads of my issues with the added benefit of not having to know haskell to configure it.
Offline
I've only just switched to herbstluftwm from xmonad, and I'm really liking the added control of layout. I've got some minor problems I was hoping someone might've tackled before me:
1. Is it possible to remove frame around windows that I've set up rules for not being managed? I want to use "trayer", but it has a tiny frame around itself which I'd rather not have at all. I can sort of solve this by setting "frame_border_width 0", but that removes frames from all windows, which is undesirable.
2. Problems with java windows, such as Matlab. All I get is a gray box, rather than the actual GUI. This is a common problem with many tiling wms, but how do I fix it with herbstluftwm? I've tried exporting environment variable _JAVA_AWT_WM_NONREPARENTING=1, but that didn't do anything.
3. Is it possible to float certain windows? Right now I have to change the whole tag to floating. Some dialog popups etc. are better left floating.
4. How do you deal with things like fullscreen youtube?
Offline
1. Nope, but you could try adding a padding, if you have a "complete" statusbar.
2. Install the wmname package and run "wmname LG3D" (or any other reparenting wm-name)
3. Not at the moment, but keep an eye on the rules sections, this might come in an future update.
4. A workaround would be to write a script that toggles your statusbar and add a keybinding, I think ninjaaron has covered this in the OP.
OT: Damn you ninjaaron and your bitocra font, now I'm hooked on it and all other fonts seem too, well, round and big. I really hope you're adding another size (12) soon (for my statusbar), that's the only wish I have, other than that I'm perfectly happy
Last edited by Doomcide (2011-10-28 15:05:00)
Offline
I got at least question #2 fixed, thanks. Let me know if someone got something for youtube fullscreen, I don't have time to look into that right now.
A few more questions:
1. I've assigned a keybinding to spawn a command, but how do I make one keybinding spawn two commands? I tried combining them with an alias, but spawn doesn't seem willing to do aliases.
2. Is it possible to get the title of the currently focused window? I would like to pipe that to a dzen2 bar.
3. What is preferred way to display all workspaces in dzen2? Right now I've written a script that asks herbstluftclient for tag_status, then put that inside a forever true while loop then pipe it to dzen2. It works, but surely there must be a better way, as you'd think this probably use some resources if repeated several times a second?
Offline
1. The first thing coming to my mind is to write a little bash-script that executes those two commands, make it executable and bind to a key.
2. Mhm, I don't know about this one, but I don't think herbstclient lets access you this atm. I'm not sure, though.
3. Use the "herbstclient --idle" function, it waits for hooks emitted by herbstluftwm/herbstclient, theres a pretty good example panel.sh that comes with hlwm (I think it's somewhere in /usr/share) that does exactly what you ask for. Take a look at it and just copy the parts you need.
Offline
1. The first thing coming to my mind is to write a little bash-script that executes those two commands, make it executable and bind to a key.
2. Mhm, I don't know about this one, but I don't think herbstclient lets access you this atm. I'm not sure, though.
3. Use the "herbstclient --idle" function, it waits for hooks emitted by herbstluftwm/herbstclient, theres a pretty good example panel.sh that comes with hlwm (I think it's somewhere in /usr/share) that does exactly what you ask for. Take a look at it and just copy the parts you need.
1. Obviously that would work, I was just hoping to do without an extra file for such a small operation...
3. Thanks, didn't notice --idle, worked a charm.
Here's a little screenshot to show you how it looks like. I'd only like a focused window title now and I'd be pretty satisfied All in all though it's a joy to use, already prefering it over xmonad after only a day, even though I've been using xmonad for years.
Offline
I've only just switched to herbstluftwm from xmonad, and I'm really liking the added control of layout. I've got some minor problems I was hoping someone might've tackled before me:
1. Is it possible to remove frame around windows that I've set up rules for not being managed? I want to use "trayer", but it has a tiny frame around itself which I'd rather not have at all. I can sort of solve this by setting "frame_border_width 0", but that removes frames from all windows, which is undesirable.
2. Problems with java windows, such as Matlab. All I get is a gray box, rather than the actual GUI. This is a common problem with many tiling wms, but how do I fix it with herbstluftwm? I've tried exporting environment variable _JAVA_AWT_WM_NONREPARENTING=1, but that didn't do anything.
3. Is it possible to float certain windows? Right now I have to change the whole tag to floating. Some dialog popups etc. are better left floating.
4. How do you deal with things like fullscreen youtube?
If you are using the current git version, some problems can be solved this way:
1. you probably want to unamange trayer:
herbstclient rule class~'[Tt]rayer' manage=off
3. no there is no "only-float-this-client" option. But you can set the pseudotile option to the client. Then the client is normally tiled but is displayed with its floating-size.
herbstclient rule class~'[Gg]mrun' pseudotile=on # pseudotile gmrun dialogs
herbstclient keybind Mod1-p pseudotile toggle # manually toggle pseudotile option
This would produce the following:
4. you can use: mplayer -fs /tmp/Flash* and then manually switch to fullscreen with Mod-f.
Depending on your flash setup, it also would work if you activate youtube's fullscreen mode and then manually switch to fullscreen with Mod-f.
EDIT: I am working on the feature to display the current window title in dzen2 (or any other statusbar)
Last edited by thorsten (2011-10-29 14:47:15)
Offline
^ Just wanted to post about the new features, but you were faster. (what a surprise )
Offline
1. you probably want to unamange trayer:
herbstclient rule class~'[Tt]rayer' manage=off
I've already made a rule like that, but trayer still has a frame around itself. Not a huge deal, but would be nice to not have the frame there as it doesn't quite fit in with my dzen2 bar.
Offline
thorsten wrote:1. you probably want to unamange trayer:
herbstclient rule class~'[Tt]rayer' manage=off
I've already made a rule like that, but trayer still has a frame around itself. Not a huge deal, but would be nice to not have the frame there as it doesn't quite fit in with my dzen2 bar.
Sorry, it was my fault. I set the border width although the window should not be managed. Now it is fixed, please try again
Offline
Sorry, it was my fault. I set the border width although the window should not be managed. Now it is fixed, please try again
That was quick! And yes, there's no frame now
Offline
This wm looks pretty nice, I've some questions though.
1. Has someone "fixed" the problem with popup windows? I can't stand popup windows getting tiled
2. How is the performance and memory usage? My piece-of-shit celeron chokes easily
3. No built-in statusbar, right? Is it possible to use dzen to get workspace and window titles and also make it usable with a mouse?
@ninjaron: Could you I get the wallpaper from the last screeshot in your first post?
Offline
1. No I don't think it's possible yet, it will be, as soon as, wm_name will be a property for rules. Please correct if I'm wrong.
2. Performance and memory usage are really low, it's lightweight and fast (at least not slower than other tiling wm's).
3. Yes it's possible. As suggested above, look at the example panel.sh that comes with herbstluftwm.
Edit: The mouse support should be easy to implement with a bash script.
Last edited by Doomcide (2011-10-31 09:11:32)
Offline
Mad props to doom for being crazy-awesome at tech support, and Thorsten for the new features (and, incidentally, all of the old features too!)
I'm only good for this:
@ninjaron: Could you I get the wallpaper from the last screeshot in your first post?
Offline
BTW, @doom, the next size of bitocra is in the works, but I have to admit that I'm not totally enamored with it so far (I just really love the tiny one, I guess... it's the product of a vision, rather than the product of request, I guess is the main issue). I have the basic Latin (aka: English) letters finished. Sneak Peek:
I also slimmed down the slash and the asterisk in the original according to your suggestions in screenshot thread, and I like them better this way. The slash still doesn't look totally clean, but there isn't really any way to do super smooth diagonals with a bitmap at this size. I also changed the back quote to be the exact opposite of the apostrophe so that they would match better when they are used together. I'm waiting to push the changes to github until my testing with the #! guys so I don't burn out my AUR guy by updating every second day. I should probably do a dev branch or something. Anyway, here's a tasty tar with the version of the font I'm personally using at this very second (still just the small one):
http://ubuntuone.com/7IxjrJYnkmav8eaY7m5qWK
[/hijacking my own thread]
Last edited by ninjaaron (2011-11-01 00:55:26)
Offline
@ ninjaaron Thanks And the bigger font looks great so far, though I think I can understand, why you're loving the tiny one so much. Also thanks for the link: I like the improvements and agree with you that you should make a dev branch, at least , as long as the font is under this heavy development.
Offline
Depending on your flash setup, it also would work if you activate youtube's fullscreen mode and then manually switch to fullscreen with Mod-f.
According xprop the wm_class of a fullscreen flash window is "Exe", so I added this to to my config:
hc set ignore_class "^(Xfce4-notifyd|Exe|Conky)$"
... and the flash-window goes fullscreen.
I'm waiting for true fullscreen support like i3wm.
Offline
Ok, now I've got problem. I set my default frame layout to vertical with
hc set default_frame_layout 0
in my autostart file, but I still get a horizontal layout as default.
Offline