l xmonad: cleanup
This commit is contained in:
parent
b4850cfd1d
commit
c3db1f794a
@ -3,6 +3,7 @@ pkgs.writeHaskell "xmonad-lass" {
|
|||||||
executables.xmonad = {
|
executables.xmonad = {
|
||||||
extra-depends = [
|
extra-depends = [
|
||||||
"containers"
|
"containers"
|
||||||
|
"extra"
|
||||||
"unix"
|
"unix"
|
||||||
"X11"
|
"X11"
|
||||||
"xmonad"
|
"xmonad"
|
||||||
@ -20,17 +21,15 @@ module Main where
|
|||||||
import XMonad
|
import XMonad
|
||||||
|
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import Control.Exception
|
import Control.Monad.Extra (whenJustM)
|
||||||
import Data.List (isInfixOf)
|
import Data.List (isInfixOf)
|
||||||
import System.Environment (getArgs, withArgs)
|
import System.Environment (getArgs, lookupEnv)
|
||||||
import System.IO (hPutStrLn, stderr)
|
|
||||||
import System.Posix.Process (executeFile)
|
import System.Posix.Process (executeFile)
|
||||||
import XMonad.Actions.CopyWindow (copy, kill1)
|
import XMonad.Actions.CopyWindow (copy, kill1)
|
||||||
import XMonad.Actions.CycleWS (toggleWS)
|
import XMonad.Actions.CycleWS (toggleWS)
|
||||||
import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace)
|
import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace)
|
||||||
import XMonad.Actions.DynamicWorkspaces (withWorkspace)
|
import XMonad.Actions.DynamicWorkspaces (withWorkspace)
|
||||||
import XMonad.Actions.GridSelect (GSConfig(..), gridselectWorkspace, navNSearch)
|
import XMonad.Actions.GridSelect (GSConfig(..), gridselectWorkspace, navNSearch)
|
||||||
import XMonad.Actions.UpdatePointer (updatePointer)
|
|
||||||
import XMonad.Hooks.FloatNext (floatNext)
|
import XMonad.Hooks.FloatNext (floatNext)
|
||||||
import XMonad.Hooks.FloatNext (floatNextHook)
|
import XMonad.Hooks.FloatNext (floatNextHook)
|
||||||
import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts))
|
import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts))
|
||||||
@ -48,28 +47,30 @@ import XMonad.Layout.SimpleFloat (simpleFloat)
|
|||||||
import XMonad.Stockholm.Shutdown
|
import XMonad.Stockholm.Shutdown
|
||||||
|
|
||||||
myTerm :: FilePath
|
myTerm :: FilePath
|
||||||
myTerm = "${pkgs.rxvt_unicode}/bin/urxvtc"
|
myTerm = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc"
|
||||||
|
|
||||||
myFont :: String
|
myFont :: String
|
||||||
myFont = "${config.lass.fonts.regular}"
|
myFont = "${config.lass.fonts.regular}"
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = getArgs >>= \case
|
main = getArgs >>= \case
|
||||||
["--shutdown"] -> sendShutdownEvent
|
["--shutdown"] -> sendShutdownEvent
|
||||||
_ -> mainNoArgs
|
_ -> main'
|
||||||
|
|
||||||
mainNoArgs :: IO ()
|
main' :: IO ()
|
||||||
mainNoArgs = do
|
main' = do
|
||||||
xmonad'
|
xmonad
|
||||||
$ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ")
|
$ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ")
|
||||||
$ def
|
$ def
|
||||||
{ terminal = myTerm
|
{ terminal = myTerm
|
||||||
, modMask = mod4Mask
|
, modMask = mod4Mask
|
||||||
, layoutHook = smartBorders $ myLayoutHook
|
, layoutHook = smartBorders $ myLayoutHook
|
||||||
, logHook = updatePointer (0.25, 0.25) (0.25, 0.25)
|
|
||||||
, manageHook = placeHook (smart (1,0)) <+> floatNextHook
|
, manageHook = placeHook (smart (1,0)) <+> floatNextHook
|
||||||
|
, startupHook =
|
||||||
|
whenJustM (liftIO (lookupEnv "XMONAD_STARTUP_HOOK"))
|
||||||
|
(\path -> forkFile path [] Nothing)
|
||||||
, normalBorderColor = "#1c1c1c"
|
, normalBorderColor = "#1c1c1c"
|
||||||
, focusedBorderColor = "#f000b0"
|
, focusedBorderColor = "#ff0000"
|
||||||
, handleEventHook = handleShutdownEvent
|
, handleEventHook = handleShutdownEvent
|
||||||
, workspaces = [ "dashboard", "sys", "wp" ]
|
, workspaces = [ "dashboard", "sys", "wp" ]
|
||||||
} `additionalKeysP` myKeyMap
|
} `additionalKeysP` myKeyMap
|
||||||
@ -78,22 +79,6 @@ myLayoutHook = defLayout
|
|||||||
where
|
where
|
||||||
defLayout = minimize $ ((avoidStruts $ Tall 1 (3/100) (1/2) ||| Full ||| Mirror (Tall 1 (3/100) (1/2))) ||| FixedColumn 2 80 80 1) ||| simpleFloat
|
defLayout = minimize $ ((avoidStruts $ Tall 1 (3/100) (1/2) ||| Full ||| Mirror (Tall 1 (3/100) (1/2))) ||| FixedColumn 2 80 80 1) ||| simpleFloat
|
||||||
|
|
||||||
|
|
||||||
xmonad' :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO ()
|
|
||||||
xmonad' conf = do
|
|
||||||
let path = "/tmp/xmonad.state"
|
|
||||||
try (readFile path) >>= \case
|
|
||||||
Right content -> do
|
|
||||||
hPutStrLn stderr ("resuming from " ++ path)
|
|
||||||
withArgs ("--resume" : lines content) (xmonad conf)
|
|
||||||
Left e -> do
|
|
||||||
hPutStrLn stderr (displaySomeException e)
|
|
||||||
xmonad conf
|
|
||||||
|
|
||||||
displaySomeException :: SomeException -> String
|
|
||||||
displaySomeException = displayException
|
|
||||||
|
|
||||||
|
|
||||||
myKeyMap :: [([Char], X ())]
|
myKeyMap :: [([Char], X ())]
|
||||||
myKeyMap =
|
myKeyMap =
|
||||||
[ ("M4-<F11>", spawn "${config.lass.screenlock.command}")
|
[ ("M4-<F11>", spawn "${config.lass.screenlock.command}")
|
||||||
|
Loading…
Reference in New Issue
Block a user