Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

mafflerbach
mafflerbach

Posted on

     

Jumping from I3 to xmonad - Day 2 -> Setup xmobar

Setting up xmonad is already a story, but xmobar is a completely different.

I had in I3 a bar iBlocks bar with the following content.

i3-iblocks-status-bar.png

This is of cause something what I want back, at lease in a similar fashion.
Xmobar don't show your workspaces per default. The reason is, that xmobar and xmonad are two different programs, but xmobar get the information from xmonad as hook. Some how I had difficulties without the workspace display in my bar.
So I want my workspaces back and the overview of my time tracking.

As time tracker I'm usingwatson, it's an easy to use CLI time tracker.

To get the right output for xmobar I created a script:

#!/bin/bashwhile :;do    case"$1"in-s)echo$(watson status) |sed-e"s/Project //g"-e"s/(.*)//g";;-l)echo"$(watson log |head-n1)";;*)breakesacshiftdone
Enter fullscreen modeExit fullscreen mode
,RunCom"watson.sh"["-l"]"watson"60,RunCom"watson.sh"["-s"]"watson2"60
Enter fullscreen modeExit fullscreen mode

This delivered something like this:

No project started. / Friday 27 November 2020 (12h 04m 17s)

The workspace overview tells a different story.

This is from my xmonad settings:

-- needed importsimportXMonad.Hooks.DynamicLog(dynamicLogWithPP,wrap,xmobarPP,xmobarColor,PP(..))main=do-- i want to have two bars. with slightly different settingsxmproc0<-spawnPipe"xmobar -x 0 /home/maren/.config/xmobar/xmobarrc0 -A 200"xmproc1<-spawnPipe"xmobar -x 1 /home/maren/.config/xmobar/xmobarrc1 -A 200"xmonad$ewmh$docks$def{---- [block of ohter definitions]---- defining the hook for xmobarlogHook=myLogHook<+>dynamicLogWithPPxmobarPP{ppOutput=\x->hPutStrLnxmproc0x>>hPutStrLnxmproc1x,ppCurrent=xmobarColor"FGCOLOR""".wrap"[""]"-- Current workspace in xmobar,ppVisible=xmobarColor"COLOR2"""-- Visible but not current workspace,ppHidden=xmobarColor"COLOR3""".wrap"*"""-- Hidden workspaces in xmobar,ppSep="<fc=FGCOLOR> <fn=2>|</fn> </fc>"-- Separators in xmobar,ppUrgent=xmobarColor"COLOR8""".wrap"!""!"-- Urgent workspace,ppExtras=[windowCount]-- # of windows current workspace,ppOrder=\(ws:l:t)->[ws]}}
Enter fullscreen modeExit fullscreen mode

And here is the template:

,template=" <action=`xdotool key control+alt+g`><icon=haskell_20.xpm/> </action><fc=#cfddeb>  |</fc> %StdinReader% }{ <fc=#cfddeb><fn=2>|</fn> </fc><fc=#6F94CF> %cpu% </fc><fc=#cfddeb> <fn=2>|</fn></fc> <fc=#6F94CF> %memory% </fc><fc=#cfddeb> <fn=2>|</fn></fc> <fc=#6F94CF> %disku% </fc><fc=#cfddeb> <fn=2>|</fn></fc>  <fc=#B993B2> %enp0s31f6% </fc><fc=#cfddeb> <fn=2>|</fn></fc> <fc=#cfddeb> <fn=2>|</fn></fc> <fc=#B993B2> %wlp3s0wi% </fc><fc=#cfddeb> <fn=2>|</fn></fc> <fc=#5C54AA> %date% </fc><fc=#cfddeb><fn=2>|</fn></fc> <fc=#5C54AA>%watson2% / %watson% | %battery% %trayerpad%</fc> "
Enter fullscreen modeExit fullscreen mode

You can ignore the tags the are used to get colors in the bar. Everything which is between % are the variables for replacing the content.

TheStdinReader variable provides the workspace display. And here is the result:

xmonad-bar.png

You can see the full configurationhere - xmonad andhere - picom

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More frommafflerbach

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp