Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import XMonad
- import System.Exit
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat, isDialog)
- import XMonad.Hooks.InsertPosition
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Layout.Spacing
- import XMonad.Layout.NoBorders (smartBorders)
- import XMonad.Util.SpawnOnce
- import XMonad.Util.Run (spawnPipe)
- import System.IO
- myWorkspaces :: [String]
- myWorkspaces = clickable
- $ [" \xf120 ", " \xf07c ", " \xf269 ", " \xf121 ", " \xf9d2 ", " \xf1d7 ", " \xfc45 ", " \xf813 ", " \xf001 "]
- where
- clickable l = [ "<action=xdotool key super+" ++ show n ++ ">" ++ ws ++ "</action>" |
- (i,ws) <- zip [1..9] l,
- let n = i ]
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- -- KEY CODES FOR MULTIMEDIA BUTTONS
- -- nvim /usr/include/X11/XF86keysym.h
- -- launch a terminal
- [ ((modm, xK_Return ), spawn $ XMonad.terminal conf)
- -- launch librewolf
- , ((0, 0x1008FF18 ), spawn "librewolf")
- -- launch Kodi
- , ((0, 0x1008FF32 ), spawn "kodi")
- -- launch Buku
- , ((0, 0x1008FF2F ), spawn "buku-rofi")
- -- up volume
- , ((0, 0x1008FF13 ), spawn "pulseaudio-change-volume-up.sh")
- -- down volume
- , ((0, 0x1008FF11 ), spawn "pulseaudio-change-volume-down.sh")
- -- launch rofi
- , ((modm, xK_F2 ), spawn "rofi -modi drun -show drun -show-icons")
- -- Screenshots
- , ((0, xK_Print ), spawn "TakeScreenshot-Full.sh")
- , ((modm, xK_Print ), spawn "TakeScreenshot-Grab.sh")
- -- close focused window
- , ((modm, xK_q ), kill)
- -- Rotate through the available layout algorithms
- , ((modm, xK_space ), sendMessage NextLayout)
- -- Reset the layouts on the current workspace to default
- , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
- -- Resize viewed windows to the correct size
- , ((modm, xK_n ), refresh)
- -- Move focus to the next window
- , ((modm, xK_Tab ), windows W.focusDown)
- -- Move focus to the next window
- , ((modm, xK_j ), windows W.focusDown)
- -- Move focus to the previous window
- , ((modm, xK_k ), windows W.focusUp )
- -- Move focus to the master window
- , ((modm, xK_m ), windows W.focusMaster )
- -- Swap the focused window and the master window
- , ((modm .|. shiftMask, xK_s ), windows W.swapMaster)
- -- Swap the focused window with the next window
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown )
- -- Swap the focused window with the previous window
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp )
- -- Shrink the master area
- , ((modm, xK_h ), sendMessage Shrink)
- -- Expand the master area
- , ((modm, xK_l ), sendMessage Expand)
- -- Push window back into tiling
- , ((modm, xK_t ), withFocused $ windows . W.sink)
- -- Increment the number of windows in the master area
- , ((modm , xK_comma ), sendMessage (IncMasterN 1))
- -- Deincrement the number of windows in the master area
- , ((modm , xK_period), sendMessage (IncMasterN (-1)))
- -- Quit xmonad
- , ((modm .|. controlMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- -- Reboot
- , ((modm .|. controlMask .|. shiftMask, xK_r ), spawn "loginctl reboot")
- -- Shutdown
- , ((modm .|. controlMask .|. shiftMask, xK_p ), spawn "loginctl poweroff")
- -- Restart xmonad
- , ((modm .|. controlMask .|. shiftMask, xK_F5 ), spawn "killall -9 xmobar; killall -9 trayer-srg; xmonad --recompile; xmonad --restart")
- ]
- ++
- --
- -- mod-[1..9], Switch to workspace N
- -- mod-shift-[1..9], Move client to workspace N
- --
- [((m .|. modm, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
- ------------------------------------------------------------------------
- -- Mouse bindings: default actions bound to mouse events
- --
- myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
- -- mod-button1, Set the window to floating mode and move by dragging
- [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
- >> windows W.shiftMaster))
- -- mod-button2, Raise the window to the top of the stack
- , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
- -- mod-button3, Set the window to floating mode and resize by dragging
- , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
- myLayout = tiled ||| Mirror tiled
- where
- tiled = Tall nmaster delta ratio
- nmaster = 1 -- Default number of windows in the master pane
- ratio = 1/2 -- Default proportion of screen occupied by master pane
- delta = 3/100 -- Percent of screen to increment by when resizing panes
- myLayoutHook = avoidStruts
- $ smartBorders
- $ spacingRaw False (Border 4 4 4 4) True (Border 4 4 4 4) True
- myLayout
- myManageHook = composeAll
- [ isFullscreen --> doFullFloat
- , insertPosition End Newer
- , className =? "mpv" --> doCenterFloat
- , className =? "feh" --> doCenterFloat
- , className =? "Sxiv" --> doCenterFloat
- , className =? "KeePassXC" --> doCenterFloat
- , className =? "Galculator" --> doCenterFloat
- , className =? "Gcolor2" --> doCenterFloat
- , className =? "LibreWolf" --> doShift ( myWorkspaces !! 2 )
- , className =? "Steam" --> doShift ( myWorkspaces !! 4 )
- , className =? "QtCreator" --> doShift ( myWorkspaces !! 3 )
- , className =? "Kodi" --> doShift ( myWorkspaces !! 7 )
- , isDialog --> doCenterFloat
- ]
- myStartupHook = do
- spawnOnce "/home/themainman/.xmonad/autostart.sh"
- spawn "xmobar -x 0 /home/themainman/.config/xmobar/xmobarrc-bottom"
- spawn "trayer-srg --edge bottom --align right --SetDockType true --SetPartialStrut True --expand true --height 25 --width 5 --transparent true --alpha 0 --tint 0x282c34 &"
- -- main :: IO ()
- -- main = xmonad
- -- . docks
- -- . ewmhFullscreen
- -- . ewmh
- -- =<< statusBar "xmobar -x 0 ~/.config/xmobar/xmobarrc-top" myXmobarPP def myConfig
- main = do
- xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc-top"
- xmonad $ docks $ ewmhFullscreen $ ewmh def
- --myConfig = def
- { modMask = mod4Mask
- , layoutHook = myLayoutHook
- , manageHook = myManageHook
- --, handleEventHook = handleEventHook def <+> XMonad.Hooks.EwmhDesktops.fullscreenEventHook
- , startupHook = myStartupHook
- , logHook = dynamicLogWithPP $ myXmobarPP { ppOutput = \x -> hPutStrLn xmproc0 x }
- , terminal = "st"
- , focusFollowsMouse = True
- , clickJustFocuses = False
- , borderWidth = 2
- , workspaces = myWorkspaces
- , normalBorderColor = "#282c34"
- , focusedBorderColor = "#46d9ff"
- , keys = myKeys
- , mouseBindings = myMouseBindings
- }
- myXmobarPP :: PP
- myXmobarPP = def
- { ppSep = magenta " • "
- , ppTitle = wrap (white "[") (white "]") . magenta . shorten 80
- , ppTitleSanitize = xmobarStrip
- , ppCurrent = wrap (blue "[") (blue "]")
- , ppHidden = yellow . wrap " " ""
- , ppHiddenNoWindows = lowWhite . wrap " " ""
- , ppUrgent = red . wrap (yellow "!") (yellow "!")
- }
- where
- blue, lowWhite, magenta, red, white, yellow :: String -> String
- magenta = xmobarColor "#ff79c6" ""
- blue = xmobarColor "#bd93f9" ""
- white = xmobarColor "#f8f8f2" ""
- yellow = xmobarColor "#f1fa8c" ""
- red = xmobarColor "#ff5555" ""
- lowWhite = xmobarColor "#696969" ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement