nwg-piotr / nwg-dock

GTK3-based dock for sway
MIT License
173 stars 9 forks source link

multiple users using nwg-dock and switching between them #41

Closed moesgaard closed 1 year ago

moesgaard commented 1 year ago

I have 3 users on my system and they are all setup with sway and nwg. If I login with user1 in sway and nwg and i get the nwg-Dock showing up, if I then logout. Then switch to user2 with sway and nwg, everything except nwg-dock is working.

if i try and manually run "nwg-dock -r" I get a info warning it is running but nothing happens.

Steps to reproduce the behavior: have multiple users use nwg-dock

I have the following autostart

exec rm /tmp/nwg-shell-check-update.lock
exec wlsunset -t 4500 -T 6500 -l 55.6761 -L 12.5657 -g 1.0
exec swaync -s /home/USERNAME/.config/swaync/preset-0.css
exec nm-applet --indicator
exec_always nwg-autotiling
exec_always nwg-drawer -r -c 6 -is 60 -fscol 2 -ovl -g WhiteSur-Dark -i Mkos-Big-Sur-Panel-white -s preset-0.css -term alacritty -ft
exec_always nwg-dock -r -p bottom -o DP-1 -l top -a center -i 48 -hd 10 -s preset-0.css
exec_always nwg-panel -c preset-0 -s preset-0.css
exec_always nwg-shell-check-updates
exec swayidle timeout 86400 nwg-lock timeout 86400 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
exec nwg-update-indicator

Expected behavior Dock turning up on screen

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

nwg-piotr commented 1 year ago

Please show me the output of the printenv command on your machine.

moesgaard commented 1 year ago

ALACRITTY_LOG=/tmp/Alacritty-75536.log ALACRITTY_SOCKET=/run/user/1000/Alacritty-wayland-1-75536.sock ALACRITTY_WINDOW_ID=93995146659936 COLORTERM=truecolor DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DEBUGINFOD_URLS=https://debuginfod.archlinux.org DESKTOP_SESSION=sway DISPLAY=:1 GTK_THEME=WhiteSur-Dark HOME=/home/XXXXXXXXX I3SOCK=/run/user/1000/sway-ipc.1000.1340.sock LANG=en_US.UTF-8 LC_ADDRESS=da_DK.UTF-8 LC_COLLATE=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_IDENTIFICATION=da_DK.UTF-8 LC_MEASUREMENT=da_DK.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_MONETARY=da_DK.UTF-8 LC_NAME=en_US.UTF-8 LC_NUMERIC=da_DK.UTF-8 LC_PAPER=da_DK.UTF-8 LC_TELEPHONE=da_DK.UTF-8 LC_TIME=da_DK.UTF-8 LOGNAME=XXXXXXXXX MAIL=/var/spool/mail/XXXXXXXXX MOTD_SHOWN=pam OLDPWD=/home/XXXXXXXXX PATH=/home/XXXXXXXXX/perl5/bin:/home/XXXXXXXXX/.local/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin PWD=/home/XXXXXXXXX SHELL=/bin/zsh SHLVL=1 SWAYSOCK=/run/user/1000/sway-ipc.1000.1340.sock TERM=alacritty USER=XXXXXXXXX WAYLAND_DISPLAY=wayland-1 WINDOWID=93995146659936 XCURSOR_SIZE=24 XDG_ACTIVATION_TOKEN=2aac0718f58f29fb45bbed80a8f736f3 XDG_DATA_DIRS=/home/XXXXXXXXX/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT=seat0 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP= XDG_SESSION_ID=2 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1 XDG_SESSION_TYPE=wayland XDGVTNR=1 =/bin/printenv decorations=full SSH_AUTH_SOCK=/tmp/ssh-XXXXXXmKdu6b/agent.75568 SSH_AGENT_PID=75570 PERL5LIB=/home/XXXXXXXXX/perl5/lib/perl5 PERL_LOCAL_LIB_ROOT=/home/XXXXXXXXX/perl5 PERL_MB_OPT=--install_base "/home/XXXXXXXXX/perl5" PERL_MM_OPT=INSTALL_BASE=/home/XXXXXXXXX/perl5 USE_CCACHE=1 CCACHE_EXEC=/usr/bin/ccache

moesgaard commented 1 year ago

The funny thing is it is the first user that logs in that gets the dock ... so if i reboot and user e.g. User number 2, he gets it and the rest dont. even tried switching to KDE and back and same result ..

nwg-piotr commented 1 year ago

Must be some issue related to the /tmp/nwg-dock.lock file, but I can't imagine what's happening. Need to set up a multi-user machine and take a look.

[edit] Possibly just because the lock file belongs to another user. I'd need to add the user name to the file name.

One way or another, I need to recreate the issue on my side.

moesgaard commented 1 year ago

Yup can confirm if i log in and remove /tmp/nwg-dock.lock file and den do sway reloading it works :) could it be solved with nwg-dock-username.lock ?? or nwg-dock-sessionname.lock ??

nwg-piotr commented 1 year ago

I need an environment variable specific to the user. What do you mean by sessionname?

nwg-piotr commented 1 year ago

XDG_SESSION_ID value should be user-specific. Does it change for you when you log in as another user?

moesgaard commented 1 year ago

yes it changes, and i meant session ID

XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP= ---> XDG_SESSION_ID=8 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session5 XDG_SESSION_TYPE=wayland XDG_VTNR=1

nwg-piotr commented 1 year ago

Thanks. Let it be the session ID.

nwg-piotr commented 1 year ago

yes it changes

One more question: is it always the same for the same user? According to AI:

the XDG_SESSION_ID value is not always the same for the same user. It is specific to each user’s session and changes when a new session is created, such as when another user logs in.

moesgaard commented 1 year ago

no i changes for each login :) with +1

nwg-piotr commented 1 year ago

We will use md5-hashed user name.

nwg-piotr commented 1 year ago

Check if the 0.3.8 version behaves well for you, and let me know, please.

NOTE: I forgot to change the number in nwg-dock -v, so you'll still see '0.3.7' there.

moesgaard commented 1 year ago

can confirm it works like a charm.. switching between users is seemsless now :+1:

nwg-piotr commented 1 year ago

Thanks! I'll add the same function to nwg-dock-hyprland, if so.