~/.xsession

#!/bin/bash

xset dpms force on
xset s off
xset -b

# caps lock ist doof
xmodmap -e "remove Lock = Caps_Lock"
xmodmap -e "keysym Caps_Lock = Control_L"
xmodmap -e "add Control = Control_L"

fbsetbg -l

exec xmonad

~/.xmonad/xmonad.hs

import XMonad
import XMonad.Operations

import Graphics.X11.Xlib

import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Data.Ratio ((%))

import XMonad.ManageHook
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageDocks
import XMonad.Layout
import XMonad.Layout.ResizableTile
import XMonad.Layout.IM
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Tabbed
import XMonad.Layout.NoBorders
import XMonad.Layout.WindowNavigation
import XMonad.Layout.Reflect

import XMonad.Prompt
import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import XMonad.Prompt.RunOrRaise

import XMonad.Actions.CycleWS

import XMonad.Util.Run
import XMonad.Util.Scratchpad

import XMonad.Actions.NoBorders
import XMonad.Actions.DynamicWorkspaces 
import XMonad.Actions.MouseResize
import XMonad.Layout.WindowArranger

import System.IO
import System ( getArgs )

main = do
    xmobar <- spawnPipe ( "/home/fpletz/bin/xmobar" )
    xmonad $ myConfig xmobar

myConfig h = withUrgencyHook NoUrgencyHook $ defaultConfig
       { borderWidth        = 1
       , terminal           = "x-terminal-emulator"
       , workspaces         = ["1:shells", "2:code", "3:www", "4:chat", "5:mail" ]
                              ++ map show [6 .. 8 :: Int]
                              ++ ["9:music"]
       , modMask            = mod4Mask
       , normalBorderColor  = "#dddddd"
       , focusedBorderColor = "#0033ff"
       , focusFollowsMouse  = True
       , logHook            = dynamicLogWithPP $ myPP h
       , keys = \c -> mykeys c `M.union` keys defaultConfig c
       , manageHook         = manageDocks <+> manageHook defaultConfig <+> myManageHook
       , layoutHook         = avoidStruts $ smartBorders $ mouseResize $
			      windowArrange
                              $ onWorkspace "4:chat" (IM (1%6) (Title "Gajim")) 
                              $ onWorkspaces ["3:www", "5:mail", "9:music"] Full
                              $ myLayouts
       }
  where
    mykeys (XConfig {modMask = modm}) = M.fromList $
      [
      -- rotate workspaces
      ((modm .|. controlMask, xK_Right), nextWS)
      , ((modm .|. controlMask, xK_Left), prevWS)

      -- switch to previous workspace
      , ((modm, xK_z), toggleWS)

      , ((modm .|. shiftMask, xK_b),   withFocused toggleBorder)

      -- lock the screen with xtrlock
      , ((modm .|. shiftMask, xK_l), spawn "xtrlock")

      -- some programs to start with keybindings.
      , ((modm .|. shiftMask, xK_f), spawn "firefox")
      , ((modm .|. shiftMask, xK_g), spawn "/home/fpletz/gajim/launch.sh")
      , ((modm .|. shiftMask, xK_m), spawn "claws-mail")

      -- prompts
      , ((modm .|. shiftMask, xK_s), sshPrompt defaultXPConfig)
      , ((modm .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
      , ((modm, xK_x), runOrRaisePrompt defaultXPConfig)
      --, ((modm, xK_s), scratchpadSpawnAction defaultConfig)

      -- nasty workaround to JVM bug where the window would appear all gray, this tricks the JVM into thinking we are "Looking Glass 3D" so it behaves correctly
      , ((modm .|. controlMask .|. shiftMask, xK_z), setWMName "LG3D")

      -- window navigation keybindings.
      , ((modm,               xK_Right), sendMessage $ Go R)
      , ((modm,               xK_Left ), sendMessage $ Go L)
      , ((modm,               xK_Up   ), sendMessage $ Go U)
      , ((modm,               xK_Down ), sendMessage $ Go D)
      , ((modm .|. shiftMask, xK_Right), sendMessage $ Swap R)
      , ((modm .|. shiftMask, xK_Left ), sendMessage $ Swap L)
      , ((modm .|. shiftMask, xK_Up   ), sendMessage $ Swap U)
      , ((modm .|. shiftMask, xK_Down ), sendMessage $ Swap D)
     ]

myManageHook :: ManageHook
myManageHook = composeAll (
        [  className   =? "Gajim.py"           --> doF(W.shift "4:chat")
         , className   =? "Iceweasel"          --> doF(W.shift "3:www")
         , className   =? "Quodlibet"          --> doF(W.shift "9:music")
         , className   =? "Claws-mail"         --> doF(W.shift "5:mail")
         --, className   =? "Gimp-2.6"           --> doNewWS "gimp"
        ]
        ++ [ className =? c --> doFloat | c <- myFloats ])
  where myFloats = ["Volume", "XClock", "Network-admin", "frame", "MPlayer", "Pinentry-gtk-2", "Wicd-client.py"]
        
myPP h = defaultPP { ppCurrent         = wrap "<fc=#ff0000>" "</fc>"
                    , ppVisible         = wrap "<fc=#a00000>" "</fc>"
                    , ppHiddenNoWindows = \wsId -> if (':' `elem` wsId) then wsId else ""
                    , ppSep             = " | "
		    , ppUrgent		= \wsId -> wsId ++ "*"
                    , ppTitle           = take 0
                    , ppOrder           = reverse
                    , ppOutput          = hPutStrLn h }

myLayouts = tiled ||| Mirror tiled ||| Full
        where 
             -- default tiling algorithm partitions the screen into two panes
             tiled   = Tall nmaster delta ratio
         
             -- The default number of windows in the master pane
             nmaster = 1
         
             -- Default proportion of screen occupied by master pane
             ratio   = 1/2
	     --ratio   = toRational (2/(1+sqrt(5)::Double)) -- golden
         
             -- Percent of screen to increment by when resizing panes
             delta   = 3/100

~/.xmobarrc

Config { font = "-*-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "white"
       , position = TopW L 100
       , lowerOnStart = True
       , commands = [ Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 20
                    , Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 20
                    , Run Cpu ["-t","<total>","-L","5","-H","50","--normal","green","--high","red"] 20
                    , Run Memory ["-t","<usedratio>%"] 30
                    , Run Swap ["-t","<usedratio>"] 30
    		    , Run Date "%a %b %_d %H:%M" "date" 10
                    , Run Battery ["-L","25","-H","70","--low","red","--high","green","-t","<left>"] 30
                    , Run Com "essid" [] "essid" 10
                    , Run StdinReader
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%cpu% | %memory% * %swap% | %eth0% - %wlan0% %essid% }{ %StdinReader% | <fc=#ee9a00>%date%</fc> | %battery%"
       }

~/.Xdefaults

Urxvt*depth: 32
URxvt*background: rgba:0000/0000/0000/9999
URxvt*foreground: white
URxvt*scrollBar: False
URxvt*font: -*-fixed-*-*-*-*-12-*-*-*-*-*-*-*
URxvt*saveLines: 2000
URxvt*urlLauncher: x-www-browser
  • dotfiles/fpletz.txt
  • Last modified: 2021/04/18 12:35
  • (external edit)