You are not logged in.
Every time I start my computer, I must manually run:
systemctl --user start clipmenud.serviceto get clipmenu (dmenu for clipboard buffer) working.
The underlying cause: clipmenu used to hard code DISPLAY=.0, however it is now reading this value from the DISPLAY environment variable. This means X server must be started before clipmenud so that systemd knows which $DISPLAY to be pushed to environment, which is then read by clipmend.
My clipmenu runs as --user process ("systemctl --user enable clipmenud.service")
My .xinitrc (relevant parts):
systemctl --user import-environment DISPLAY # (too late?)
systemctl --user start clipmenud.service
# ....
exec stumpwm(stumpwm is my window manager)
From terminal:
echo $DISPLAY
:0.0My understanding is that /etc/X11/xinit/xinitrc.d/50-systemd-user.sh should make sure systemd knows of the DISPLAY value, from this script:
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fiIs the issue that the above 50-systemd-user.sh isn't run? (My start up process is I have "exec stumpwm" at the end in my ~/.xinitrc).
The problem is described in this issue, but I do not understand it:
The issue here is simply using startx and enabling the clipmenud service won't
quite work since naturally the service gets started before it has a chance to
"see" any DISPLAY, thus to solve the problem (rather naively) I simply start
the unit manually in my .xinitrc without enabling it.
Last edited by penguin (2023-05-15 07:55:20)
Offline
My .xinitrc (relevant parts):
Okay, humor us then and post the "irrelevant" parts as they're the ones that really matter.
My understanding is that /etc/X11/xinit/xinitrc.d/50-systemd-user.sh should make sure systemd knows of the DISPLAY value... Is the issue that the above 50-systemd-user.sh isn't run?
You tell us - it's not in the part of your xinitrc that you deemed relevant.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
What's the problem just starting clipmenud directly from .xinitrc?
Offline
@wandrien That's what I'm trying to do, but I need to re-run it every time, manually from the command line.
@Trilby Sure, here's the full .xinitrc
#!/bin/sh
export MAGICK_OCL_DEVICE=OFF
# if on work-Dell, scale up retardedly small screen:
if [ $(hostname) == "dell" ]; then
xrandr --output eDP-1 --scale 0.4x0.4 --output DP3 --scale 0.5x0.5 --right-of eDP1
fi
# add executable path
if [ -f /etc/SuSE-release ]; then
export PATH=$HOME/bin:$HOME/usr/bin:$HOME/usr/local/bin:/usr/bin:/usr/local/bin:/bin:/usr/games:/usr/X11R6/bin
else
export PATH=$HOME/bin:$PATH
fi
# (nodeadkeys = only press once for ~ ^)
if [ -f /etc/arch-release ]; then
#or X11 will give warning:
#setxkbmap -option compose:ralt
## setxkbmap se nodeadkeys &
setxkbmap se &
fi
# XSET OPTIONS.
# use "xset -q" to see values.
xset -b & #Turn off beeps:
xset +fp /usr/share/fonts/local & #\
xset +fp ~/.fonts & # To get fonts in X11-apps
xset fp rehash & #/
xset dpms 0 0 600 # turn off monitor after 5 min.
# Don't need xscreensaver if using xset +dpms
if [ -f /usr/bin/xscreensaver ]; then
# Kill any running xscreensaver. Then start anew.
xscreensaver-command -exit; killall xscreensaver 2>/dev/null; xscreensaver -no-splash &
else
# for locking screen (e.g. work place policy requires it)
# (much smaller than xscreensaver)
xautolock -time 5 -locker slock &
fi
xbacklight -set 50 # reduce screen brightness by 50%
# clipboard manager (with history), using dmenu
# After install do: systemctl --user enable clipmenud.service
systemctl --user import-environment DISPLAY # know which
systemctl --user start clipmenud.service
# check if we have music player daemon
if [ -f /usr/bin/mpd ]; then
# MPD daemon start (if no other user instance exists)
[ ! -s ~/.mpd/mpd.pid ] && mpd
fi
#Set cursor theme:
xsetroot -cursor_name left_ptr &
xrdb -load ~/.Xresources &
xmodmap $HOME/.Xmodmap
if [ -f /etc/SuSE-release ]; then
DEFAULT_SESSION=stumpwm
else
# DEFAULT_SESSION=startfluxbox
DEFAULT_SESSION=ck-launch-session stumpwm
fi
xsetroot -solid '#333333' &
case $1 in
ratpoison)
exec ratpoison
;;
scrotwm)
feh --bg-scale ~/.fluxbox/backgrounds/krets.png
exec scrotwm
;;
stumpwm)
exec stumpwm
;;
wmaker)
exec wmaker
;;
*)
exec $DEFAULT_SESSION
;;
esacOffline
You aren't running the /etc/X11/xinit/xinitrc.d/50-systemd-user.sh which is explicitly mentioned as something one should be doing when opting for the .xinitrc as noted in the note box from: https://wiki.archlinux.org/title/Xinit#xinitrc
Run/source that before the systemctl --user start command
Last edited by V1del (2023-05-11 15:11:46)
Offline
Thanks for suggestions.
Indeed I was missing this part, I think:
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fiAfter the above I now have (in my ~/.xinitrc):
systemctl --user start clipmenud.service
clipmenud &Seems like I still must run "clipmenud&" in terminal once my WM has started. I'll have to tinker with this some more...
Offline
systemctl --user start clipmenud.service
clipmenud &This would be redundant, no?
Don't fork any of the xset* and setxkbmap calls, nor xrdb -load
DEFAULT_SESSION=ck-launch-session stumpwmAnd good god, don't use ck-launch-session !
If for some weird reason you need to delay the start of clipmenud, you can
…
(sleep 60; clipmenud) &
…Online
The sleep 60 command was the last part of the puzzle to get it to work for me.
Now things work, thanks to everyone for suggestions!
Offline