Xmobar Config & Gitignore

- Add gitignore
- Add xmobar config to README.org and setup tangle
- Add imports for xmobar
- Add rofi clipboard keybinding
- Change Xmonad to XMonad on imports
- Add startup hook with nitrogen and picom
- Change xmobar config filepath
- Remove example xmobar source code blocks
This commit is contained in:
Sravan Balaji
2021-05-08 10:42:16 -04:00
parent 0dd425a4e4
commit a62d95b590
4 changed files with 88 additions and 23 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
*~
*-linux
*.errors
*.hi
*.o

View File

@@ -22,6 +22,14 @@
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- needed for `spawnPipe`
import XMonad.Util.Run
-- needed for managing dock type programs like xmobar
import XMonad.Hooks.ManageDocks
import XMonad.Util.SpawnOnce
#+end_src
* Terminal
@@ -80,7 +88,7 @@ A tagging example:
> workspaces = ["web", "irc", "code" ] ++ map show [4..9]
#+begin_src haskell
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
myWorkspaces = ["\f868\2081", "2", "3", "4", "5", "6", "7", "8", "9"]
#+end_src
* Keybindings
@@ -104,9 +112,12 @@ is mod1Mask ("left alt"). You may also consider using mod3Mask
-- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- launch rofi
-- launch rofi drun
, ((modm, xK_p ), spawn "rofi -show drun")
-- launch rofi clipboard
, ((modm, xK_c ), spawn "rofi -show clipboard")
-- close focused window
, ((modm .|. shiftMask, xK_c ), kill)
@@ -240,7 +251,7 @@ which denotes layout choice.
#+end_src
#+begin_src haskell
myLayout = tiled ||| Mirror tiled ||| Full
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
where
-- default tiling algorithm partitions the screen into two panes
tiled = Tall nmaster delta ratio
@@ -308,7 +319,7 @@ See the 'XMonad.Hooks.DynamicLog' extension for examples.
*Example*
#+begin_src haskell :tangle no
import Xmonad.Util.SpawnOnce
import XMonad.Util.SpawnOnce
myStartupHook = do
spawnOnce "nitrogen --restore &"
@@ -318,7 +329,9 @@ See the 'XMonad.Hooks.DynamicLog' extension for examples.
By default, do nothing.
#+begin_src haskell
myStartupHook = return ()
myStartupHook = do
spawnOnce "nitrogen --restore &"
spawnOnce "picom &"
#+end_src
** Run
@@ -327,25 +340,14 @@ Now run xmonad with all the defaults we set up.
Run xmonad with the settings you specify. No need to modify this.
*Example With Xmobar*
#+begin_src haskell :tangle no
-- needed for `spawnPipe`
import XMonad.Util.Run
-- needed for managing dock type programs like xmobar
import XMonad.Hooks.ManageDocks
#+begin_src haskell
main = do
-- `xmobar -x 0` launches the bar on monitor 0
xmproc <- spawnPipe "xmobar -x 0 /home/sravan/.config/xmobar/xmobar.config"
xmproc <- spawnPipe "xmobar -x 0 /home/sravan/.xmonad/xmobar.config"
-- launches xmobar as a dock
xmonad $ docks defaults
#+end_src
#+begin_src haskell
main = xmonad defaults
#+end_src
** Configuration Settings
A structure containing your configuration settings, overriding
@@ -434,3 +436,26 @@ Finally, a copy of the default bindings in simple textual tabular format.
"mod-button2 Raise the window to the top of the stack",
"mod-button3 Set the window to floating mode and resize by dragging"]
#+end_src
* Xmobar
#+begin_src haskell :tangle ./xmobar.config
Config { font = "xft:FiraCode Nerd Font Mono:pixelsize=12:antialias=true:hinting=true"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, lowerOnStart = True
, commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-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 "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Com "uname" ["-s","-r"] "" 36000
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
]
, sepChar = "%"
, alignSep = "}{"
, template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% }{ <fc=#ee9a00>%date%</fc>| %EGPF% | %uname%"
}
#+end_src

18
xmobar.config Normal file
View File

@@ -0,0 +1,18 @@
Config { font = "xft:FiraCode Nerd Font Mono:pixelsize=12:antialias=true:hinting=true"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, lowerOnStart = True
, commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-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 "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Com "uname" ["-s","-r"] "" 36000
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
]
, sepChar = "%"
, alignSep = "}{"
, template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% }{ <fc=#ee9a00>%date%</fc>| %EGPF% | %uname%"
}

View File

@@ -5,6 +5,14 @@ import System.Exit
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- needed for `spawnPipe`
import XMonad.Util.Run
-- needed for managing dock type programs like xmobar
import XMonad.Hooks.ManageDocks
import XMonad.Util.SpawnOnce
myTerminal = "kitty"
myFocusFollowsMouse :: Bool
@@ -18,7 +26,7 @@ myBorderWidth = 2
myNormalBorderColor = "#4D4D4D"
myFocusedBorderColor = "#BD93F9"
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
myWorkspaces = ["\f868\2081", "2", "3", "4", "5", "6", "7", "8", "9"]
myModMask = mod4Mask
@@ -27,9 +35,12 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- launch rofi
-- launch rofi drun
, ((modm, xK_p ), spawn "rofi -show drun")
-- launch rofi clipboard
, ((modm, xK_c ), spawn "rofi -show clipboard")
-- close focused window
, ((modm .|. shiftMask, xK_c ), kill)
@@ -128,7 +139,7 @@ myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
-- you may also bind events to the mouse scroll wheel (button4 and button5)
]
myLayout = tiled ||| Mirror tiled ||| Full
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
where
-- default tiling algorithm partitions the screen into two panes
tiled = Tall nmaster delta ratio
@@ -152,9 +163,15 @@ myEventHook = mempty
myLogHook = return ()
myStartupHook = return ()
myStartupHook = do
spawnOnce "nitrogen --restore &"
spawnOnce "picom &"
main = xmonad defaults
main = do
-- `xmobar -x 0` launches the bar on monitor 0
xmproc <- spawnPipe "xmobar -x 0 /home/sravan/.xmonad/xmobar.config"
-- launches xmobar as a dock
xmonad $ docks defaults
defaults = def {
-- simple stuff