Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created April 12, 2024 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lidgnulinux/219b1e8efefefc1dd1d54b49e9975c1e to your computer and use it in GitHub Desktop.
Save lidgnulinux/219b1e8efefefc1dd1d54b49e9975c1e to your computer and use it in GitHub Desktop.
import XMonad
import System.Exit
import System.IO
-- import XMonad.Hooks.SetWNName
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Actions.WorkspaceNames
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import qualified XMonad.StackSet as W
import qualified Data.Map as M
myTerminal = "term"
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[
((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modMask, xK_p ), spawn "dmenu_run")
, ((modMask .|. shiftMask, xK_p ), spawn "gmrun")
, ((modMask .|. shiftMask, xK_c ), kill)
, ((modMask .|. controlMask , xK_space ), sendMessage NextLayout)
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
, ((modMask, xK_n ), refresh)
, ((modMask, xK_Tab ), windows W.focusDown)
, ((modMask, xK_j ), windows W.focusDown)
, ((modMask, xK_k ), windows W.focusUp )
, ((modMask, xK_m ), windows W.focusMaster )
, ((modMask, xK_Return), windows W.swapMaster)
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown )
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp )
, ((modMask, xK_h ), sendMessage Shrink)
, ((modMask, xK_l ), sendMessage Expand)
, ((modMask .|. shiftMask, xK_l ), spawn "gnome-screensaver-command --lock")
, ((modMask, xK_t ), withFocused $ windows . W.sink)
, ((modMask, xK_comma ), sendMessage (IncMasterN 1))
, ((modMask , xK_period), sendMessage (IncMasterN (-1)))
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
, ((modMask , xK_q ), restart "xmonad" True)
]
++
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
main = do
xmproc <- spawnPipe "/usr/bin/xmobar"
xmonad $ docks def {
modMask = mod4Mask, -- command key
borderWidth = 2,
normalBorderColor = "#cccccc",
focusedBorderColor = "#cd8b00",
terminal = myTerminal,
keys = myKeys,
workspaces = map show [1..8],
layoutHook=avoidStruts $ layoutHook def,
manageHook=manageHook def <+> manageDocks,
logHook = workspaceNamesPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = id
}
>>= dynamicLogWithPP
}
@lidgnulinux
Copy link
Author

-- Config { font = "xft:Bitstream Vera Sans Mono:size=9:bold:antialias=true"
-- Config { font = "Ubuntu Mono derivative Powerline 12"
Config { font = "Bitstream Vera Sans Mono 10"
       , borderColor = "white"
       , border = FullB
       , bgColor = "black"
       , fgColor = "grey"
       , alpha = 255
       -- , position = TopW L 100
       -- , position = Bottom
       , position = Static { xpos = 4 , ypos = 4, width = 1358, height = 20 }
       , allDesktops = True
       , overrideRedirect = True
       , lowerOnStart = True
       , commands = [
                      -- Run Network "wlp3s0" ["-L","0","-H","32", "--normal","green","--high","red"] 10
		      Run Network "wlp3s0" ["--template", "Net: <tx>kB|<rx>kB", "-L","1000","-H","5000", "--low", "gray", "--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 Date "%a %d-%m-%Y %H:%M" "date" 10
		    , Run Battery [ "--template" , "Batt: <acstatus>", "--normal", "darkorange", "--", "-o", "<left>% (<timeleft>)" ] 50
		    , Run StdinReader
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = " %StdinReader% }{ %battery% | <fc=#ee9a00>%date%</fc> " }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment