xmonad_configuration/xmonad.hs
2025-09-05 22:26:47 +02:00

73 lines
2.3 KiB
Haskell

--
-- Configuration file for XMonad + MATE
--
-- Usage:
-- * Copy this file to ~/.xmonad/
-- * Run: $ xmonad --recompile
-- * Launch: $ xmonad --replace
-- [Optional] Create an autostart to command with "xmonad --replace"
--
-- Author: Arturo Fernandez <arturo at bsnux dot com>
-- Inspired by:
-- Spencer Janssen <spencerjanssen@gmail.com>
-- rfc <reuben.fletchercostin@gmail.com>
-- License: BSD
--
import XMonad
import XMonad.Config.Desktop
import XMonad.Util.Run (safeSpawn)
import qualified Data.Map as M
import qualified XMonad.StackSet as W
import System.Exit
import System.Environment (getEnvironment)
import XMonad.Util.EZConfig
myWorkspaces = ["1","2","3","4","5","6","7","8"]
mateConfig = desktopConfig
{ terminal = "mate-terminal"
, keys = mateKeys <+> keys desktopConfig
}
mateKeys (XConfig {modMask = modm}) = M.fromList $
[ ((modm, xK_p), mateRun)
, ((modm .|. shiftMask, xK_q), spawn "mate-session-save --kill") ]
mateRun :: X ()
mateRun = withDisplay $ \dpy -> do
rw <- asks theRoot
mate_panel <- getAtom "_MATE_PANEL_ACTION"
panel_run <- getAtom "_MATE_PANEL_ACTION_RUN_DIALOG"
io $ allocaXEvent $ \e -> do
setEventType e clientMessage
setClientMessageEvent e rw mate_panel 32 panel_run 0
sendEvent dpy rw False structureNotifyMask e
sync dpy False
main = do
xmonad $ mateConfig
{ modMask = mod4Mask
, borderWidth = 2
, workspaces = myWorkspaces
, focusedBorderColor = "#FF0000"
} `additionalKeysP` myKeys
myKeys = [ (("M4-f"), spawn "brave-bin")
,(("M4-S-q"), io exitSuccess)
,(("M4-q"), spawn "xmonad --recompile; xmonad --restart")
,(("M4-<Return>"), spawn "mate-terminal")
,(("M4-p"), spawn "dmenu_run")
,(("M4-z"), kill)
-- BINDING FOR MOVE WORKSPACE
,(("M4-<F1>"), windows $ W.greedyView "1")
,(("M4-<F2>"), windows $ W.greedyView "2")
,(("M4-<F3>"), windows $ W.greedyView "3")
,(("M4-<F4>"), windows $ W.greedyView "4")
,(("M4-<F5>"), windows $ W.greedyView "5")
,(("M4-<F6>"), windows $ W.greedyView "6")
,(("M4-<F7>"), windows $ W.greedyView "7")
,(("M4-<F8>"), windows $ W.greedyView "8")
]