OpenBSD Journal

Stupid GUI Tricks: OpenBSD + Xinerama + x11/awesome

Contributed by merdely on from the xinerama-is-awesome dept.

Xinerama(3) [Wikipedia] has been part of the OpenBSD X distribution for some time. I was able to get a chance to play with it when I got my hands on a second video card and monitor.

As an x11/dwm user, I leaned towards x11/awesome as my Xinerama-aware window manager. More information about how I got Xinerama working and how I configured x11/awesome below.

Prior to adding the second video card and monitor to my system, I was previously able to run xenocara without an xorg.conf on my i386 machine. After installing the second card and attaching the monitor, I used 'X -configure' to generate a configuration file. After that, I only had to modify a couple pieces of my xorg.conf. My ServerLayout section looks like this. I had to add the "Xinerama" "On" Option:

Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen 0       "Screen0" 0 0
        Screen 1       "Screen1" RightOf "Screen0"
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
        Option         "Xinerama" "On"
EndSection

Not all window managers are Xinerama-aware/capable. The "awesome" window manager is a fork of the dwm window manager that supports Xinerama and run-time configuration. Since I use dwm on my laptop, I felt comfortable using awesome on my dual-head desktop. The only pertinent changes I made to my ~/.awesomerc (to make it more useful to me) are changing:

    key
    {
        modkey = {"Mod1"}
        key = "Tab"
        command = "focus_history"
        arg = "-1"
    }
to
    key
    {
        modkey = {"Mod1"}
        key = "Tab"
        command = "screen_focus"
        arg = "+1"
    }
    key
    {
        modkey = {"Mod1", "Shift"}
        key = "Tab"
        command = "screen_focus"
        arg = "-1"
    }
The above change allows <alt>+<tab> and <alt>+<shift>+<tab> to cycle between screens instead of windows. I also added:
    key
    {
        modkey = {"Mod1"}
        key = "p"
        command = "spawn"
        arg = "exec dmenu_run"
    }
    key
    {   
        modkey = {"Mod1", "Shift", "Control"}
        key = "j"
        command = "client_movetoscreen"
        arg = "+1"
    }
    key
    {   
        modkey = {"Mod1", "Shift", "Control"}
        key = "k"
        command = "client_movetoscreen"
        arg = "-1"
    }
This makes <alt>+<p> launch x11/dmenu, <alt>+<shift>+<ctrl>+<j> move a window to the screen to the right and <alt>+<shift>+<ctrl>+<k> move a window to the screen to the left.

With my two screen set up, I generally have my GUI applications on the left-hand screen (firefox, thunderbird) and a local xterm. On the right-hand screen, I have my "main" xterm running screen with mutt, irssi and different connections to the different hosts I manage. [screenshot]

Even though Xinerama has generally been deprecated by XRandR (and it's accompanying command: xrandr(1)), XRandR isn't supported by older X drivers (like the one I'm using). Also, XRandR is designed for use with multiple outputs on one card, not multiple cards as in this case. I don't have a dual-head card to test, so can't comment on it. If anyone with such hardware would like to comment, please do so below.

If you've got some "Stupid User Tricks" you'd like to share, please submit a story.

(Comments are closed)


Comments
  1. By Ivo van der Sangen (77.251.29.95) ivo@freethought.nl on http://freethought.nl/~ivo/index.html

    Personally I use xmonad as a window manager, which is a tiling window manager. It is written in Haskell and is very clean and small. It supports xinerama, although I don't have multiple monitors and have not tested xinerama support on OpenBSD, but it works great on Debian.

    Comments
    1. By Anonymous Coward (206.248.190.11) on

      > Personally I use xmonad as a window manager, which is a tiling window manager. It is written in Haskell and is very clean and small. It supports xinerama, although I don't have multiple monitors and have not tested xinerama support on OpenBSD, but it works great on Debian.

      Xmonad's xinerama support works just fine on openbsd. And its much nicer than the other tiling WMs I've tried.

      Comments
      1. By dons (69.30.123.194) on http://xmonad.org

        > > Personally I use xmonad as a window manager, which is a tiling window manager. It is written in Haskell and is very clean and small. It supports xinerama, although I don't have multiple monitors and have not tested xinerama support on OpenBSD, but it works great on Debian.
        >
        > Xmonad's xinerama support works just fine on openbsd. And its much nicer than the other tiling WMs I've tried.

        One of the two core xmonad hackers develops exclusively on OpenBSD --
        so xmonad should be rock solid there.

        -- Don (one of the two core xmonad devs)

        Comments
        1. By Carlos Valiente (81.168.12.40) yo@virutass.net on

          > One of the two core xmonad hackers develops exclusively on OpenBSD --
          > so xmonad should be rock solid there.

          When compiling xmonad-contrib-0.7 on -current (ghc 6.6.1), I get several errors like this one:

          $ runhaskell ./Setup.lhs build
          [..]
          [ 3 of 119] Compiling XMonad.Util.Timer ( XMonad/Util/Timer.hs, dist/build/XMonad/Util/Timer.o )

          XMonad/Util/Timer.hs:53:16:
          Not in scope: data constructor `ClientMessageEvent'

          XMonad/Util/Timer.hs:53:36: Not in scope: `ev_message_type'

          XMonad/Util/Timer.hs:53:58: Not in scope: `ev_data'
          $

          Is ghc 6.8.x needed for that stuff, perhaps?

  2. By escapenguin (209.41.163.23) escapenguin at g m a i l dot c o m on

    At my workplace we have Dell Optiplexes with a single Radeon X600 and a single DVI output. I use a DVI splitter to hook up two monitors. Right now I use MergedFB because with Xinerama the second monitor's windows would flicker when moving them around. Windowmaker is smart enough to tell there's two monitors. So this is interesting.

    Comments
    1. By dingo (198.208.159.19) dingo@1984.ws on

      > Windowmaker is smart enough to tell there's two monitors. So this is interesting.

      windowmaker is so old and undermaintained, yet I keep coming back to it year after year, despite trying so many other window managers!

      Comments
      1. By Cabal (Cabal) on http://www.romraider.com/

        > > Windowmaker is smart enough to tell there's two monitors. So this is interesting.
        >
        > windowmaker is so old and undermaintained, yet I keep coming back to it year after year, despite trying so many other window managers!

        It's not undermaintained, it's feature-complete. ;)

      2. By Anonymous Coward (69.248.199.119) on

        > > Windowmaker is smart enough to tell there's two monitors. So this is interesting.
        >
        > windowmaker is so old and undermaintained, yet I keep coming back to it year after year, despite trying so many other window managers!

        I get ribbed for using it sometimes because it "looks so old" but, yeah, same here. I'll try something new every once in a while and just feel uncomfortable until I switch back.

      3. By Stu (69.159.184.141) on

        > ... I keep coming back to it year after year, despite trying so many other window managers!

        You're not the only one. :)

        I can get it to crash pretty easily, though.

  3. By Anonymous Coward (24.222.223.104) on

    I wonder, has anybody tried an OpenBSD computer-sharing setup for 2 or more users (with multiple-mice/keyboards/video-cards and monitors)?

    Comments
    1. By lvlamb (81.245.179.231) on

      > I wonder, has anybody tried an OpenBSD computer-sharing setup for 2 or more users (with multiple-mice/keyboards/video-cards and monitors)?

      man xorg.conf

      Xorg uses a configuration file called xorg.conf for its
      initial setup. This configuration file is searched for in
      the following places when the server is started as a nor-
      mal user:

      /etc/X11/<cmdline>
      /usr/X11R6/etc/X11/<cmdline>
      /etc/X11/$XORGCONFIG
      /usr/X11R6/etc/X11/$XORGCONFIG
      /etc/X11/xorg.conf-4
      /etc/X11/xorg.conf
      /etc/xorg.conf
      /usr/X11R6/etc/X11/xorg.conf.<hostname>
      /usr/X11R6/etc/X11/xorg.conf-4
      /usr/X11R6/etc/X11/xorg.conf
      /usr/X11R6/lib/X11/xorg.conf.<hostname>
      /usr/X11R6/lib/X11/xorg.conf-4
      /usr/X11R6/lib/X11/xorg.conf



  4. By Anonymous Coward (74.13.56.132) on

    But do we like awesome? They took MIT code and GPLed it, isn't that sadf?

    Comments
    1. By CODOR (CODOR) on

      > But do we like awesome? They took MIT code and GPLed it, isn't that sadf?

      It lives in ports, so it's okay...

  5. By D. Adam Karim (archite) adam@akarsoft.com on

    You know, I think I'm going to switch from using ratpoison to awesome, I really like it's features.

    After reading through the manpage though, I've found that alt+ctrl+K does exactly what you're talking about except only requires one key combo.

    Comments
    1. By D. Adam Karim (archite) on

      > You know, I think I'm going to switch from using ratpoison to awesome, I really like it's features.
      >
      Okay, so one huge feature/issue with awesome: if you have no windows open or focussed, hit ctrl+alt+return, it cores out. I'm gathering a patch together. It's great beyond that ;)

      Comments
      1. By Mike Erdely (merdely) on http://erdelynet.com/

        > Okay, so one huge feature/issue with awesome: if you have no windows
        > open or focussed, hit ctrl+alt+return, it cores out. I'm gathering a
        > patch together. It's great beyond that ;)

        Hmm.... I can't reproduce that. Then again, ctrl+alt+return doesn't nothing at all on my machine.

        Comments
        1. By D. Adam Karim (archite) on

          > > Okay, so one huge feature/issue with awesome: if you have no windows
          > > open or focussed, hit ctrl+alt+return, it cores out. I'm gathering a
          > > patch together. It's great beyond that ;)
          >
          > Hmm.... I can't reproduce that. Then again, ctrl+alt+return doesn't nothing at all on my machine.

          (gdb) bt
          #0 0x1c0049d1 in uicb_client_zoom (screen=0, arg=0x0) at client.c:995
          #1 0x1c006078 in handle_event_keypress (e=0xcfbf0228) at event.c:305
          #2 0x1c007906 in main (argc=1, argv=0xcfbf0704) at awesome.c:396

          Comments
          1. By D. Adam Karim (archite) on

            > > > Okay, so one huge feature/issue with awesome: if you have no windows
            > > > open or focussed, hit ctrl+alt+return, it cores out. I'm gathering a
            > > > patch together. It's great beyond that ;)
            > >
            > > Hmm.... I can't reproduce that. Then again, ctrl+alt+return doesn't nothing at all on my machine.
            >
            > (gdb) bt
            > #0 0x1c0049d1 in uicb_client_zoom (screen=0, arg=0x0) at client.c:995
            > #1 0x1c006078 in handle_event_keypress (e=0xcfbf0228) at event.c:305
            > #2 0x1c007906 in main (argc=1, argv=0xcfbf0704) at awesome.c:396
            >

            --- client.c.orig Wed May 7 08:28:22 2008
            +++ client.c Wed May 7 08:28:25 2008
            @@ -992,7 +992,10 @@
            {
            Client *c, *sel = globalconf.focus->client;

            - for(c = globalconf.clients; !client_isvisible(c, screen); c = c->next);
            + if ((c = globalconf.clients) == NULL)
            + return;
            +
            + for(c; !client_isvisible(c, screen); c = c->next);
            if(c == sel)
            for(sel = sel->next; sel && !client_isvisible(sel, screen); sel = sel->next);

            Comments
            1. By Mike Erdely (merdely) on http://erdelynet.com/

              > > (gdb) bt
              > > #0 0x1c0049d1 in uicb_client_zoom (screen=0, arg=0x0) at client.c:995
              > > #1 0x1c006078 in handle_event_keypress (e=0xcfbf0228) at event.c:305
              > > #2 0x1c007906 in main (argc=1, argv=0xcfbf0704) at awesome.c:396
              > >
              >
              > --- client.c.orig Wed May 7 08:28:22 2008
              > +++ client.c Wed May 7 08:28:25 2008

              There's an update to awesome that will be looked at soon.
              We'll address this then.

              Comments
              1. By Mike Erdely (merdely) merdely@ on http://erdelynet.com/

                > There's an update to awesome that will be looked at soon.
                > We'll address this then.

                To close up this thread: awesome-2.3, which fixes this bug, is about to be committed.

  6. By niebie (84.184.248.243) on

    The articles mentions xrandr so here's my little success story about that:

    I have a Dell PC at work with an Intel onboard graphics card (some i9xx). It has one VGA and one DVI port, and I just got my hands on a second display. So now I have an 18" on the VGA and a 22" on the DVI.

    I first tried Xinerama but it didn't really work (maybe because it's just one graphics card). After some RTFM I figured that all I had to do was to start with an "X -configure" generated file, replace the driver line (by default it was "i810", but the newer "intel" driver is needed), and add a "Virtual <width>x<height>" line to the Display sections according to the combined resolution of both screens.

    Both screens showed the same image by default (cloning mode), but the simple command "xrandr --output VGA --left-of TDMS-0" (TDMS-0 is the driver's name for the DVI port) gave me a nice extended desktop. Oh and I'm using FVWM 2.5.x which seems to support it just fine.

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]