Auto Tangle, Whitespace Fixes, & Xmobar Config Changes

- Auto tangle xmonad & xmobar config
- Replace ` with ~ for code formatted text
- Put code example inside an example block
- Change workspaces back to default numbers
- Fix leading whitespace in org document
- Initial xmobar config changes
This commit is contained in:
Sravan Balaji
2021-05-08 14:26:32 -04:00
parent a62d95b590
commit 93cca1d4f2
3 changed files with 64 additions and 63 deletions

View File

@@ -1,12 +1,13 @@
#+title: Personal Xmonad Configuration #+title: Personal Xmonad Configuration with Xmobar
#+author: Sravan Balaji #+author: Sravan Balaji
#+PROPERTY: header-args:haskell :tangle ./xmonad.hs #+PROPERTY: header-args:haskell :tangle ./xmonad.hs
#+auto_tangle: t
* Welcome * Welcome
My personal configuration of Xmonad, written as an [[https://orgmode.org][Org Mode]] document. My personal configuration of Xmonad, written as an [[https://orgmode.org][Org Mode]] document.
Run the block below with `C-c C-c` to tangle code blocks to config file. Run the block below with ~C-c C-c~ to tangle code blocks to config file.
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(org-mode-restart) (org-mode-restart)
@@ -85,10 +86,12 @@ of this list.
A tagging example: A tagging example:
> workspaces = ["web", "irc", "code" ] ++ map show [4..9] #+begin_example
workspaces = ["web", "irc", "code" ] ++ map show [4..9]
#+end_example
#+begin_src haskell #+begin_src haskell
myWorkspaces = ["\f868\2081", "2", "3", "4", "5", "6", "7", "8", "9"] myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
#+end_src #+end_src
* Keybindings * Keybindings
@@ -108,7 +111,6 @@ is mod1Mask ("left alt"). You may also consider using mod3Mask
#+begin_src haskell #+begin_src haskell
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal -- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
@@ -183,29 +185,25 @@ is mod1Mask ("left alt"). You may also consider using mod3Mask
] ]
++ ++
--
-- mod-[1..9], Switch to workspace N -- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N -- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i) [((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++ ++
--
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
--
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
#+end_src #+end_src
** Mouse Bindings ** Mouse Bindings
Mouse bindings: default actions bound to mouse events Mouse bindings: default actions bound to mouse events
#+begin_src haskell #+begin_src haskell
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
-- mod-button1, Set the window to floating mode and move by dragging -- mod-button1, Set the window to floating mode and move by dragging
@@ -221,7 +219,7 @@ Mouse bindings: default actions bound to mouse events
-- you may also bind events to the mouse scroll wheel (button4 and button5) -- you may also bind events to the mouse scroll wheel (button4 and button5)
] ]
#+end_src #+end_src
* Layouts * Layouts
@@ -234,7 +232,7 @@ The available layouts. Note that each layout is separated by |||,
which denotes layout choice. which denotes layout choice.
*Example With Xmobar* *Example With Xmobar*
#+begin_src haskell :tangle no #+begin_example
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full) myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
where where
-- default tiling algorithm partitions the screen into two panes -- default tiling algorithm partitions the screen into two panes
@@ -248,9 +246,9 @@ which denotes layout choice.
-- Percent of screen to increment by when resizing panes -- Percent of screen to increment by when resizing panes
delta = 3/100 delta = 3/100
#+end_src #+end_example
#+begin_src haskell #+begin_src haskell
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full) myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
where where
-- default tiling algorithm partitions the screen into two panes -- default tiling algorithm partitions the screen into two panes
@@ -264,7 +262,7 @@ which denotes layout choice.
-- Percent of screen to increment by when resizing panes -- Percent of screen to increment by when resizing panes
delta = 3/100 delta = 3/100
#+end_src #+end_src
* Window Rules * Window Rules
@@ -440,14 +438,18 @@ Finally, a copy of the default bindings in simple textual tabular format.
* Xmobar * Xmobar
#+begin_src haskell :tangle ./xmobar.config #+begin_src haskell :tangle ./xmobar.config
Config { font = "xft:FiraCode Nerd Font Mono:pixelsize=12:antialias=true:hinting=true" Config { font = "xft:FiraCode Nerd Font Mono:weight=bold:pixelsize=12:antialias=true:hinting=true"
, bgColor = "black" , bgColor = "black"
, fgColor = "grey" , fgColor = "white"
, position = Top , position = Top
, lowerOnStart = True -- , lowerOnStart = True
, commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000 -- , hideOnStart = False
-- , allDesktop = True
-- , persistent = True
, commands = [ Run Weather "KARB" ["-t","<station>: <tempF>F","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
, Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "wlp0s20f3" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10 , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10 , Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10 , Run Swap [] 10
@@ -456,6 +458,6 @@ Finally, a copy of the default bindings in simple textual tabular format.
] ]
, sepChar = "%" , sepChar = "%"
, alignSep = "}{" , alignSep = "}{"
, template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% }{ <fc=#ee9a00>%date%</fc>| %EGPF% | %uname%" , template = "%cpu% | %memory% * %swap% | %wlp0s20f3% }{ <fc=#ee9a00>%date%</fc>| %KARB% | %uname%"
} }
#+end_src #+end_src

View File

@@ -1,11 +1,15 @@
Config { font = "xft:FiraCode Nerd Font Mono:pixelsize=12:antialias=true:hinting=true" Config { font = "xft:FiraCode Nerd Font Mono:weight=bold:pixelsize=12:antialias=true:hinting=true"
, bgColor = "black" , bgColor = "black"
, fgColor = "grey" , fgColor = "white"
, position = Top , position = Top
, lowerOnStart = True -- , lowerOnStart = True
, commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000 -- , hideOnStart = False
-- , allDesktop = True
-- , persistent = True
, commands = [ Run Weather "KARB" ["-t","<station>: <tempF>F","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
, Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "wlp0s20f3" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10 , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10 , Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10 , Run Swap [] 10
@@ -14,5 +18,5 @@ Config { font = "xft:FiraCode Nerd Font Mono:pixelsize=12:antialias=true:hinting
] ]
, sepChar = "%" , sepChar = "%"
, alignSep = "}{" , alignSep = "}{"
, template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% }{ <fc=#ee9a00>%date%</fc>| %EGPF% | %uname%" , template = "%cpu% | %memory% * %swap% | %wlp0s20f3% }{ <fc=#ee9a00>%date%</fc>| %KARB% | %uname%"
} }

View File

@@ -26,12 +26,11 @@ myBorderWidth = 2
myNormalBorderColor = "#4D4D4D" myNormalBorderColor = "#4D4D4D"
myFocusedBorderColor = "#BD93F9" myFocusedBorderColor = "#BD93F9"
myWorkspaces = ["\f868\2081", "2", "3", "4", "5", "6", "7", "8", "9"] myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
myModMask = mod4Mask myModMask = mod4Mask
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal -- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
@@ -106,19 +105,15 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
] ]
++ ++
--
-- mod-[1..9], Switch to workspace N -- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N -- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i) [((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++ ++
--
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
--
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]