Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] xmonad SocketError with dbus and OpenRC (Read 1620 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] xmonad SocketError with dbus and OpenRC

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:

Code: [Select]
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:

Code: [Select]
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:

Code: [Select]
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:

Code: [Select]
$ 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

Code: [Select]
#!/bin/sh

dbus-launch | while read -r line ; do
    export $line
done

and start xmonad with

Code: [Select]
$ 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

Code: [Select]
$ /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?

Re: xmonad SocketError with dbus and OpenRC

Reply #1
Hello, have you tried adding this on your .xinitrc?:


Code: [Select]
exec dbus-launch xmonad
Then the "startx" command should work.

I use xmonad and it works for me.
Artix Linux Colombia