Advertisement
ttqqmat

Untitled

Sep 11th, 2023
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import XMonad
  2.  
  3. import XMonad.Hooks.DynamicLog
  4. import XMonad.Hooks.EwmhDesktops
  5. import XMonad.Hooks.InsertPosition
  6. import XMonad.Hooks.ManageDocks
  7. import XMonad.Hooks.ManageHelpers
  8. import XMonad.Util.Run
  9.  
  10. import XMonad.Hooks.DynamicLog
  11. import XMonad.Hooks.StatusBar
  12. import XMonad.Hooks.StatusBar.PP
  13.  
  14. import XMonad.Actions.SpawnOn
  15. import XMonad.Util.EZConfig
  16. import XMonad.Util.Loggers
  17. import XMonad.Util.SpawnOnce
  18. import XMonad.Util.Ungrab
  19.  
  20. import XMonad.Layout.Magnifier
  21. import XMonad.Layout.Spacing
  22. import XMonad.Layout.ThreeColumns
  23.  
  24. import qualified Codec.Binary.UTF8.String as UTF8
  25. import XMonad.ManageHook -- scratchpad
  26. import XMonad.Util.NamedScratchpad -- scratchpad
  27. import qualified XMonad.StackSet as W -- does something important i'm sure.
  28. main :: IO ()
  29. main = do
  30.         xmproc <- spawnPipe "~/.config/.fehbg"
  31.         xmproc <- spawnPipe "~/.config/.screenlayout.sh"
  32.         xmproc <- spawnPipe "xmodmap ~/.config/.Xmodmap"
  33.     xmproc <- spawnPipe "pipewire"
  34.         xmonad $ ewmhFullscreen $ ewmh $ withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey $ docks $ myConfig
  35.  
  36. myConfig =
  37.         def
  38.                 { modMask = mod4Mask
  39.                 , layoutHook = spacingWithEdge 5 $ myLayout
  40.                 , manageHook = myManageHook -- insertPosition End Newer
  41.                 , startupHook = startup
  42.                 , terminal = "kitty"
  43.                 , workspaces = myWorkspaces
  44.                 , borderWidth = 0
  45.                 }
  46.                 `additionalKeysP` [ ("M-s", spawn "flameshot gui") -- Take a screenshot of an area
  47.                           , ("M-S-s", spawn "flameshot full") -- Take a screenshot of all screens
  48.                                   , ("M-x", kill) -- Close windows
  49.                                   , ("M-t", spawn "kitty")
  50.                                   -- , ("M-r", spawn "rofi -show drun -show-icons")
  51.                                   , ("M-r", spawn ".config/rofi/launchers/type-7/launcher.sh") -- Run launcher
  52.                                   , ("M-p", spawn ".config/rofi/powermenu/type-5/powermenu.sh") -- Run power menu
  53.                   , ("M-m", namedScratchpadAction myScratchPads "neofetch") -- xmoake scratchpad
  54.                                   , ("M-n", namedScratchpadAction myScratchPads "htop") -- scratchpad
  55.                                   , ("M-o", namedScratchpadAction myScratchPads "alsamixer") -- scratchpad
  56.                                   , ("M-<F4>", namedScratchpadAction myScratchPads "iirc")  --scratchpad
  57.                                   ]
  58.  
  59. myManageHook :: ManageHook
  60. myManageHook =
  61.         composeAll
  62.                 [ className =? "confirm" --> doFloat
  63.                 , className =? "file_progress" --> doFloat
  64.                 , className =? "dialog" --> doFloat
  65.                 , className =? "download" --> doFloat
  66.                 , className =? "error" --> doFloat
  67.                 , className =? "notification" --> doFloat
  68.                 , className =? "splash" --> doFloat
  69.                 , className =? "Emacs" --> doShift "1:emacs"
  70.                 , className =? "kitty" --> doShift "2:code"
  71.                 , className =? "TelegramDesktop" --> doShift "3:msg"
  72.                 , className =? "nheko" --> doShift "3:msg"
  73.                 , className =? "Firefox" --> doShift "4:web"
  74.                 , className =? "Chromium" --> doShift "4:web"
  75.                 -- , className =? "Alacritty" --> doFloat
  76.                 , className =? "Thunar" --> doShift "6:file"
  77.                 , className =? "Opera" --> doShift "7:web"
  78.                 ]
  79.         <+> namedScratchpadManageHook myScratchPads
  80.  
  81. myScratchPads = [
  82. -- run htop in term, top half, perfect fit.
  83.     NS "htop" "alacritty -e htop" (title =? "htop")
  84.         (customFloating $ W.RationalRect (0/1) (0/1) (1/1) (1/2)) ,
  85. -- run alsamixer in term, bottom half of screen space around edge.
  86.     NS "alsamixer" "alacritty " (title =? "alsamixer")
  87.         (customFloating $ W.RationalRect (1/100) (49/100) (98/100) (1/2)) ,
  88. -- drop-down terminal    like yeahconsole/tilda/guake/yakuake
  89.     NS "neofetch" "alacritty -e neofetch" (title =? "neofetch")
  90.         (customFloating $ W.RationalRect (0/1) (0/1) (1/1) (1/2)) ,
  91. -- pop-in terminal chat    like above, but one for chat.    
  92.     NS "chat" "iirc" (title =? "chat")
  93.         (customFloating $ W.RationalRect (0/1) (0/1) (1/2) (1/2))
  94.     ] -- where role = stringProperty "WM_WINDOW_ROLE"
  95.  
  96. startup = do
  97.         spawnOnce  "picom"
  98.         spawnOnce  "/usr/libexec/xfce-polkit"
  99.  
  100.  
  101. myWorkspaces = ["1:emacs", "2:code", "3:msg", "4:web", "5:term", "6:file", "7:web", "8:tools", "9:any"]
  102.  
  103. -- myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
  104. myLayout = avoidStruts (tiled ||| Full)
  105.     where
  106.         tiled = Tall nmaster delta ratio
  107.         nmaster = 1
  108.         ratio = 1 / 2
  109.         delta = 3 / 100
  110.  
  111. myXmobarPP :: PP
  112. myXmobarPP =
  113.         def
  114.                 { ppSep = magenta " • "
  115.                 , ppTitleSanitize = xmobarStrip
  116.                 , ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2
  117.                 , ppHidden = white . wrap " " ""
  118.                 , ppHiddenNoWindows = lowWhite . wrap " " ""
  119.                 , ppUrgent = red . wrap (yellow "!") (yellow "!")
  120.                 , ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
  121.                 , ppExtras = [logTitles formatFocused formatUnfocused]
  122.                 }
  123.     where
  124.         formatFocused = wrap (white "[") (white "]") . magenta . ppWindow
  125.         formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow
  126.  
  127.         ppWindow :: String -> String
  128.         ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
  129.  
  130.         blue, lowWhite, magenta, red, white, yellow :: String -> String
  131.         magenta = xmobarColor "#ff79c6" ""
  132.         blue = xmobarColor "#bd93f9" ""
  133.         white = xmobarColor "#f8f8f2" ""
  134.         yellow = xmobarColor "#f1fa8c" ""
  135.         red = xmobarColor "#ff5555" ""
  136.         lowWhite = xmobarColor "#888888" ""
  137.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement