A quick bugfix release of i3 – version 4.5.1

This release fixes, among others, a high memory consumption problem in i3 4.5. The issue, as explained by Michael, is a result of a human mistake in the release process. For full details of a bug report, see this. The new release fixes the problem, as well as, introduces a few other changes.

Feel free to use my SlackBuild script to build the latest stable release of i3 including all the bugfixes. The builds for Slackware 14 and the -current branch are available here:

http://slackword.net/files/builds/i3/i3-master/

Enjoy

i3wm 4.5 on Slackware

Having come back from my holiday I found a pleasant surprise in the form of a new i3 release which contains a lot of bug fixes and cleanups. For a list of all the changes in the new version, please refer to the release notes.

As usual, you can grab a SlackBuild for i3wm 4.5 here. As explained in my previous posts, this SlackBuild is aimed at Slackware-current and will NOT work for Slackware 14 or older.

Furthermore, regardless of the Slackware version you use, I’d like to encourage you to use SlackBuilds (Slackware14, Slackware-current) pulling the master branch of the i3 window manager. See the explanation in my previous posts.

Enjoy!

i3 Window Navigation Tips

i3wmNavigating between windows, especially in a multi-monitor environment can pose a real challenge at times.

You work on a very important project and have a number of windows scattered over a few workspaces and monitors. Some of them are just opened for visual reference while others need to be regularly re-visited. An obvious solution would be to group windows in a logical way so that it is easy to switch between them. Depending on the number of windows and your working habits, this might not be enough. Fortunately, i3 offers some shortcuts or easy ways of creating such shortcuts. These might not look like life savers at first but, if used efficiently and on a regular basis, over time they can add hours or even days to you precious coding time. I will present a few tips with the best (IMHO) left till the end: the use of vim-like goto marks.

Going Back and Forth

Imagine you are working on one of your workspaces and you just quickly need to check something on workspace 4 so you press $mod+4 to switch to it. Once you have checked it, you don’t have to remember the number of the previous workspace. You just need to press $mod+4 again and you’ll return to whatever workspace you were working on. To enable this functionality, make sure you have the following line in ~/i3/config:

workspace_auto_back_and_forth yes

But it gets even better. The following key binding lets you switch back and forth between the last two workspaces that you visited pressing the $mod+z key combination.

bindsym $mod+z workspace back_and_forth

Furthermore, you can move windows back and forth with:

bindsym $mod+Shift+z move container to workspace back_and_forth

You could combine the two actions so that you move a window backwards and forwards and follow it.

bindsym $mod+Shift+z move container to workspace back_and_forth; workspace back_and_forth

Configure focus on keybindings;;dfafdad

Sometimes it would make sense to hard-code focusing on certain windows:

bindsym $mod+Shift+b [class="Firefox"] focus
bindsym $mod+Shift+i [class="Terminal" title="weechat"] focus

Using the last key binding will bring focus to an instance of Terminal running the weechat irc client. You can identify particular windows using the xprop client property displayer. Sometimes, however, it might not be easy to identify a client and that’s where vim like goto marks come in handy.

Goto marks in i3

Goto marks let you mark a window on the fly so that you can focus on it at a later time. Please bear in mind that they do not modify your config file so they will be lost if you exit i3. They are meant to be session specific or for windows that are difficult to identify. I will present a few ways you can use them to focus on windows.

The first method is by explicitly naming particular windows and calling them by name.

bindsym $mod+m exec i3-input -F 'mark %s' -P 'Mark name: '
bindsym $mod+Shift+m exec i3-input -F '[con_mark=%s] focus' -P 'Go to mark: '

When the focus is on the window that you’d like to mark, you can press $mod+m and type the mark name, for example: ks (short for the terminal window where you edit kernel source). You can name a few windows that you visit regularly giving them other, ideally short labels and the marks will be stored for the duration of the i3 session.

Then you can immediately access (ie. focus on) them from any workspace or display by pressing $mod+Shift+m and typing an appropriate mark name, eg. ks.

An alternative approach would be to use numbers or letters with Emacs-like modes.

mode "mark_window" {
                bindsym 1 mark m1
                bindsym 2 mark m2
                bindsym 3 mark m3
                bindsym 4 mark m4
                bindsym 5 mark m5
                bindsym a mark ma
                bindsym b mark mb
                bindsym c mark mc
                bindsym d mark md
                bindsym e mark me

                bindsym Return mode "default"
                bindsym Escape mode "default"
}

mode "go_to_window" {

                bindsym 1 [con_mark="m1"] focus
                bindsym 2 [con_mark="m2"] focus
                bindsym 3 [con_mark="m3"] focus
                bindsym 4 [con_mark="m4"] focus
                bindsym 5 [con_mark="m5"] focus
                ...
                                                                                           
                bindsym Return mode "default"
                bindsym Escape mode "default"

}

bindsym $mod+g mode "go_to_window"
bindsym $mod+m mode "mark_window"

Pressing $mod+g you enter the mark_window mode where a new set of keybindings (defined above) applies. Please note that it’s essential that you specify a way of returning to the default mode. Otherwise, you might get stuck as standard i3 keybinding do not work inside modes unless explicitly set. After you’ve entered the “mark_window” mode, you can press, eg. 1 to set a mark on the currently focused window and press Esc or Enter/Return to exit to the default mode. Now whenever you want to jump to window marked as 1, you’d go to the go_to_window mode, press 1 and exit the mode: $mod+g 1 Esc.

All-in-one approach using an i3 mode

The most optimal option, however, could be combining all the above mentioned tips under one mode where you could define your hard coded keybindings, leave an option for adding on-the-fly window labels, as well as use numbers for tagging windows.

mode "focused" {

                # hardcoded focus keybindings
                bindsym b [class="(?i)firefox"] focus
                bindsym w [class="(?i)terminal" title="weechat"] focus
                bindsym m [class="(?i)thunderbird"] focus
                bindsym f [class="(?i)terminal" title="mc"] focus
                bindsym z [class="(?i)zathura"] focus

                # keybindings for marking and jumping to clients
                bindsym a exec i3-input -F 'mark %s' -P 'Mark name: '
                bindsym g exec i3-input -F '[con_mark=%s] focus' -P 'Go to mark: '

                # Assign marks to keys 1-5
                bindsym Shift+1 mark mark1
                bindsym Shift+2 mark mark2
                bindsym Shift+3 mark mark3
                bindsym Shift+4 mark mark4
                bindsym Shift+5 mark mark5

                # Jump to clients marked 1-5
                bindsym 1 [con_mark="mark1"] focus
                bindsym 2 [con_mark="mark2"] focus
                bindsym 3 [con_mark="mark3"] focus
                bindsym 4 [con_mark="mark4"] focus
                bindsym 5 [con_mark="mark5"] focus

                # Exit to the default mode
                bindsym Return mode "default"
                bindsym Escape mode "default"
}

bindsym $mod+n mode "focused"

Enjoy!

i3 4.4 on Slackware (available for -current)

Today’s batch of updates in the -current branch of Slackware has brought some interesting changes. If you have been following this blog, you may have guessed that what was particularly interesting to me was the inclusion of cairo-1.12.14 which ships with the XCB backend enabled by default:

Fri Feb 22 01:09:25 UTC 2013
Lots of X updates in this batch! We were finally able to upgrade to the
latest cairo (including the long-requested XCB backend), as the text
corruption bug that was preventing that was fixed in the upstream X server.

This update makes it possible to build the latest version (ie. 4.4) of the i3 window manager without disabling Pango. For more details, see this post. I have updated my SlackBuilds for i3-4.4 (or to be specific the master branch, which contains the latest stable release + bug fixes). The SlackBuilds are available for downloads from here:

http://slackword.net/files/builds/i3/i3-master/

or from github:

https://github.com/mherda/slackbuilds/tree/master/i3/i3-master

Enjoy and let me know of any problems you might have. On a separate note, thank you Patrick for so many goodies in this batch of updates.

i3 4.4 on Slackware

i3wmEverybody knows that tiling window managers are the cure to all the world’s problems.

…and with the recent release of i3 v. 4.4, the world should sigh with relief. Having thoroughly inspected i3 source code, I can assure everyone that the world is NOT going to end tomorrow or any time soon.

Now that I have hopefully put your mind at rest, we can focus on the new i3 release. As I blogged a few months ago, the 4.3 introduced the pango support for rendering text which resulted in the package not compiling on the stock Slackware installation (see details). The situation has not changed with the release 4.4. At the moment of writing this, Slackbuilds.org offers i3 4.2 which is the last version that works flawlessly without any hacks. If you would, however, like to run i3 4.3+ you can either recompile the stock Slackware cairo package with enabled xcb support or disable pango support in i3. Again, I have chosen the latter option as being less intrusive on a Slackware system.

Below are my updated SlackBuilds scripts for the most recent stable version of i3. The Slackbuild is not written for any particular version of i3, such as 4.3 or 4.4. It automatically pulls the source from the ‘master’ branch of i3 git repository, which is the most recent “stable” release + any bug fixes.

i3 master branch SlackBuilds

One of the new features included in this release is i3-dmenu-desktop, a dmenu wrapper for .desktop files. The feature was discussed in one of the threads of i3 mailing list. To see the full list of changes and bug fixes, please visit 4.4 release notes.

Update: See the update to this article here.
Happy tiling!!!

dwb on Slackware

Being a big fan of lightweight and keyboard driven applications, I have always felt some kind of distrust towards bloated software that relies heavily on mouse clicks. For most tasks, using well configured keyboard shortcuts can be a much more efficient means of interacting with software. It is particularly true of command line software that I use on a daily basis. Since most of my activities involve keyboard driven interaction, it has always felt somewhat inefficient to keep switching between the ‘keyboard’ and ‘mouse’ modes, which is required when using a traditional web browser. It looks like dwb partially solves this nuisance. Edit: I say partially as it does not seem as lightweight as one would wish. As pointed out in the comments, its memory consumption is rather huge for a supposedly lightweight browser. On my system it looks similar to that of Firefox. Still, it is at least worth a try.

What is dwb?

dwb is a highly configurable WebKit web browser. It makes a heavy use of keybindings and employs vi-like modes (normal/insert/hint/command modes). Not only does it provide you with a great number of commands and settings, but also it lets you create custom commands as well as userscripts (via an available javascript API).

Install dwb on Slackware 14

Full Slackware 14 install provides you with most of the required dependencies with the exception of webkitgtk. Once you’ve installed webkitgtk, you can use a SlackBuild script that I have writen to install dwb on Slackware 14. The script (as well as a precompiled package for Slackware64) is available here:

dwb Slackbuild script and package downloads

Please make yourself familiar with dwb documentation before you start using it.

Happy browsing.

i3 4.3 on Slackware

I welcomed yesterday’s release of i3 4.3 with excitement. Having been busy elsewhere, I did not follow the ‘next’ branch of i3 git repository and, therefore, was not aware of what’s cooking. The moment I started building a new shiny package, my excitement somewhat subsided.

Pango support

Version 4.3 introduces pango support for rendering text, which would be a great news if not for the fact that an XCB backend support was still an experimental feature (and, therefore, disabled by default) in cairo 1.10.2, the version that Slackware (14rc5) ships with. In consequence, for i3 >= 4.3 to build on Slackware, one would have to upgrade the stock cairo package. The XCB backend has apparently reached a stable status and is enabled by default in cairo version 1.12.2+. As always, Pat is the person to decide whether it is mature enough for Slackware. Hopefully, it is and it’ll enter the -current branch of Slackware in the next development cycle. (Update: See Pat’s comments on the issue).

An alternative solution (which I have chosen) was to disable pango support in i3 4.3. As this feature is an integral part of i3wm 4.3, disabling it is not recommended by Michael Stapelberg, i3 author and main developer (4.3 release notes):

Another very important change is that we now support pango for rendering text. The default is still to use misc-fixed (X core fonts), but you can use a font specification starting with “xft:” now, such as “xft:DejaVu Sans Mono 10″ and i3 will use pango. The sole motivation for this is NOT to have fancier window decorations, but to support fonts which have more glyphs (think Japanese for example) and to support right-to-left rendering (open http://www.ftpal.net/ for an example). Supporting users from all over the planet is important, and as such I would strongly advise distribution packagers to leave pango support enabled. In case you are working on a very low-spec embedded device, it is easy enough to disable pango support, see common.mk.

Personally I do not need it so am going to run 4.3 (pango disabled) until cairo gets upgraded in Slackware (I’m not in a hurry:)). You can do the same but don’t say you haven’t been warned!!!

Here is my SlackBuild script for i3 v 4.3 (pango disabled). Please note that I pointed it to the master branch of i3′s git repository which basically is the latest stable release + bug fixes, which at the moment of writing is 4.3. Should a new version be released, eg. 4.4, the script will automatically pull it from the git repository. Unlike with standard SlackBuilds there’s no need to manually download the source code.

Feel free to use it but bear in mind that, at the moment of writing it, a recommended version of i3 to be run on Slackware is i3 4.2 which is available from SlackBuilds.org so if you don’t like living on the edge, please stop reading now and stay with 4.2!

Now for the fun part.

What’s new?

Apart from the above mentioned pango support (which we have disabled) there are lots of bug fixes and some new features available with this release. I particularly like the ability to specify the layout for the parent split container:

 for_window [class="XTerm"] layout tabbed

When I start i3 both Firefox and Thunderbird start on Window 2. Up until now it was not possible (or easy) to make them automatically open in a tabbed mode. This ensures that Window 2 (and only 2) starts in a tabbed mode.

assign [class="Firefox"] 2
assign [class="Thunderbird"] 2
for_window [class="Firefox"] layout tabbed
exec firefox
exec thunderbird

Layout toggle

In 4.3 you can still use the old “split h” and “split v” commands. On top of that, the old “layout default” command has been replaced with “layout toggle split”, which changes the orientation (horizontal/vertical) of windows. If you have an old config file, find “layout default” and change it to “layout toggle split”. On my system it’s bound to “Mod1+e”. Open a few terminal windows and play with this command changing the focused window from time to time.

Efficient CLI Navigation

The CLI (Command Line Interface) is a very powerful, flexible and extremely programmable environment that lets you do anything you can ever think of …well, perhaps except for slaying the Dragon of Isengard. To harness its power, one’s mind needs to be as clear as the cloudless hour, and thoughts as pure as mountain dew. Although the road to enlightenment is long and arduous, there are some shortcuts that will help keep what’s left of your sanity.

Below you’ll find some tips on efficient navigation in the CLI.

Go Back Home

The cd command takes you back to your /home directory:

$ pwd
/home/user/data/documents/work
$ cd
$ pwd
/home/user

Go Back to the Previous Directory

To go back to the previous directory, you can use cd with a dash (-):

$ pwd
/home/user/.i3/config
$ cd ~/data/projects/dotfiles/i3
$ pwd
/home/user/data/projects/dotfiles/i3
$ cd -
/home/user/.i3/config
$ pwd
/home/user/.i3/config

Use the Last Argument of the Previous Command

The $_ variable returns the last argument of the previous command. This can be helpful in a variety of scenarios:

$ pwd
/home/user/downloads/
$ cp i3status.tar.gz ~/data/builds/i3/i3status
$ cd $_
$ pwd
/home/user/data/builds/i3/i3status
$ chmod +x /path/to/my/script/script.sh
$ $_
(This will execute script.sh)

Bash Aliases

You can make your life easier by creating aliases (= shortcuts) for commands that you use often. The syntax is very simple:

name_of_the_alias='value'

You can place your aliases in ~/.bashrc. You might need to create this file. Each time you edit this file you need to source it afterwards for the changes to take effect:

source ~/.bashrc

or

. ~/.bashrc

When it comes to navigation, one could, for example, create a few aliases to speed up navigating up the directory tree:

alias 1.='cd .. ; pwd'
alias 2.='cd ../.. ; pwd'
alias 3.='cd ../../.. ; pwd'
alias 4.='cd ../../../.. ; pwd'

The value of an alias can be quite complex. As you can see, 4. will first change directories (cd ../../../..) and then print the current working directory – pwd. Please note a semi-colon (;) separating the commands.

$ cd data/projects/python-dir/euler/
$ 4.
/home/user
$ cd -
/home/user/data/projects/python-dir/euler
$ 3.
/home/user/data

Aliases can be used in a number of different ways. A few more examples:

alias epyt='emacs -nw /home/user/data/projects/python-dir/32-problem.py'
alias slacktop='ssh user@slacktop'

Directory Stack

BASH features some helpful directory stack buildins that help you navigate recently visited directories.

pushd – push a directory into the directory stack and cd to it.
popd – remove a directory from the directory stack and cd to it.
dirs – display the list of the directories in the stack.

How does it work in practice?

First of all, add a directory to the stack. Please note that it also automatically switches to the directory (the -n flag suppresses this behaviour).

user@darkstar:~$ pushd data/projects/programming/
~/data/projects/programming ~
user@darkstar:~/data/projects/programming$

Alternatively, you can cd to a given directory and issue:

pushd .

After adding a few directories you can display the content of the stack:

user@darkstar:~$ dirs -v
0 ~/projects/web-develop/project-eden/includes
1 ~/projects/web-develop/project-eden/includes
2 ~/projects/web-develop/project-eden/pages/en
3 ~/projects/web-develop/project-eden/css
4 ~/projects/designs
5 ~/projects/notes
6 ~/public_html/project_eden

Please note that the first entry always displays the current working directory so if it also sits at the top of the stack, you’ll see what seems like duplicate lines. The -v flag is responsible for a nicely indexed output.

To switch to one of the directories in the stack you could issue:

user@darkstar:~$ cd $(dirs +2 -l)
user@darkstar:~/projects/web-develop/project-eden/pages/en$

Admittedly, this is not the most concise way of changing directories. To make it shorter we can add an alias and a function to the ~/.bashrc file.

alias dv='dirs -v'

List the current stack by simply typing dv.

cdd()
{
    position=$1
    if [ -z $position ]; then
        echo "You need to specify a directory in the stack"
    else
        cd $(dirs +$1 -l)
    fi
}

The cdd function (based on this one) makes it possible to cd to a given directory from the stack by typing:

cdd 3

Hope this will help you in your quest to become a CLI wizard.

ThinkPad E530 with Slackware

Recently I have purchased Lenovo ThinkPad E530. Unfortunately, I can see a big difference between it and my previous Lenovo laptop, ThinkPad T410. Straight away you notice that they belong to different categories. But then again, as opposed to a budget class E530, the T-series is a business class model (and is therefore appropriately priced) so the comparison would not be fair.

Still, I like it; especially the fact that everything seems to work out of the box on Slackware 14 (still -current at the moment of writing). It appears that the purchase was timed quite well. E530 features the following wifi chip:

03:00:0 Network controller: Intel Corporation Centrino Wireless-N 2230 (rev c4)

The iwlwifi module supporting this chip has been added with kernel 3.2.0 so it looks like the wifi card wouldn’t work out of the box on Slackware 13.37 and older.