You are not logged in.

#1 2010-11-23 02:19:04

Osage
Member
Registered: 2010-08-17
Posts: 8

Using XMonad to tab windows (or alternatives?)

I'm currently using XMonad, and I'd like to use it to tab windows (terminals and browsers (things like vimprobable, jumanji, dwb, etc. that don't have native tab support) for example). I know I could use suckless-tabbed, but I'd really like to keep my options open at the moment to all possibilities.

I checked #xmonad, but didn't get much help at the time. Right now, it seems my only option is XMonad.Layout.SubLayouts, but I have no idea how to set this up. I realize XMonad.Layout.Tabbed exists, but its full screen. I'm currently using Chromium so that I can browse the web (tabbed) as well as have terminals open underneath all on one screen, which is why I don't want to use XMonad.Layout.Tabbed. I've searched for a while online, but haven't been able to find anything, not even code, to hack together.

The only alternatives I'm really open to are other ways to do this natively within XMonad, or suggestions for another tiling manager. I like XMonad, but I've been meaning to try a bit more seriously all the other ones out there.

Offline

#2 2010-11-23 03:07:51

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: Using XMonad to tab windows (or alternatives?)

I wanted this too but didn't find a "real" solution since I'm so great with the Haskell. I really just wanted one master pane with everything else tabbed below it. Then I realized I wanted a way to toggle "two" master panes above the tabbed frame in case I needed 3 windows visible. I guess you could toggle between fullscreen tabbed too if you want, or some other more "dynamic" layout. Again, this doesn't really work the way I want but here's what I did which seems to work allright , but I only use it on one workspace since there's no "perlayoutkeys" to import.. just workspace. Anyway,

First I had to edit a file in xmonad-contrib-darcs (or just xmonad-contrib): src/XMonadContrib/XMonad/Layout/Master.hs

--- Master.hs   2010-11-22 21:36:37.000000000 -0500
+++ Master-New.hs      2010-11-22 21:37:06.000000000 -0500
@@ -78,7 +78,7 @@
     let ws = S.integrate' $ st
     if length ws > 1 then do
         let m = head ws
-        let (mr, sr) = splitHorizontallyBy frac rect
+        let (mr, sr) = splitVerticallyBy frac rect
         let nst = st>>= S.filter (m/=)
         wrs <- runLayout (wksp {S.stack = nst}) sr
         return ((m, mr) : fst wrs, snd wrs

This allows the master pane to be Above the tabbed windows instead of at the Left. So I recompiled xmonad-contrib-darcs with this and installed it.
Then I imported these to xmonad.hs

import XMonad.Actions.PerWorkspaceKeys
import XMonad.Actions.DwmPromote
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.Named
import XMonad.Layout.Master
import XMonad.Layout.Tabbed

And in the "layouts" section I have this for the master-tabbed layout:

myTwoM = named "=" (toggleLayouts (lessBorders (OnlyFloat) (noBorders (mastered 0.01 0.6 $ tabbedAlways shrinkText myTabTheme)))
                   (lessBorders (OnlyFloat) (noBorders (mastered 0.01 0.4 (mastered 0.01 0.5 $ (tabbedAlways shrinkText myTabTheme)))))

So this toggles between "one master above everything else tabbed" and "one master above second master above everything else tabbed". The relevant keys are:

     , ((modMask .|. shiftMask,     xK_m         ), bindOn [("1", dwmpromote), ("", windows W.swapMaster)])
     , ((modMask,                   xK_Tab       ), bindOn [("1", rotSlavesDown), ("", rotAllDown)])
     , ((modMask .|. shiftMask,     xK_Tab       ), bindOn [("1", rotSlavesUp), ("", rotAllUp)])
     , ((modMask,                   xK_n         ), bindOn [("1", rotSlavesDown), ("", windows W.focusDown)])
     , ((modMask,                   xK_p         ), bindOn [("1", rotSlavesUp), ("", windows W.focusUp)])
     , ((modMask .|. controlMask,   xK_n         ), bindOn [("1", rotAllUp), ("", windows W.swapDown)])
     , ((modMask .|. controlMask,   xK_p         ), bindOn [("1", rotAllDown), ("", windows W.swapUp)])
     , ((modMask,                   xK_space     ), bindOn [("1", sendMessage ToggleLayout), ("", sendMessage NextLayout)])
     , ((modMask .|. shiftMask,     xK_space     ), bindOn [("1", withFocused $ windows . W.sink), ("", setLayout $ XMonad.layoutHook conf)])

So the space bar would toggle between
th_2010_11_22-215543.png th_2010_11_22-215547.png
This may not be what you want but gives you some ideas? hmm You could also use XMonad.Layout.Combo to combine layouts. .e.g. TwoPane with Tabbed, etc. I think the ultimate behavior you're wanting is found in a couple window managers. The one that comes to mind is Ion3 which is what I used to use. Here's a snapshot of when I used Ion3 (a tabbed window manager):
th_ionmouse01.png

Some ideas, anyway!

Offline

#3 2010-11-23 03:37:20

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Using XMonad to tab windows (or alternatives?)

I'm probably missing something here, but both jumaji and urxvt have native tabbing. I'm also a Xmonad user, but I find 'tabbed' to be far too much work to use.

Last edited by skottish (2010-11-23 03:37:41)

Offline

#4 2010-12-18 21:29:56

Thinkpol
Member
From: Seattle
Registered: 2010-09-10
Posts: 31
Website

Re: Using XMonad to tab windows (or alternatives?)

I switched to XMonad.Layout.TabBarDecoration instead of the Tabbed module as TabBarDecoration performance is better.

See TabBarDecoration Terminal Example

Other TabBarDecoration samples. Note that I'm using a combo view that allows me to have a single master pane on the left and the right pane with multiple tabs, independent of the master pane.

Regarding browser tabs: the native performance of FF/Chromium tabs is much better than, say, 50 tabs in any of the various XMonad tab modules. I did try using jumanji and uzbl with native XMonad tabs (both tabbed and tabbardecoration) and anything past a dozen tabs was sluggish.

That said, I'm happier using FF (with pentadactyl) or Chromium in combination with XMonad tabs. Example here.

Last edited by Thinkpol (2010-12-18 21:34:29)


new arch*.org acct: altercation

Offline

Board footer

Powered by FluxBB