I want to set up a fairly basic xmonad desktop with xmobar, however the latter refuses to cooperate. xmobar doesn't start when I launch startx, and when I run xmobar manually from terminal I get the following error:
xmobar: SocketError {socketErrorMessage = "Network.Socket.connect: <socket: 16>: does not exist (No such file or directory)", socketErrorFatal = True, socketErrorAddress = Just (Address "unix:path=/run/user/1000/bus")}
My xmonad.hs:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.FadeInactive
main = xmonad =<< statusBar myBar def def myConfig
myBar = "xmobar"
myConfig
= def
{ modMask = mod4Mask,
terminal = "st",
borderWidth = 2,
normalBorderColor = "RoyalBlue",
focusedBorderColor = "SkyBlue1"
}
and .xmobarrc:
Config
{ font = "xft:Fira Code:pixelsize=12:antialias=true",
borderColor = "black",
border = TopB,
bgColor = "black",
fgColor = "grey",
position = TopSize L 100 16,
commands
= [ Run Cpu
[ "-p", "2",
"-L", "3",
"-H", "50",
"--normal", "green",
"--high", "red"
] 10,
Run Memory ["-t","Mem: <usedratio>%"] 10,
Run Swap [] 10,
Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
],
sepChar = "%",
alignSep = "}{",
template = " %cpu% | %memory% * %swap% | }{ | <fc=#87d7ff>%uname%</fc> | <fc=#ee9a00>%date%</fc> "
}
I tried following the advice given here, which didn't help and broke the X server entirely, and here, which only kind of aleviated the problem. Simply adding `dbus-launch &` to xinitrc does nothing, but I figured I can take its output:
$ dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-hdU0LMC10t,guid=b10259328b7cfe7d23b4677160ab8964
DBUS_SESSION_BUS_PID=3422
and export that address as an environment variable. For now I've made a little script .dbus-address
#!/bin/sh
dbus-launch | while read -r line ; do
export $line
done
and start xmonad with
$ source ~/.dbus-address && startx
I need to do this every time since dbus-launch generates a new address and guid each time it is run. `/etc/init.d/dbus status` gives
$ /etc/init.d/dbus status
* status: started
both with and without the startup script.
This works but somehow I get the feeling this is not the intended method. Does anyone have any suggestions?