onilog

posts tagged "wm"

Notstumpwm

24 May 2013 0:10 AM (stumpwm | notion | config | lua | lisp | wm | archlinux | exherbo)

I have just returned from an excursion into the land of exherbo, which is an awesome source-based distro, and I found that while I was gone, something changed that made stumpwm cause a segmentation fault in X11 a few seconds after starting up.

I have tried everything I can think of to get it running again, but alas, to no avail. So I started looking at alternatives again. Feeling a little crazy I decided to give notion another try. And it fits strangely well.

It's configured/extended in lua, which I'm not particularly fond of, and it has a (in my opinion) crazy default configuration. But it also allows Emacs-like key combinations out-of-the-box, which is a very big plus in my book. So the quest to bring it closer to my stumpwm setup has begun.

Window layout

One of the nicest additions to my stumpwm configuration I made in the last few weeks was a loaded window configuration which put my Emacs frames in a big chunk of my left monitor, my terminals on my left monitor with just enough space for 80 columns and my web browser filling my right screen. I had also set-up some rules to always place them in the correct spots.

I have not yet tried to automatically place the windows in the right spots, but I do have the proportions right. I just had to delete the right frames and resize the one for terminals and, by default, notion remembers this set-up and automatically restores it when I log in.

I will look at creating a special layout for this so I don't have to worry about (accidentally) changing things.

run-or-raise

I found this interesting page about run-or-raise-like functionality for Ion3, which notion is a fork of. This is a little outdated, though, since notion has changed (apparently) the workings of some functions and lua 5.2 introduced the goto keyword, so I had to change it to this:

function oni_match_class(class)
   local result = {}
   ioncore.clientwin_i(
      function (win)
         if class == win:get_ident().class then
            table.insert(result, win)
            return false
         end
         return true
      end
   )
   return result
end

function xsteve_run_byclass(prog, class)
   local win = oni_match_class(class)[1]
   if win then
      win:goto_()
   else
      ioncore.exec(prog)
   end
end

There is no function to get a list of all the client windows, only a function to iterate over them. For the moment I am only interested in finding the first window with class CLASS, so I return false when a match is found, this stops the iteration process. I also had to use the WRegion.goto_ function, instead of WRegion.goto because of the mentioned change in lua 5.2, but they are the same.

I then only have to bind it:

defbindings("WScreen", {
    -- ...
    submap("Control+Z", {
        -- ...
        kpress("E", "xsteve_run_byclass('emacsclient -ca emacs', 'Emacs')"),
        kpress("W", "xsteve_run_byclass('conkeror', 'Conkeror')"),
        kpress("C", "xsteve_run_byclass('urxvt', 'URxvt')"),
    }),
})

Quoting C-z

One of the coolest things about using a prefix in stumpwm that I have been able to find in precious few other solutions is the ability to send the prefix key to the applications you use, so you don't entirely miss its functionality. In stumpwm this is easy, but in notion its a little more work:

defbindings("WClientWin", {
    -- ...
    submap("Control+Z", {
        -- ...
        kpress("Q", "WClientWin.quote_next(_)"),
    }),
})

This means that I have to type C-z q C-z to send the C-z key to, for instance, Emacs. That a few more keys than I was used to in stumpwm, but at least it's possible.

Utilities

5 November 2012 11:47 PM (wm | linux | software | desktop)

A friend of mine installed Archlinux on his PC the other day, for which I applaud him as it is the best distro out there, and it got me thinking about some of the programs I've found after venturing outside of the safety of a desktop environment like GNOME or KDE.

The closest thing I've come to a desktop environment outside of one was the awesome window manager. By default it comes with a system tray and notifications (daemon). This makes for a very easy transition as those are two of the things that seem to be in a bit of a short supply. There are plenty of file managers (although ZSH and Emacs are good enough for me) and, of course, window managers. Another cool thing is that it is one of the most programmable window managers around. If you learn a bit of lua you can make some very nice customizations.

There are lots, or at least a couple, of tray applications, like Stalonetray and trayer (part of the FVWM-Crystal project, but seemingly also usable stand-alone), but I've never really tried them since I don't use any applications that show an icon there.

A notifications daemon seemed most difficult to find back when I stopped using GNOME. I did without for a while, but eventually someone wrote dunst and my problem was solved. It's very easy, and is fairly configurable. Just start it in the background from your .xinitrc and all should be well.

dmenu is a very nice menu system with very few dependencies. dunst also seems to have based its funcion/look on dmenu. I mostly use it as a program launcher, but give it a list of possibilities and configure it the way you like and you can use it for pretty much any kind of selection.

dzen2 is another very versatile piece of software. It can be used to create a status bar. It has a funky syntax, but once you get the hang of it it's really cool. The most interesting part is that takes whatever you want it to show from stdin and parses it for its own syntax and that's about it. This means that it's pretty much configurable in any language. A shell script might be most obvious, since piping input and output is really easy, but if you know your way around python, lisp, C or pretty much anything that can open pipes to other applications you can use that too.

If you have a window manager with some kind of IPC or another way to call commands through an external application, like the awesome-client for awesome you could also use xbindkeys, which offers a pretty nice way to configure your keybindings in a WM-independent way. If you have it compiled with support for guile it gets even cooler, because then you have a complete programming language to configure it with, which offers tricks like multi-level keybindings, kind of like Emacs (for example C-i w or C-i p b c and things like that).

That's most if what I've found that I still use. These don't replace everything a desktop environment offers, of course, but automounting is not something I miss a lot, though that too is possible, and I don't even remember anything else a desktop environment does. So I hope there is at least one interesting application you might use in here. If you know any others, feel free to let me know about them.