Created
October 28, 2021 17:57
-
-
Save JoshuaJakowlew/4bbb5ce3a38ec4bf5874e55505838eae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import XMonad | |
import XMonad.Util.EZConfig (mkKeymap) | |
import XMonad.Util.Ungrab (unGrab) | |
import XMonad.Util.EZConfig (mkKeymap) | |
import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen) | |
import XMonad.Hooks.ManageDocks (avoidStruts) | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M | |
import XMonad.Operations (windows) | |
import XMonad.Util.SpawnOnce (spawnOnce) | |
import XMonad.Layout.ThreeColumns | |
import XMonad.Layout.Grid | |
import XMonad.Layout.CenteredMaster | |
import XMonad.Layout.IfMax | |
import XMonad.Layout.Maximize | |
import XMonad.Layout.Minimize | |
import XMonad.Layout.NoBorders | |
import XMonad.Actions.Minimize | |
import XMonad.Actions.Submap (submap) | |
import XMonad.Actions.Navigation2D | |
import XMonad.Actions.Search -- Unused, find a usage | |
import XMonad.Actions.MouseGestures -- Unused, find a usage | |
import XMonad.Prompt | |
import XMonad.Prompt.Input -- Unused, find a usage | |
import XMonad.Prompt.Shell | |
import XMonad.Prompt.FuzzyMatch (fuzzyMatch, fuzzySort) | |
main :: IO () | |
main = xmonad $ ewmhFullscreen $ ewmh $ withNavigation2DConfig def $ myConfig | |
myConfig = def | |
{ terminal = "alacritty" | |
, modMask = mod4Mask | |
, workspaces = myWorkspaces | |
, borderWidth = 2 | |
, normalBorderColor = "#928374" | |
, focusedBorderColor = "#b16286" | |
, keys = \c -> mkKeymap c (myKeymap c) | |
, startupHook = myStartupHook | |
, layoutHook = myLayoutHook | |
} | |
myXPConfig = def | |
{ searchPredicate = fuzzyMatch | |
, sorter = fuzzySort | |
} | |
myWorkspaces = ["\63083", "\63288", "\63306", "\61723", "\63107", "\63601", "\63391", "\61713", "\61884"] | |
myKeymap = \c | |
-> basicKeys c | |
++ popupKeys | |
++ windowsFocus | |
++ windowsSwap | |
++ screenshotKeys | |
++ audioKeys | |
++ workspaceKeys | |
basicKeys = \c -> | |
[ ("M-S-<Return>", spawn $ terminal c) | |
, ("M-S-c", kill) | |
, ("M-t", withFocused $ windows . W.sink) | |
, ("M-l", sendMessage NextLayout) | |
--, ("M-<Up>", withFocused (sendMessage . maximizeRestore)) | |
--, ("M-<Down>", withFocused minimizeWindow) | |
--, ("M-S-<Down>", withLastMinimized maximizeWindowAndFocus) | |
--, ("M-x", shellPrompt myXPConfig) | |
] | |
windowsFocus = | |
[ ("M1-<Tab>" , windows W.focusDown) | |
, ("M1-S-<Tab>", windows W.focusUp) | |
, ("M1-<Left>" , windowGo L True) | |
, ("M1-<Down>" , windowGo D True) | |
, ("M1-<Up>" , windowGo U True) | |
, ("M1-<Right>" , windowGo R True) | |
] | |
windowsSwap = | |
[ ("M-<Tab>", windows W.swapDown) | |
, ("M-S-<Tab>", windows W.swapUp) | |
, ("M1-S-<Left>" , windowSwap L True) | |
, ("M1-S-<Down>" , windowSwap D True) | |
, ("M1-S-<Up>" , windowSwap U True) | |
, ("M1-S-<Right>" , windowSwap R True) | |
] | |
popupKeys = | |
[ ("M-o", spawn launcher) | |
, ("M-s", spawn leftPopup) | |
, ("M-S-s", spawn ewwclose) | |
, ("M-v", spawn clipboard) | |
, ("M-b", spawn "exec ~/bin/bartoggle") | |
] | |
where | |
launcher = "rofi -no-lazy-grab -show drun -modi run,drun,window -theme $HOME/.config/rofi/launcher/style" | |
ewwclose = "exec ~/bin/eww close-all" | |
leftPopup = "exec ~/bin/eww open-many weather_side time_side smol_calendar player_side sys_side sliders_side" | |
clipboard = "rofi -modi \"clipboard:greenclip print\" -show clipboard -run-command '{cmd}' -theme ~/.config/rofi/launcher/style.rasi" | |
screenshotKeys = | |
[ ("<Print>" , spawn $ fullscreen ++ toClip) | |
, ("S-<Print>" , spawn $ select ++ toClip) | |
, ("C-<Print>" , spawn $ active ++ toClip) | |
, ("M-<Print>" , spawn $ fullscreen ++ toFile) | |
, ("M-S-<Print>", spawn $ select ++ toFile) | |
, ("M-C-<Print>", spawn $ active ++ toFile) | |
] | |
where | |
fullscreen = "maim -u" | |
select = "maim -su" | |
active = "maim -u -i $(xdotool getactivewindow)" | |
toClip = " | xclip -selection clipboard -t image/png" | |
toFile = " ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png" | |
audioKeys = | |
[ ("<XF86AudioPlay>", spawn "playerctl play-pause" ) | |
, ("<XF86AudioPrev>", spawn "playerctl previous" ) | |
, ("<XF86AudioNext>", spawn "playerctl next" ) | |
] | |
workspaceKeys = | |
[ ("M-" ++ m ++ k, windows $ f i) | |
| (i, k) <- zip myWorkspaces keys | |
, (f, m) <- [(W.greedyView, ""), (W.shift, "S-")] | |
] | |
where | |
keys = map (:[]) ['1'..'9'] | |
myStartupHook = do | |
spawnOnce "exec ~/bin/bartoggle" | |
spawnOnce "exec ~/bin/eww daemon" | |
spawnOnce "xsetroot -cursor_name left_ptr" | |
spawnOnce "feh --bg-scale ~/.xmonad/bg-gruvbox.png" | |
spawnOnce "picom" | |
spawnOnce "greenclip daemon" | |
spawnOnce "python ~/bin/jakowlew/getweather.py" | |
spawnOnce "sleep 3 && setxkbmap -model pc105 -layout us,ru -option grp:win_space_toggle" | |
spawnOnce "/etc/X11/xinit/xinitrc.d/50-systemd-user.sh ~/.xinitrc" | |
spawnOnce "exec redshift -l 54.790311:32.050366" | |
myLayoutHook = smartBorders $ minimize $ maximizeWithPadding 0 $ avoidStruts (tiled ||| threeColMid ||| centerMaster Grid ||| Grid ||| Full) | |
where | |
tiled = Tall nmaster delta ratio | |
threeColMid = ThreeColMid nmaster delta ratio | |
nmaster = 1 | |
ratio = 1 / 2 | |
delta = 5 / 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment