You are not logged in.

#1 2008-02-20 15:25:50

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Xmonad: Start application sometimes floating, sometimes not.

Hello fellow Archers!

I'm using Xmonad for a couple of days now and as I'm getting used to the short cuts it's really a nice way of working.

There are some disadvantages compared to Openbox, mainly regarding the placement and focus of floating windows, but I'm currently learning Haskell and will solve this soon enough. wink

There's only one thing which really annoys me: I'm used to having half-transparent 80x25 terminals (I use urxvt) floating around my desktop. I would read a PDF or website in the background while working in the terminal in the foreground.

Is there any way to tell Xmonad that I want to start certain terminals in floating mode, while all other terminals should be in tiling mode? (Preferably only using urxvt.)

For instance I press Win+Shift+Enter and I get a tiled terminal and I press Alt+F1 and I get a floating one.

Thanks in advance for your help!

Offline

#2 2008-02-20 16:30:27

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Xmonad: Start application sometimes floating, sometimes not.

An idea on how to do it: you can run some of your urxvt's with different "-name" (see urxvt's manual page). Xmonad can match windows on name property...

Offline

#3 2008-02-20 23:10:27

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Xmonad: Start application sometimes floating, sometimes not.

wuischke wrote:

I'm using Xmonad for a couple of days now

You beat me to it! For some intuitive reason, I want to learn Haskell before using Xmonad. Learning Haskell takes a bit of time though.

wuischke wrote:

I'm currently learning Haskell and will solve this soon enough. wink

Maybe you have the better solution.

Anyway, interesting question. Bender's solution looks good. I'm a fan of short wrappers:

$ cat ~/bin/flterm
#!/bin/sh
urxvt -name "floating urxvt"

$ cat ~/bin/titerm
#!/bin/sh
urxvt -name "tiled urxvt"

then the "Haskell" part will be telling Xmonad how to handle those two; I can't help you there. (yet!)

P.S. If you're reading this through TTS, it's important for me to clarify that I don't particularly like rap. Even if it's performed by a short person.

Last edited by peets (2008-02-20 23:11:18)

Offline

#4 2008-02-21 00:10:48

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Xmonad: Start application sometimes floating, sometimes not.

For the xmonad part, you can get an idea on how to match class name by looking at the template xmonad.hs config file, particularly myManageHook. Since xmonad.hs files vary *very much* from person to person, you need to adapt that part to your setting. Minimal config for what you want to do would be something like this:

import XMonad

myManageHook = composeAll
    [ className =? "floating urxvt"        --> doFloat ]

main = xmonad defaults

defaults = defaultConfig {  manageHook         = myManageHook   }

EDIT: forgotten import fixed

Last edited by bender02 (2008-02-21 00:12:05)

Offline

#5 2008-02-21 00:26:18

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Re: Xmonad: Start application sometimes floating, sometimes not.

Thanks a lot, I've got it working now.

xprop | grep WM_CLASS for a window will give two values: the first correspondents to the title value below while the second can be used with className.
By using "urxvt -name urxvtfloat" the title is changed so that I got it working with the following code change in ~/.xmonad/xmonad.hs (some context provided)

myManageHook = composeAll
    [ className =? "MPlayer"        --> doFloat
    , className =? "Gimp"           --> doFloat
    , title     =? "urxvtfloat"     --> doFloat
    , resource  =? "desktop_window" --> doIgnore
    , resource  =? "kdesktop"       --> doIgnore ]

@peets: You don't need to know Haskell in order to use Xmonad. But if you want to configure it to your needs, some knowledge is recommendable.

To be frank, I know that it'll take me quite some to learn Haskell. I barely start to grasp the ideas behind functional programming...

Offline

#6 2008-02-21 00:37:03

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Xmonad: Start application sometimes floating, sometimes not.

The problem that I find when using the -name flag is that the .Xdefaults are not processed properly.  I think the -name flag is meant to be used for resource definitions, rather than titling the terminal window.  Titles appear to be handled by the -n (iconName) and -T (title) flags, according to the urxvt manpages.  However, these tags have no effect on the X classNames unless urxvt is executing another program (e.g. urxvt -T myTitle -e alsamixer)


thayer williams ~ cinderwick.ca

Offline

#7 2008-02-21 03:55:20

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Xmonad: Start application sometimes floating, sometimes not.

thayer: that's true, I think the -name parameter was originally intended as an access to an alternative resouce set (at least the urxvt manpage says so). I know it's not totally clean solution, but.... if you don't mind adding a couple of extra lines to .Xresources (essentially the copies of the usual urxvt.*, but now as <newrxvtname>.*), things should be back to normal. With the "advantage" of a possibility of using different font in the floating windows... smile

Offline

#8 2008-02-21 05:34:01

eerok
Member
From: Canada
Registered: 2005-03-20
Posts: 171

Re: Xmonad: Start application sometimes floating, sometimes not.

peets wrote:
wuischke wrote:

I'm using Xmonad for a couple of days now

You beat me to it! For some intuitive reason, I want to learn Haskell before using Xmonad. Learning Haskell takes a bit of time though.

On the other hand, I think Xmonad is an excellent environment in which to learn Haskell.  smile

You don't need to know any Haskell to run Xmonad.  I installed it a few days ago just to take a quick look, and I haven't been able to tear myself away from it.


noobus in perpetuus

Offline

Board footer

Powered by FluxBB