Skip to content

Instantly share code, notes, and snippets.

@nekolinuxblog
Created February 3, 2022 07:19
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 nekolinuxblog/7264d5893bc7515e9dcd61b048c1514e to your computer and use it in GitHub Desktop.
Save nekolinuxblog/7264d5893bc7515e9dcd61b048c1514e to your computer and use it in GitHub Desktop.
------------------------------------------------------------------------------
-- shunsk's xmonad.hs file for 0.17.0
-- https://ok-xmonad.blogspot.com
--
-- base config with polybar
-- v001
------------------------------------------------------------------------------
{-# LANGUAGE NoMonomorphismRestriction #-}
import XMonad
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
---------------------------------------------------------------
-- MAIN
---------------------------------------------------------------
main = xmonad
$ withSB myPolybarConf
$ ewmh
$ docks
$ def { terminal = "xterm"
, modMask = mod4Mask
, layoutHook = avoidStruts (layoutHook def)
}
---------------------------------------------------------------
-- Polybar Setting
---------------------------------------------------------------
myPolybarConf
= def { sbLogHook
= xmonadPropLog
=<< dynamicLogString polybarPPdef
, sbStartupHook = spawn "~/.config/polybar/launch.sh --blocks"
, sbCleanupHook = spawn "killall polybar"
}
polybarPPdef
= def { ppCurrent
= polybarFgColor "#FF9F1C" . wrap "[" "]"
, ppTitle = const ""
}
polybarFgColor :: String -> String -> String
polybarFgColor fore_color contents
= wrap ("%{F" <> fore_color <> "} ") " %{F-}" contents
polybarBgColor :: String -> String -> String
polybarBgColor back_color contents
= wrap ("%{B" <> back_color <> "} ") " %{B-}" contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment