XMonad with Salix

Other talk about Salix
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

XMonad with Salix

Post by mimosa »

Picking up the discussion from a recent thread on the qualities of Ratpoison ...

I've installed XMonad alongside Ratpoison. To launch the WM, I first copied the existing .xinitrc to ~/xinitrc.ratpoison, and created ~/xinitrc.xmonad (see xmonad.org for advice on this - also, you probably should install dmenu). Then I wrote two tiny launcher scripts, rat and monad:

Code: Select all

#!/bin/sh
#Ratpoison launcher
cp ./xinitrc.ratpoison .xinitrc
startx

Code: Select all

#!/bin/sh
#XMonad launcher
cp ./xinitrc.xmonad .xinitrc
startx
That way, startx will always launch whichever WM you were using last time. If you can't remember or want to swap, rat or monad do the job, as well as saving on typing. :mrgreen: This is probably not the correct way to do things, but it does work and means the standard ratpoison setup can be left in place with no need for a graphical launcher.

Note that before installing the Glasgow Haskell compiler (the first step) a symlink is needed to trick the build into accepting a newer library:

Code: Select all

# ln -s /usr/lib/libgmp.so.10 /usr/lib/libgmp.so.3
XMonad itself has a lot of other deps too.
Last edited by mimosa on 28. Jun 2012, 09:46, edited 1 time in total.
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: XMonad alongside Ratpoison

Post by Tim CowChip »

I have installed XMonad alongside MATE with the help of your temporary symlink for compiling ghc. I created a /usr/share/xsessions/xmonad.desktop file so it shows up in gdm. So far I'm liking it enough to wish for a XMonad version of Salix to be offered.

My ~/.xmonad/xmonad.hs:

Code: Select all

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Layout.IM
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.Grid
import XMonad.Prompt
import XMonad.Prompt.Man
import System.IO
 
myTerminal = "urxvt" --my preferred terminal
myWorkspaces = ["1","2","3","4","5","6","7","8","9"] --list of tag names
myManageHook = composeAll
    [ className =? "URxvt" --> doCenterFloat
      className =? "Conky" --> doCenterFloat
      className =? "Zenity" --> doCenterFloat
    ]
myLayoutHook = onWorkspace "4" gimp $ onWorkspace "1" terminalLayout $ onWorkspace "3" webLayout $ standardLayout --per workspace layouts
    where
        standardLayout = avoidStruts ( Mirror tall ||| tall ||| Grid ||| Full ) --layout to use on every other workspace
            where
                tall = Tall nmaster delta ratio --define tall layout sizes
                nmaster = 1 --number of windows in master pane
                ratio = 1/2 --ratio of master pane size
                delta = 2/100
 
        gimp =  avoidStruts $ --layout for gimp
                withIM (0.11) (Role "gimp-toolbox") $ --toolbox on side
                reflectHoriz $
                withIM (0.15) (Role "gimp-dock") Full --dock on side
        terminalLayout = avoidStruts $ Grid --layout for terminal windows
        webLayout = avoidStruts $ Mirror tall --layout for browser and terminal window
            where
                tall = Tall nmaster delta ratio --define tall layout sizes 
                nmaster = 1 --number of windows in master pane1
                ratio = 3/4 --ratio of master pane size 
                delta = 2/100
--xmobar config
myLogHook h = dynamicLogWithPP xmobarPP
            { ppHidden = xmobarColor "grey" "" --tag color
            , ppOutput = hPutStrLn h           --tag list and window title
            , ppTitle = xmobarColor "green" "" --window title color
            }
myStatusBar = "xmobar" --define first xmobar
myStartupHook :: X ()
myStartupHook = do
            spawn "~/.xmonad/startup.sh" --startup script
 
main = do 
    din <- spawnPipe myStatusBar
    xmonad $ defaultConfig
        { manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
        , layoutHook = myLayoutHook 
        , logHook = myLogHook din
        , startupHook = myStartupHook
        , terminal = myTerminal
        , workspaces = myWorkspaces
        , modMask = mod4Mask
        } `additionalKeys`
        [ ((mod4Mask, xK_f),    spawn "firefox") --start firefox
        , ((mod4Mask, xK_F11),  spawn "sudo /sbin/reboot") --reboot
        , ((mod4Mask, xK_F12),  spawn "sudo /sbin/shutdown -h now") --shutdown
        , ((mod4Mask, xK_p),    spawn "dmenu_run -nb black -nf white") --call dmenu
        , ((mod4Mask .|. shiftMask, xK_h), spawn "feh --scale ~/pictures/Xmbindings.png") --keymask dialog
        , ((mod4Mask, xK_F1),   manPrompt defaultXPConfig) --man prompt
        , ((0, xK_Print),       spawn "'scrot' -e 'mv $f ~/pictures/screenshots'") --take screenshot
        ---Media Keys
        , ((0, 0x1008ff13),     spawn "amixer -q set Master 2dB+") --raise sound
        , ((0, 0x1008ff11),     spawn "amixer -q set Master 1dB-") --lower sound
        , ((0, 0x1008ff12),     spawn "amixer -q set Master toggle") --mute sound
        , ((0, 0x1008ff2c),     spawn "eject") --eject cd
        ]
my ~/.xmobarrc:

Code: Select all

Config { font = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-u"
       , bgColor = "#000000"
       , fgColor = "#C9A34E"
       , position = Top 
       , lowerOnStart = True
       , commands = [ Run Network "eth0" ["-L", "8", "-H", "32", "-l", "#C9A34E", "-n", "#429942" ,"-h", "#A36666", "-t", "<dev>: <rx> : <tx>"] 10
                    , Run Cpu ["-L","3","-H","50","--normal","#429942","--high","#A36666"] 10
                    , Run Memory ["-t","Mem: <usedratio>%"] 10
    		    , Run Date "%a %b %_d %Y" "date" 10
                    , Run StdinReader
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = " %StdinReader% }{ %cpu% <fc=#429942>|</fc> %memory% <fc=#429942>|</fc> %eth0% <fc=#429942>|</fc> %date%"
       }
I tried adding the weather plugin to xmobar, but it didn't work.
ImageImage
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: XMonad alongside Ratpoison

Post by mimosa »

I couldn't get the weather to work properly either. Thanks for sharing those config files. Good luck with it!
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: XMonad alongside Ratpoison

Post by Tim CowChip »

I found some useful weather apps for minimal window managers at

http://opensource.hld.ca/trac.cgi/wiki/CurseTheWeather

and

http://crunchbanglinux.org/forums/topic ... ad/page/4/

also a useful automount method

http://www.monperrus.net/martin/automou ... and+pmount

maybe you could make this the "XMonad" thread.
ImageImage
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: XMonad alongside Ratpoison

Post by Shador »

Tim CowChip wrote: http://www.monperrus.net/martin/automou ... and+pmount

maybe you could make this the "XMonad" thread.
That udev rule sucks. Much better would be something like this (untested but likely to work):

Code: Select all

ACTION=="add",KERNEL=="sd*", ATTR{removable}=="1", RUN+="/usr/bin/pmount --sync --umask 000 %k"
ACTION=="remove", KERNEL=="sd*", ATTR{removable}=="1", RUN+="/usr/bin/pumount %k"
The difference being that I match all sd* devices (i.e. effectively I think all SUBSYSTEM=="block" with) and require them additionally to be removable. Even using ranges like KERNEL=="sd[b-z]*" would be a better solution. But nobody can guarantee you that sdb won't ever turn into a builtin device.

For reference: http://reactivated.net/writing_udev_rules.html
Image
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: XMonad alongside Ratpoison

Post by Tim CowChip »

Shador wrote: That udev rule sucks. Much better would be something like this (untested but likely to work):

Code: Select all

ACTION=="add",KERNEL=="sd*", ATTR{removable}=="1", RUN+="/usr/bin/pmount --sync --umask 000 %k"
ACTION=="remove", KERNEL=="sd*", ATTR{removable}=="1", RUN+="/usr/bin/pumount %k"
The difference being that I match all sd* devices (i.e. effectively I think all SUBSYSTEM=="block" with) and require them additionally to be removable. Even using ranges like KERNEL=="sd[b-z]*" would be a better solution. But nobody can guarantee you that sdb won't ever turn into a builtin device.

For reference: http://reactivated.net/writing_udev_rules.html

I tested your rule edit and it did not work for me. It would be nice to come up with a safer method for all to use without risking built in devices becoming inaccessible, but for now I'm going with sdb and sdc as removable devices. Only once in all the distros that I have installed was my builtin block device not sda. I think it was with openSUSE and I was able to rename the block device from sdb to sda.
ImageImage
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: XMonad alongside Ratpoison

Post by Tim CowChip »

Shador wrote:
Tim CowChip wrote: http://www.monperrus.net/martin/automou ... and+pmount

maybe you could make this the "XMonad" thread.
I didn't mean for http://www.monperrus.net/martin/automou ... and+pmount to be the "XMonad" thread, but for this thread to be the "XMonad" thread.
Maybe just remove the "alongside Ratpoison"
ImageImage
User avatar
deja69
Posts: 89
Joined: 23. Apr 2012, 00:20

Re: XMonad alongside Ratpoison

Post by deja69 »

JUST hASKell :D
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: XMonad alongside Ratpoison

Post by Tim CowChip »

deja69 wrote:JUST hASKell :D
Please stop trolling new posts and leaving inane comments.
ImageImage
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: XMonad alongside Ratpoison

Post by mimosa »

I ended up getting sucked in to Ratpoison during beta testing of the Salix edition (and how many distros have a version with *any* tiling WM?) Much as I liked XMonad (and would like to learn Haskell), I suppose Ratpoison is a good WM for a Slack-based distro to choose because it is so much in keeping with the KISS principle.

I also agree with something Gapan said about the actual tiling - Ratpoison's default is not to split the windows, and in most instances, I find that's what I want. You can use either WM either way (one window fullscreen or actually tiled) but in Ratpoison that's the default when opening a fresh one. In fact I rarely even use two. That ability to focus on what's inside the window rather than what's around it is one of the principal attractions for me.

However I bet XMonad could be made to work like that, too. First learn Haskell ;)
Post Reply