Advertisement
Guest User

Untitled

a guest
Oct 15th, 2022
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import XMonad
  3. import Data.Monoid
  4. import System.Exit
  5. import XMonad.Util.SpawnOnce
  6. import XMonad.Layout.Fullscreen
  7. import Graphics.X11.ExtraTypes.XF86
  8. import XMonad.Layout.ToggleLayouts (ToggleLayout(..), toggleLayouts)
  9. import XMonad.Layout.NoBorders (noBorders, smartBorders)
  10. import XMonad.Layout.ResizableTile (ResizableTall(..), MirrorResize(..))
  11. import XMonad.Layout.Grid
  12. import XMonad.Layout.ResizableThreeColumns
  13. import XMonad.Layout.Tabbed
  14. import XMonad.Util.EZConfig
  15.  
  16. import qualified XMonad.StackSet as W
  17. import qualified Data.Map        as M
  18.  
  19. -- The preferred terminal program, which is used in a binding below and by
  20. -- certain contrib modules.
  21. --
  22. myTerminal      = "terminator"
  23.  
  24. -- Whether focus follows the mouse pointer.
  25. myFocusFollowsMouse :: Bool
  26. myFocusFollowsMouse = False
  27.  
  28. -- Whether clicking on a window to focus also passes the click to the window
  29. myClickJustFocuses :: Bool
  30. myClickJustFocuses = False
  31.  
  32. myBorderWidth   = 4
  33.  
  34. myModMask       = mod4Mask
  35.  
  36. myWorkspaces    = ["1","2","3","4","5","6","7","8","9"]
  37.  
  38. myNormalBorderColor  = "#2c2638"
  39. myFocusedBorderColor = "#ea7599"
  40.  
  41. ------------------------------------------------------------------------
  42. -- Key bindings. Add, modify or remove key bindings here.
  43. --
  44. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  45.  
  46.     -- launch a terminal
  47.     [ ((modm, xK_z), spawn $ XMonad.terminal conf)
  48.  
  49.     -- Swap the focused window and the master window
  50.     , ((modm,               xK_Return), windows W.swapMaster)
  51.  
  52.     -- Move focus to the next window
  53.     , ((modm,               xK_Tab   ), windows W.focusDown)
  54.  
  55.     -- launch emacs
  56.     , ((modm, xK_d), spawn "emacsclient -c -a 'emacs'")
  57.  
  58.     -- launch code
  59.     , ((modm, xK_c), spawn "code")
  60.  
  61.     -- launch code
  62.     , ((modm, xK_o), spawn "terminator -e glances")
  63.  
  64.     -- launch krusader
  65.     , ((modm, xK_k), spawn "spacefm")
  66.  
  67.     -- launch librewolf
  68.     , ((modm, xK_l), spawn "librewolf")
  69.  
  70.     -- launch kotatogram
  71.  
  72.     , ((modm, xK_g), spawn "kotatogram-desktop")
  73.  
  74.     -- launch flameshot
  75.     , ((0, xK_Print), spawn "flameshot gui")
  76.  
  77.     -- launch colorpicker
  78.     , ((0 .|. shiftMask, xK_Print), spawn "slickpicker")
  79.  
  80.     -- launch dmenu
  81.     , ((modm, xK_p), spawn "synapse")
  82.  
  83.     -- close focused window
  84.     , ((modm, xK_x), kill)
  85.  
  86.     -- Mute volume.
  87.     , ((0, 0x1008FF12), spawn "amixer -q set Master toggle")
  88.  
  89.     -- Decrease volume.
  90.     , ((0, 0x1008FF11), spawn "amixer -q set Master 5%-")
  91.  
  92.     -- Increase volume.
  93.     , ((0, 0x1008FF13), spawn "amixer -q set Master 5%+")
  94.  
  95.     -- Increase brightness
  96.     , ((0, xF86XK_MonBrightnessDown), spawn "lux -s 10%")
  97.  
  98.     -- Decrease brightness
  99.     , ((0, xF86XK_MonBrightnessUp), spawn "lux -a 10%")
  100.  
  101.     -- Toggle fullscreen
  102.     , ((modm, xK_f), sendMessage (Toggle "Full"))
  103.  
  104.     , ((modm, xK_Left), sendMessage Shrink)
  105.     , ((modm, xK_Right), sendMessage Expand)
  106.     , ((modm, xK_Down), sendMessage MirrorShrink)
  107.     , ((modm, xK_Up), sendMessage MirrorExpand)
  108.  
  109.  
  110.     -- Rotate through the available layout algorithms
  111.     , ((modm,               xK_space ), sendMessage NextLayout)
  112.  
  113.     -- Push window back into tiling
  114.     , ((modm, xK_t), withFocused $ windows . W.sink)
  115.  
  116.     -- Increment the number of windows in the master area
  117.     , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
  118.  
  119.     -- Deincrement the number of windows in the master area
  120.     , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
  121.  
  122.     -- Toggle the status bar gap
  123.     -- Use this binding with avoidStruts from Hooks.ManageDocks.
  124.     -- See also the statusBar function from Hooks.DynamicLog.
  125.     --
  126.     -- , ((modm              , xK_b     ), sendMessage ToggleStruts)
  127.  
  128.     -- Quit xmonad
  129.     , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
  130.  
  131.     -- Restart xmonad
  132.     , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")
  133.  
  134.     ]
  135.     ++
  136.  
  137.     --
  138.     -- mod-[1..9], Switch to workspace N
  139.     -- mod-shift-[1..9], Move client to workspace N
  140.     --
  141.     [((m .|. modm, k), windows $ f i)
  142.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  143.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  144.     ++
  145.  
  146.     --
  147.     -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  148.     -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  149.     --
  150.     [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  151.         | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  152.         , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  153.  
  154.  
  155. ------------------------------------------------------------------------
  156. -- Mouse bindings: default actions bound to mouse events
  157. --
  158. myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
  159.  
  160.     -- mod-button1, Set the window to floating mode and move by dragging
  161.     [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
  162.                                        >> windows W.shiftMaster))
  163.  
  164.     -- mod-button2, Raise the window to the top of the stack
  165.     , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
  166.  
  167.     -- mod-button3, Set the window to floating mode and resize by dragging
  168.     , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
  169.                                        >> windows W.shiftMaster))
  170.  
  171.     -- you may also bind events to the mouse scroll wheel (button4 and button5)
  172.     ]
  173. ------------------------------------------------------------------------
  174. -- Layouts:
  175.  
  176. -- You can specify and transform your layouts by modifying these values.
  177. -- If you change layout bindings be sure to use 'mod-shift-space' after
  178. -- restarting (with 'mod-q') to reset your layout state to the new
  179. -- defaults, as xmonad preserves your old layout settings by default.
  180. --
  181. -- The available layouts.  Note that each layout is separated by |||,
  182. -- which denotes layout choice.
  183. --
  184.  
  185. myTabConfig = def {
  186.   fontName = "Monospace"
  187. }
  188.  
  189. myLayout = toggleLayouts (noBorders Full) (myTiled ||| Grid ||| myMulticol ||| myTabs)
  190.   where
  191.     myTiled = ResizableTall 1 (5/100) (3/5) []
  192.     myMulticol = ResizableThreeCol 1 (3/100) (1/2) []
  193.     myTabs = noBorders (tabbed shrinkText myTabConfig)
  194. ------------------------------------------------------------------------
  195. -- Window rules:
  196.  
  197. -- Execute arbitrary actions and WindowSet manipulations when managing
  198. -- a new window. You can use this to, for example, always float a
  199. -- particular program, or have a client always appear on a particular
  200. -- workspace.
  201. --
  202. -- To find the property name associated with a program, use
  203. -- > xprop | grep WM_CLASS
  204. -- and click on the client you're interested in.
  205. --
  206. -- To match on the WM_NAME, you can use 'title' in the same way that
  207. -- 'className' and 'resource' are used below.
  208. --
  209. myManageHook = composeAll
  210.     [ className =? "MPlayer"        --> doFloat
  211.     , className =? "slickpicker"    --> doFloat
  212.     , resource  =? "desktop_window" --> doIgnore
  213.     , resource  =? "kdesktop"       --> doIgnore ]
  214.  
  215. ------------------------------------------------------------------------
  216. -- Event handling
  217.  
  218. -- * EwmhDesktops users should change this to ewmhDesktopsEventHook
  219. --
  220. -- Defines a custom handler function for X Events. The function should
  221. -- return (All True) if the default handler is to be run afterwards. To
  222. -- combine event hooks use mappend or mconcat from Data.Monoid.
  223. --
  224. myEventHook = mempty
  225.  
  226. ------------------------------------------------------------------------
  227. -- Status bars and logging
  228.  
  229. -- Perform an arbitrary action on each internal state change or X event.
  230. -- See the 'XMonad.Hooks.DynamicLog' extension for examples.
  231. --
  232. myLogHook = return ()
  233.  
  234. ------------------------------------------------------------------------
  235. -- Startup hook
  236.  
  237. -- Perform an arbitrary action each time xmonad starts or is restarted
  238. -- with mod-q.  Used by, e.g., XMonad.Layout.PerWorkspace to initialize
  239. -- per-workspace layout choices.
  240. --
  241. -- By default, do nothing.
  242. myStartupHook = do
  243.     spawnOnce "slock &"
  244.     spawnOnce "xautolock -time 60 -locker slock &"
  245.     spawnOnce "compton &"
  246.     spawnOnce "setxkbmap -layout 'us,ru' -option 'grp:alt_shift_toggle'"
  247.     spawnOnce "/usr/bin/emacs --daemon"
  248.     spawnOnce "nvidia-settings --load-config-only"
  249.     spawnOnce "yakuake &"
  250. ------------------------------------------------------------------------
  251. -- Now run xmonad with all the defaults we set up.
  252.  
  253. -- Run xmonad with the settings you specify. No need to modify this.
  254. --
  255. main = xmonad defaults
  256.  
  257. -- A structure containing your configuration settings, overriding
  258. -- fields in the default config. Any you don't override, will
  259. -- use the defaults defined in xmonad/XMonad/Config.hs
  260. --
  261. -- No need to modify this.
  262. --
  263. defaults = def {
  264.       -- simple stuff
  265.         terminal           = myTerminal,
  266.         focusFollowsMouse  = myFocusFollowsMouse,
  267.         clickJustFocuses   = myClickJustFocuses,
  268.         borderWidth        = myBorderWidth,
  269.         modMask            = myModMask,
  270.         workspaces         = myWorkspaces,
  271.         normalBorderColor  = myNormalBorderColor,
  272.         focusedBorderColor = myFocusedBorderColor,
  273.  
  274.       -- key bindings
  275.         keys               = myKeys,
  276.         mouseBindings      = myMouseBindings,
  277.  
  278.       -- hooks, layouts
  279.         layoutHook         = myLayout,
  280.         manageHook         = myManageHook,
  281.         handleEventHook    = myEventHook,
  282.         logHook            = myLogHook,
  283.         startupHook        = myStartupHook
  284.     }
  285.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement