chore: Changed xmobar look to be cleaner
This commit is contained in:
parent
9630e6b6f6
commit
40805cf02d
21 changed files with 900 additions and 150 deletions
|
@ -16,9 +16,11 @@
|
|||
|
||||
import XMonad
|
||||
import XMonad.Util.EZConfig (additionalKeysP,removeKeysP)
|
||||
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
|
||||
import XMonad.Hooks.DynamicLog
|
||||
import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL)
|
||||
import XMonad.Hooks.SetWMName
|
||||
import XMonad.Actions.SpawnOn
|
||||
import XMonad.Hooks.StatusBar
|
||||
import qualified XMonad.StackSet as W
|
||||
import XMonad.Hooks.EwmhDesktops
|
||||
import XMonad.Util.Run
|
||||
|
@ -65,9 +67,6 @@
|
|||
>myWorkspaces = ["main","web","text","code","social","mail"]
|
||||
>myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..]
|
||||
|
||||
>clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
|
||||
> where i = fromJust $ M.lookup ws myWorkspaceIndices
|
||||
|
||||
|
||||
\subsubsection{Keybindings}
|
||||
|
||||
|
@ -81,7 +80,7 @@
|
|||
|
||||
launch rofi
|
||||
|
||||
> , ("M-p", spawn "rofi -show run")
|
||||
> , ("M-p", spawn "rofi -show drun")
|
||||
|
||||
launch web browser
|
||||
|
||||
|
@ -236,9 +235,9 @@ Percent of screen to increment by when resizing panes
|
|||
\subsubsection{Startup Hook}
|
||||
\begin{code}
|
||||
myStartupHook = do
|
||||
spawnOnce "setxkbmap -layout us,pt"
|
||||
spawnOnce "setxkbmap -option grp:win_space_toggle"
|
||||
spawnOnce "setxkbmap -option caps:escape"
|
||||
spawn "setxkbmap -layout us,pt"
|
||||
spawn "setxkbmap -option grp:win_space_toggle"
|
||||
spawn "setxkbmap -option caps:escape"
|
||||
spawnOnce "pasystray"
|
||||
spawnOnce "nitrogen --restore &"
|
||||
spawnOnce "picom &"
|
||||
|
@ -248,14 +247,71 @@ Percent of screen to increment by when resizing panes
|
|||
spawnOnce "mailspring"
|
||||
spawnOnce "qjackctl"
|
||||
spawnOnce("xsetroot -cursor_name left_ptr")
|
||||
spawn ("killall trayer && sleep 1 && trayer --edge top --align right --widthtype request --margin 6 --padding 4 --SetDockType true --SetPartialStrut true --iconspacing 12 --expand true --monitor 0 --transparent true --alpha 0 " ++ colorTrayer ++ " --height 22 --distance 58 --distancefrom right")
|
||||
spawn ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --widthtype request --padding 7 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 26 --distance 5 &")
|
||||
spawnOn "web" myWebBrowser
|
||||
spawnOn "main" myTerminal
|
||||
\end{code}
|
||||
|
||||
|
||||
\subsection{Xmobar}
|
||||
|
||||
|
||||
\begin{code}
|
||||
|
||||
actionPrefix, actionButton, actionSuffix :: [Char]
|
||||
actionPrefix = "<action=`xdotool key super+"
|
||||
actionButton = "` button="
|
||||
actionSuffix = "</action>"
|
||||
|
||||
addActions :: [(String, Int)] -> String -> String
|
||||
addActions [] ws = ws
|
||||
addActions (x:xs) ws = addActions xs (actionPrefix ++ k ++ actionButton ++ show b ++ ">" ++ ws ++ actionSuffix)
|
||||
where k = fst x
|
||||
b = snd x
|
||||
|
||||
clickable :: [Char] -> [Char] -> [Char]
|
||||
clickable icon ws = addActions [ (show i, 1), ("q", 2), ("Left", 4), ("Right", 5) ] icon
|
||||
where i = fromJust $ M.lookup ws myWorkspaceIndices
|
||||
|
||||
myStatusBarSpawner :: Applicative f => ScreenId -> f StatusBarConfig
|
||||
myStatusBarSpawner (S s) = do
|
||||
pure $ statusBarPropTo ("_XMONAD_LOG_" ++ show s)
|
||||
("xmobar -x " ++ show s ++ " ~/.config/xmobar/xmobarrc" ++ show s)
|
||||
(pure $ myXmobarPP (S s))
|
||||
|
||||
|
||||
myXmobarPP :: ScreenId -> PP
|
||||
myXmobarPP s = def
|
||||
{ ppSep = ""
|
||||
, ppWsSep = ""
|
||||
, ppCurrent = xmobarColor cyan "" . clickable wsIconFull
|
||||
, ppVisible = xmobarColor grey4 "" . clickable wsIconFull
|
||||
, ppVisibleNoWindows = Just (xmobarColor grey4 "" . clickable wsIconFull)
|
||||
, ppHidden = xmobarColor grey2 "" . clickable wsIconHidden
|
||||
, ppHiddenNoWindows = xmobarColor grey2 "" . clickable wsIconEmpty
|
||||
, ppUrgent = xmobarColor orange "" . clickable wsIconFull
|
||||
, ppOrder = \(ws : _ : _ : extras) -> ws : extras
|
||||
, ppExtras = [ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s)
|
||||
,titleColorIsActive s (shortenL 81 $ logTitleOnScreen s)
|
||||
]
|
||||
}
|
||||
where
|
||||
wsIconFull = " <fn=2>\xf111</fn> "
|
||||
wsIconHidden = " <fn=2>\xf111</fn> "
|
||||
wsIconEmpty = " <fn=2>\xf10c</fn> "
|
||||
titleColorIsActive n l = do
|
||||
c <- withWindowSet $ return . W.screen . W.current
|
||||
if n == c then xmobarColorL cyan "" l else xmobarColorL grey3 "" l
|
||||
layoutColorIsActive n l = do
|
||||
c <- withWindowSet $ return . W.screen . W.current
|
||||
if n == c then wrapL "<icon=/home/afonso/.config/xmobar/xpm/" "_selected.xpm/>" l else wrapL "<icon=/home/afonso/.config/xmobar/xpm/" ".xpm/>" l
|
||||
|
||||
\end{code}
|
||||
|
||||
|
||||
\subsection{Config Binding}
|
||||
\begin{code}
|
||||
myConfig xmproc = def
|
||||
myConfig = def
|
||||
{
|
||||
terminal = myTerminal,
|
||||
focusFollowsMouse = myFocusFollowsMouse,
|
||||
|
@ -269,30 +325,14 @@ Percent of screen to increment by when resizing panes
|
|||
layoutHook = spacingWithEdge 10 $ myLayout,
|
||||
manageHook = manageSpawn <+> myManageHook <+> manageHook def,
|
||||
handleEventHook = myEventHook <+> fullscreenEventHook,
|
||||
startupHook = myStartupHook,
|
||||
logHook = dynamicLogWithPP $ xmobarPP
|
||||
{ ppOutput = \x -> hPutStrLn xmproc x -- xmobar on monitor 1
|
||||
, ppCurrent = xmobarColor color02 "" . wrap
|
||||
("<box type=Bottom width=2 mb=2 color=" ++ color02 ++ ">") "</box>"
|
||||
, ppVisible = xmobarColor color05 "" . clickable
|
||||
, ppHidden = xmobarColor color01 "" . wrap
|
||||
("<box type=Top width=2 mt=2 color=" ++ color01 ++ ">") "</box>" . clickable
|
||||
, ppHiddenNoWindows = xmobarColor color01 "" . clickable
|
||||
, ppTitle = xmobarColor color04 "" . shorten 60
|
||||
, ppSep = "<fc=" ++ color03 ++ "> <fn=1>|</fn> </fc>"
|
||||
, ppUrgent = xmobarColor color02 "" . wrap "!" "!"
|
||||
, ppExtras = [windowCount]
|
||||
, ppOrder = \(ws:l:t:ex) -> [ws]++ex++[t]
|
||||
}
|
||||
}
|
||||
startupHook = myStartupHook}
|
||||
\end{code}
|
||||
|
||||
\subsection{Main}
|
||||
\begin{code}
|
||||
main :: IO ()
|
||||
main = do
|
||||
xmproc <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc" -- launch on monitor 1
|
||||
xmonad $ ewmh $ ewmhFullscreen $ docks $ additionalKeysP (removeKeysP (myConfig xmproc) myRemoveKeys) myKeys
|
||||
xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys
|
||||
\end{code}
|
||||
|
||||
\subsection{Default Bindings}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue