Skip to content

Commit

Permalink
fix(xmonad): update/refactor config
Browse files Browse the repository at this point in the history
  • Loading branch information
yurrriq committed Oct 31, 2023
1 parent a8cb5ce commit 5a72344
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 30 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.11.2
8.11.3
2 changes: 2 additions & 0 deletions config/xmonad/.envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
watch_file \
../flake.nix \
../flake.lock \
emacs.el \
package.yaml
use flake "$(git rev-parse --show-toplevel)#xmonad"
2 changes: 1 addition & 1 deletion config/xmonad/emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
(global-set-key (kbd "C-x C-k") 'kill-this-buffer)
(global-set-key (kbd "s-u") 'revert-buffer)

(set-face-attribute 'default nil :family "Iosevka Nerd Font" :height 110)
(set-face-attribute 'default nil :family "Iosevka Nerd Font Mono" :height 110)

(eval-when-compile
(require 'use-package))
Expand Down
2 changes: 1 addition & 1 deletion config/xmonad/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: my-xmonad
version: 0.1.0.0
version: 0.1.0.1
synopsis: My XMonad config
author: Eric Bailey
maintainer: [email protected]
Expand Down
61 changes: 34 additions & 27 deletions config/xmonad/xmonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,53 @@ import Data.List (intercalate)
import Data.Map (Map)
import qualified Data.Map as M
import Data.Maybe (catMaybes)
import XMonad hiding ((|||))
import XMonad.Actions.CycleWS (WSType (EmptyWS, NonEmptyWS), doTo, moveTo)
import XMonad.Actions.Navigation2D
import XMonad.Actions.RotSlaves
import XMonad.Actions.Warp
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad
import XMonad.Actions.CycleWS (WSType (Not), doTo, emptyWS, moveTo)
import XMonad.Actions.Navigation2D (navigation2DP, windowGo, windowSwap)
import XMonad.Actions.RotSlaves (rotSlavesDown, rotSlavesUp)
import XMonad.Actions.Warp (warpToWindow)
import XMonad.Hooks.DynamicLog (PP (..), shorten, statusBar, wrap, xmobarColor)
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageDocks
import XMonad.Layout.BinarySpacePartition
( AvoidStruts,
Direction1D (..),
Direction2D,
avoidStruts,
docks,
)
import XMonad.Hooks.StatusBar (defToggleStrutsKey)
import XMonad.Layout.BinarySpacePartition (emptyBSP)
import XMonad.Layout.Decoration (ModifiedLayout)
import XMonad.Layout.LayoutCombinators (JumpToLayout (..), (|||))
import XMonad.Layout.NoBorders
import XMonad.Layout.TwoPane
import XMonad.Layout.NoBorders (noBorders)
import XMonad.Layout.TwoPane (TwoPane (TwoPane))
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig
import XMonad.Util.EZConfig (mkKeymap)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Scratchpad
import XMonad.Util.WorkspaceCompare (getSortByIndex)
( NamedScratchpad (NS),
customFloating,
namedScratchpadAction,
scratchpadWorkspaceTag,
)
import XMonad.Util.Scratchpad (scratchpadManageHook)
import XMonad.Util.WorkspaceCompare (filterOutWs, getSortByIndex)

main :: IO ()
main = xmonad =<< myXmobar myConfig

myXmobar :: LayoutClass l Window => XConfig l -> IO (XConfig (ModifiedLayout AvoidStruts l))
myXmobar = statusBar "xmobar" myPP toggleStrutsKey

-- https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/src/XMonad.Hooks.DynamicLog.html#toggleStrutsKey
toggleStrutsKey :: XConfig t -> (KeyMask, KeySym)
toggleStrutsKey XConfig {modMask = modm} = (modm, xK_b)
myXmobar = statusBar "xmobar" myPP defToggleStrutsKey

myConfig =
navigation2DP
def
("<U>", "<L>", "<D>", "<R>")
[("M-", bringMouse windowGo), ("M-S-", windowSwap)]
False
. docks
$ ewmh
def
{ borderWidth = 0,
focusFollowsMouse = True,
handleEventHook = handleEventHook def <+> docksEventHook,
keys = myKeys,
layoutHook = myLayout,
-- TODO: namedScratchpadManageHook scratchpads,
Expand Down Expand Up @@ -87,7 +94,7 @@ myPP =
"BSP" -> "<fn=1>🐚</fn>"
layout -> layout,
ppSep = " ",
ppSort = (. namedScratchpadFilterOutWorkspace) <$> ppSort def,
ppSort = (. filterOutWs [scratchpadWorkspaceTag]) <$> ppSort def,
ppTitle = xmobarColor "#fdf6e3" "" . shorten 80,
ppUrgent = xmobarColor "#ff605a" ""
}
Expand Down Expand Up @@ -136,7 +143,7 @@ myKeys cfg =
("<Print>", spawn "flameshot gui"),
("M-S--", namedScratchpadAction scratchpads "emacs"),
("M--", namedScratchpadAction scratchpads "kitty"),
("M-<Esc>", getXMonadDataDir >>= spawn . wrap "i3lock --raw 3840x2400:rgb --image " "/skyrim.raw"),
("M-<Esc>", asks (cfgDir . directories) >>= spawn . wrap "i3lock --raw 3840x2400:rgb --image " "/skyrim.raw"),
("M-<Space>", spawn "dunstctl close"),
("M-M1-<Space>", spawn "dunstctl close-all"),
("M-M1-b", spawn "rofi-bluetooth"),
Expand All @@ -163,11 +170,11 @@ myKeys cfg =
("M1-<Space>", spawn "rofi -modi combi,window -show combi -combi-modi run,drun"),
("C-M-M1-x", spawn "xmonad --restart"),
("C-M-M1-c", spawn "systemctl --user restart picom.service"),
("C-M-<Left>", moveTo Prev NonEmptyWS),
("C-M-<Right>", moveTo Next NonEmptyWS),
("C-M-M1-<Left>", shiftAndMoveTo Prev EmptyWS),
("C-M-M1-<Right>", shiftAndMoveTo Next EmptyWS),
("C-M-M1-f", shiftAndMoveTo Next EmptyWS)
("C-M-<Left>", moveTo Prev (Not emptyWS)),
("C-M-<Right>", moveTo Next (Not emptyWS)),
("C-M-M1-<Left>", shiftAndMoveTo Prev emptyWS),
("C-M-M1-<Right>", shiftAndMoveTo Next emptyWS),
("C-M-M1-f", shiftAndMoveTo Next emptyWS)
]
++ [ ( intercalate "-" (catMaybes [Just "M", maybeShift, Just key]),
windows (f workspace)
Expand Down
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@
haskellPackages.pointfree
pre-commit
rnix-lsp
xorg.libX11
xorg.libXScrnSaver
xorg.libXext
xorg.libXft
xorg.libXinerama
xorg.libXrandr
] ++ myXMonad.env.nativeBuildInputs;
};
};
Expand Down
6 changes: 6 additions & 0 deletions src/flake.nw
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ xmonad =
haskellPackages.pointfree
pre-commit
rnix-lsp
xorg.libX11
xorg.libXScrnSaver
xorg.libXext
xorg.libXft
xorg.libXinerama
xorg.libXrandr
] ++ myXMonad.env.nativeBuildInputs;
};
@
Expand Down

0 comments on commit 5a72344

Please sign in to comment.