March 9, 2011
filed around lunchtime by dirk husemann in: hacking,linux
technorati tags:
QR code for this entry · average time to read 2:37 minutes

i’ve long been using an external 22″ monitor with my ubuntu linux powered X200 thinkpad. while ubuntu maverick (10.10) has some issues with attaching and detaching the second monitor and subsequent suspend–resume cycles (the second suspend after a detach would not resume, d’oh), ubuntu lucid (10.04.02) works just fine (as befitting a long-term-support release).

for quite a while i’ve had the old 20″ monitor which i had been using previously sitting on my desktop along with an USB DisplayLink adapter — the idea being to hook the old monitor up as well as a third monitor1. the displaylink driver provided by ubuntu lucid seemed to work properly — the monitor’s screen would turn green on connecting it and a framebuffer device (/dev/fb1) and so i tried various recipes floating around on ubuntu forums and elsewhere — all promising to achieve a grand unified desktop comprising all three monitors — and they either didn’t work or if they achieved the grand unified desktop it was unusable.

so, after another prolonged period during which the monitor and the displaylink adapter gathered even more dust, i tried a different approach: give up on the grand unified desktop goal and instead just try to make use of the monitor. the idea this time was to start up a VNC server, then use a VNC client to directly render the server into the framebuffer device (/dev/fb1) provided by linux’s displaylink driver. the vncserver bit is actually quite easy:

vncserver -name hidden -geometry 1600x1200 -depth 16 :42

which starts a VNC server for the :42 display.

the VNC client bit turned out to be a bit more difficult. ubuntu lucid does have directvnc client which is “a vnc client for the linux framebuffer device”2. that client does seem to require keyboard and mouse access and in some configurations did not work at all or locked up my keyboard (not the mouse, though, funnily enough) or crashed the running X session, so no points on that one. further research luckily turned up vnc2dl by none other than quentin stafford-fraser one of the original VNC developers (and also the inventor of the webcam it seems). vnc2dl seemed a bit more promising and — after slightly modifying3 dldevice.c — did do the job:

sudo vnc2dl :42

next up was fusing display :42 to my main display :0 on a keyboard and mouse level so that i could just move the mouse pointer over to the left and end up on display :42 — here x2x (in the equally named ubuntu package) came into play:

x2x -west -to :42 >/dev/null 2>&1 &

and, hey, presto!, both displays are linked mouse and keyboard wise.

only thing still bothering me was that cut and paste was not working. to fix that required adding

vncconfig -nowin &

to my .vnc/xstartup file.

to have firefox run on display :42 required creation of a new firefox profile — i added that to .vnc/xstartup as well.4


  1. yep, even more screen real estate; can’t have enough of that: the ur-IDE emacs in one screen, instant messaging app pidgin on the other (for communicating with the team), the third screen would be really useful to host a firefox window with the API docs and so forth. 

  2. see man directvnc for more information about that one. 

  3. vnc2dl in the version on quentin’s github is hard-wired to 1280×1040/24bpp which my old monitor doesn’t quite grok, changing the wiring to 1600×1200/16bpp made it more grokkable for my setup. 

  4. to get the new profile synchronized with the default profile i used firefox’s recently added Firefox Sync add-on. 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
March 3, 2011
filed mid-morning by dirk husemann in: hacking
technorati tags:
QR code for this entry · average time to read 1:00 minutes

i’m a big fan of IRC and we use it in our distributed team to stay in touch and also coordinate testing and upgrades. as i’m also a big fan of the ur-IDE emacs i’m using emacs’s rcirc mode for my IRC needs. typically i have a small buffer window at the bottom of my emacs frame dedicated to IRC. quite nice…

…until you start sbt or do some git work in egg as then those modes try to acquire some screen real-estate and without scruples either “recycle” my IRC buffer for their content :-( or split it into two :-(

this being emacs there had to be a way to get that IRC buffer window protected. and there is :-) digging into the emacs info docs and looking at the underlying emacs lisp files this is what i came up with:

 
 (defun rcirc-toggle-current-window-dedication ()
   (interactive)
   (let* ((window (selected-window))
          (dedicated (window-dedicated-p window)))
     (set-window-dedicated-p window (not dedicated))
     (setq window-size-fixed (not window-size-fixed))
     (message "Window %sdedicated to %s"
              (if dedicated "no longer " "")
              (buffer-name))))

 (global-set-key (kbd "<Scroll_Lock>") 'rcirc-toggle-current-window-dedication)
 

this will toggle the window-dedicated-p and window-size-fixed bits of the window in which you press the scroll-lock key — and, hey, presto! — no more pirating of the IRC buffer window.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.