"xmonad.hs"

  
import XMonad
import XMonad.Layout.Spacing
import XMonad.Util.SpawnOnce
import Data.Monoid
import System.Exit
import XMonad.Layout.Gaps
import XMonad.Layout.Grid
import qualified XMonad.StackSet as W
import XMonad.Layout.NoBorders
import qualified Data.Map        as M

--
myTerminal      = "alacritty"

myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True

myClickJustFocuses :: Bool
myClickJustFocuses = False

--
myBorderWidth   = 1

--
myModMask       = mod4Mask

myWorkspaces    = ["1","2","3","4","5","6","7","8","9"]

--
myNormalBorderColor  = "#aaaaaa"
myFocusedBorderColor = "#5f27cd"

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $

    -- launch a terminal
    [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)

    -- launch dmenu
    , ((modm,               xK_p     ), spawn "dmenu_run")
    , ((modm,               xK_f     ), spawn "pcmanfm")
    , ((modm,               xK_s     ), spawn "setxkbmap se")
    , ((modm,               xK_u     ), spawn "setxkbmap us")
    , ((modm,               xK_x     ), spawn "flameshot gui")
    , ((modm,               xK_a     ), spawn "google-chrome-unstable")
    , ((modm,               xK_v     ), spawn "tor-browser")

    -- launch gmrun
    , ((modm .|. shiftMask, xK_p     ), spawn "gmrun")

    -- close focused window
    , ((modm,               xK_c     ), 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,               xK_Return), 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)))

    -- Toggle the status bar gap
    -- Use this binding with avoidStruts from Hooks.ManageDocks.
    -- See also the statusBar function from Hooks.DynamicLog.
    --
    -- , ((modm              , xK_b     ), sendMessage ToggleStruts)

    -- Quit xmonad
    , ((modm .|. shiftMask, xK_o     ), io (exitWith ExitSuccess))

    -- Restart xmonad
    , ((modm              , xK_o     ), spawn "xmonad --recompile; xmonad --restart")

    -- Run xmessage with a summary of the default keybindings (useful for beginners)
    , ((modm .|. shiftMask, xK_slash ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
    ]
    ++

    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++

    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_q, xK_w, xK_e] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

--
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $

    [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
                                       >> windows W.shiftMaster))

    , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))


    , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
                                       >> windows W.shiftMaster))
    ]

--
myLayout = tiled ||| Mirror tiled ||| Full
  where

     tiled   =  smartSpacing 3 $ Tall nmaster delta ratio

     nmaster = 1

     ratio   = 1/2

     delta   = 3/100

--
myManageHook = composeAll
    [ className =? "MPlayer"        --> doFloat
    , className =? "Gimp"           --> doFloat
    , resource  =? "desktop_window" --> doIgnore
    , resource  =? "kdesktop"       --> doIgnore ]

--
myEventHook = mempty


myLogHook = return ()


myStartupHook = do
  spawnOnce "nitrogen --restore &"
  spawnOnce "picom &"

--
main = xmonad defaults

--
defaults = def {
      -- simple stuff
        terminal           = myTerminal,
        focusFollowsMouse  = myFocusFollowsMouse,
        clickJustFocuses   = myClickJustFocuses,
        borderWidth        = myBorderWidth,
        modMask            = myModMask,
        workspaces         = myWorkspaces,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,

      -- key bindings
        keys               = myKeys,
        mouseBindings      = myMouseBindings,

      -- hooks, layouts
        layoutHook         = myLayout,
        manageHook         = myManageHook,
        handleEventHook    = myEventHook,
        logHook            = myLogHook,
        startupHook        = myStartupHook
    }


"init.vim"

  
syntax on
set cmdheight=2
set updatetime=300
set relativenumber
set number
set listchars+=space:ยท
set list
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
inoremap jk 
imap  0i
imap  $i
imap  :make
call plug#begin('~/.vim/plugged')
  Plug 'sheerun/vim-polyglot'
  Plug 'vim-airline/vim-airline'
    Plug 'ycm-core/YouCompleteMe'
  Plug 'morhetz/gruvbox'
    Plug 'preservim/nerdtree'
call plug#end()
let mapleader = " "
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE
let g:netrw_liststyle = 4
let g:netrw_banner = 0
let g:netrw_winsize = 20
nnoremap h :vertical resize +5
nnoremap l :vertical resize -5
nnoremap  :tabn
nnoremap  :tabp
nnoremap t :tabnew
nnoremap f :NERDTreeToggle
let g:airline_left_sep='>'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#show_close_button = 0