mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-18 19:10:21 -07:00
All hints are applied in one single commit, as a commit per hint would result in 80+ separate commits—tihs is really just too much noise. Related: https://github.com/xmonad/xmonad-contrib/issues/537
80 lines
2.5 KiB
Haskell
Executable File
80 lines
2.5 KiB
Haskell
Executable File
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-orphans #-}
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
---------------------------------------------------------------------
|
|
-- |
|
|
-- A mostly striped down configuration that demonstrates spawnOnOnce
|
|
--
|
|
---------------------------------------------------------------------
|
|
import System.IO
|
|
|
|
import XMonad
|
|
|
|
import XMonad.Hooks.DynamicLog
|
|
import XMonad.Hooks.ManageDocks
|
|
import XMonad.Hooks.ManageHelpers
|
|
import XMonad.Hooks.UrgencyHook
|
|
import XMonad.Hooks.FadeInactive
|
|
|
|
import XMonad.Layout.NoBorders
|
|
import XMonad.Layout.ResizableTile
|
|
import XMonad.Layout.Mosaic
|
|
|
|
import XMonad.Util.Run
|
|
import XMonad.Util.Cursor
|
|
import XMonad.Util.NamedScratchpad
|
|
import XMonad.Util.Scratchpad
|
|
import XMonad.Util.SpawnOnce
|
|
|
|
import XMonad.Actions.CopyWindow
|
|
import XMonad.Actions.SpawnOn
|
|
|
|
import qualified XMonad.StackSet as W
|
|
|
|
main = do
|
|
myStatusBarPipe <- spawnPipe "xmobar"
|
|
xmonad $ docks $ withUrgencyHook NoUrgencyHook $ def
|
|
{ terminal = "xterm"
|
|
, workspaces = myWorkspaces
|
|
, layoutHook = myLayoutHook
|
|
, manageHook = myManageHook <+> manageSpawn
|
|
, startupHook = myStartupHook
|
|
, logHook = myLogHook myStatusBarPipe
|
|
, focusFollowsMouse = False
|
|
}
|
|
|
|
myManageHook = composeOne
|
|
[ isDialog -?> doFloat
|
|
, className =? "trayer" -?> doIgnore
|
|
, className =? "Skype" -?> doShift "chat"
|
|
, appName =? "libreoffice" -?> doShift "office"
|
|
, return True -?> doF W.swapDown
|
|
]
|
|
|
|
myWorkspaces = [ "web", "emacs", "chat", "vm", "office", "media", "xterms", "8", "9", "0"]
|
|
|
|
myStartupHook = do
|
|
setDefaultCursor xC_left_ptr
|
|
spawnOnOnce "emacs" "emacs"
|
|
spawnNOnOnce 4 "xterms" "xterm"
|
|
|
|
myLayoutHook = smartBorders $ avoidStruts standardLayouts
|
|
where standardLayouts = tiled ||| mosaic 2 [3,2] ||| Mirror tiled ||| Full
|
|
tiled = ResizableTall nmaster delta ratio []
|
|
nmaster = 1
|
|
delta = 0.03
|
|
ratio = 0.6
|
|
|
|
myLogHook p = do
|
|
copies <- wsContainingCopies
|
|
let check ws | ws == "NSP" = "" -- Hide the scratchpad workspace
|
|
| ws `elem` copies = xmobarColor "red" "black" ws -- Workspaces with copied windows are red on black
|
|
| otherwise = ws
|
|
dynamicLogWithPP $ xmobarPP { ppHidden = check
|
|
, ppOutput = hPutStrLn p
|
|
, ppUrgent = xmobarColor "white" "red"
|
|
, ppTitle = xmobarColor "green" "" . shorten 180
|
|
}
|
|
fadeInactiveLogHook 0.6
|
|
|