Open TLATER opened 1 year ago
Could you post such an example X session file or name such a DE? I'm using ReGreet with Xfce, which launches an X server.
xfce is indeed an interesting one. Assuming the debian package, the xfce session actually launches startxfce4
:
[Desktop Entry]
Version=1.0
Name=Xfce Session
<snip>
Exec=startxfce4
Icon=
Type=Application
DesktopNames=XFCE
startxfce4
is a script that tests whether you're in an already running X session or not, and launches the X server if you're not (and also sources the system xinit files, which is also something lightdm and gdm typically do for X). xfce is an outlier as far as I've seen, looking for example at the xsession file for the debian stumpwm package:
[Desktop Entry]
Encoding=UTF-8
Name=Stumpwm
Comment=Tiling, keyboard driven Common Lisp window manager
TryExec=stumpwm
Exec=stumpwm
Type=Application
[X-Window Manager]
SessionManaged=true
That just launches the window manager, which requires X to already be running, and for the xinit scripts to be sourced. I'm taking the debian packages here because debian seems like it'd be the best source for de-facto standard behavior, but the same was true at some point in the past for at least the awesomewm and herbstluftwm packages across various versions of gentoo, Arch and NixOS - I've been fighting this battle far too long ;)
Hmm, so the intended behaviour indeed is to start the X server and then an X session. I'll try to get this done.
here is an example where it fails:
$ cat /usr/share/xsessions/bspwm.desktop
[Desktop Entry]
Name=bspwm
Comment=Binary space partitioning window manager
Exec=bspwm
Type=Application
As a hint, #16 intends to solve this, but struggles with internal inconsistencies of the Xorg spec.
Personally I've resorted to just using the sample gtk greeter because it's a bit quicker, and I've come to believe that the desktop file spec is so broken it's not worth using over hand-rolled scripts.
@hariseldon78 Could you try #16 to see if it works?
sure, i'll try it tonight
sorry for my rust ignorance: when i try to compile i get this error:
└─ ➜ cargo build --release
error: failed to parse manifest at `/home/roby/Developer/opensource/ReGreet/Cargo.toml`
Caused by:
failed to parse the `edition` key
Caused by:
supported edition values are `2015` or `2018`, but `2021` is unknown
sorry for my rust ignorance: when i try to compile i get this error:
└─ ➜ cargo build --release error: failed to parse manifest at `/home/roby/Developer/opensource/ReGreet/Cargo.toml` Caused by: failed to parse the `edition` key Caused by: supported edition values are `2015` or `2018`, but `2021` is unknown
Are you using Rust 1.640+ to compile it?
ok, it turns out i was using an ancient version of 2019 :facepalm: Anyway: it works, i can run bspwm just by selecting the usual entry! The only problem is that all the apps have half size fonts and ui. It seems that something is wrong with the scaling, although the polybar is of the correct size.
The only problem is that all the apps have half size fonts and ui. It seems that something is wrong with the scaling, although the polybar is of the correct size.
Check that you're using the correct X init file. Since this calls startx
, it does not behave as a correct display manager implementation - it will run ~/.xprofile
instead of ~/.xsession
(or the other way around), which may be where you set the environment variables that control scaling and such.
a workaround would be to set the XSERVERRC variable in the .desktop file for your Xorg session/wm to point to a custom file for startx that starts the desired environment
for example:
[Desktop Entry]
Name=Openbox
Type=XSession
Comment=Log in using the Openbox window manager (without a session manager)
Exec=env XSERVERRC=/home/winter/.xinit/openboxinitrc startx
TryExec=/usr/bin/openbox-session
Icon=openbox
#Type=Application
/home/winter/.xinit/openboxinitrc just has whatever you want launched by startx (openbox-session in my case)
Personally I've resorted to just using the sample gtk greeter
@TLATER Can you share how you run your X11 sessions? By gtk greeter, do you mean the one by kenny?
I wish to run herbstluftwm with ReGreet. I am using Arch Linux. The desktop entry for herbstluftwm shows the following:
~$ cat /usr/share/xsessions/herbstluftwm.desktop
[Desktop Entry]
Encoding=UTF-8
Name=herbstluftwm
Comment=Manual tiling window manager
Exec=herbstluftwm --locked
Type=Application
It seems like tuigreet does something to properly run X11 sessions. See their --xsession-wrapper
flag
Admitting that I am a total xorg noob: I'm having an hard time starting i3 on greetd+regreet on archlinux. Absolutely no problem with sway and no probs with Hyprland. I'm pretty sure I installed all the necessary packages. Right after the login attempt on ReGreet (and gtkgreet) it just goes back to it.
$ cat /usr/share/xsessions/i3.desktop
[Desktop Entry]
Name=i3
Comment=improved dynamic tiling window manager
Exec=i3
TryExec=i3
Type=Application
X-LightDM-DesktopName=i3
DesktopNames=i3
Keywords=tiling;wm;windowmanager;window;manager;
Re @Akhil-CM @fooryo
It depends on how exactly your distro packages the xinit scripts, which is what makes this so hard to fix. I couldn't figure out a clean behavior that will do what is expected on all systems.
Hence I went with the more practical solution of using gtkgreet (yes, the one by kenny) and just writing scripts that do what I expected them to do. They basically just ran startx <WM>
.
Personally I've completely migrated away from X11-based window managers since, because frankly this was all too messy to maintain.
Wayland of course is its own can of worms since there's no standardization around session scripts at all (yet, though I guess systemd technically offers one), but at least the ecosystem isn't pretending there is one.
@TLATER Guess I'll make a desktop
entry in /usr/share/xsessions/
with the Exec
and TryExec
fields set to startx
. I believe the window manager command should be put in ~/.xinitrc
from what I read in startx related info on Arch Wiki.
Some interesting things for my current SDDM display manager is that it runs during the startup, as per journalctl -b
Apr 13 19:07:32 archsys sddm-greeter[1104]: Reading from "/usr/share/xsessions/herbstluftwm.desktop"
Apr 13 19:07:32 archsys sddm[1049]: Message received from greeter: Login
Apr 13 19:07:32 archsys sddm[1049]: Reading from "/usr/share/xsessions/herbstluftwm.desktop"
Apr 13 19:07:32 archsys sddm[1049]: Session "/usr/share/xsessions/herbstluftwm.desktop" selected, command: "herbstluftwm --locked" for VT 2
# ...SNIP...
Apr 13 19:07:32 archsys sddm-helper[1228]: Starting X11 session: "" "/usr/share/sddm/scripts/Xsession \"herbstluftwm --locked\""
So it seems to use the script called /usr/share/sddm/scripts/Xsession
to start the window manager instead of startx
The script is as follows:
usr/share/sddm/scripts/Xsession
#! /bin/sh
# Xsession - run as user
# Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c)
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>
# Note that the respective logout scripts are not sourced.
case $SHELL in
*/bash)
[ -z "$BASH" ] && exec $SHELL --login $0 "$@"
shopt -q login_shell || exec $SHELL --login $0 "$@"
set +o posix
;;
*/zsh)
[ -z "$ZSH_NAME" ] && exec $SHELL --login $0 "$@"
[[ -o login ]] || exec $SHELL --login $0 "$@"
emulate -R sh
;;
*/csh|*/tcsh)
# [t]cshrc is always sourced automatically.
# Note that sourcing csh.login after .cshrc is non-standard.
xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
$SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $xsess_tmp"
. $xsess_tmp
rm -f $xsess_tmp
;;
*/fish)
[ -f /etc/profile ] && . /etc/profile
[ -f $HOME/.profile ] && . $HOME/.profile
xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
$SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
. $xsess_tmp
rm -f $xsess_tmp
;;
*) # Plain sh, ksh, and anything we do not know.
[ -f /etc/profile ] && . /etc/profile
[ -f $HOME/.profile ] && . $HOME/.profile
;;
esac
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f /usr/local/etc/xprofile ] && . /usr/local/etc/xprofile
[ -f $HOME/.xprofile ] && . $HOME/.xprofile
# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for i in /etc/X11/xinit/xinitrc.d/* ; do
if [ -x "$i" ]; then
. "$i"
fi
done
fi
# Load Xsession scripts
# OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
# by the scripts to work
xsessionddir="/etc/X11/Xsession.d"
OPTIONFILE=/etc/X11/Xsession.options
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
if [ -d "$xsessionddir" ]; then
for i in `ls $xsessionddir`; do
script="$xsessionddir/$i"
echo "Loading X session script $script"
if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\{1,\}$' > /dev/null; then
. "$script"
fi
done
fi
if [ -d /etc/X11/Xresources ]; then
for i in /etc/X11/Xresources/*; do
[ -f $i ] && xrdb -merge $i
done
elif [ -f /etc/X11/Xresources ]; then
xrdb -merge /etc/X11/Xresources
fi
[ -f $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources
if [ -f "$USERXSESSIONRC" ]; then
. "$USERXSESSIONRC"
fi
if [ -f "$USERXSESSION" ]; then
. "$USERXSESSION"
fi
if [ -z "$*" ]; then
exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION is no valid session."
else
exec $@
fi
I have made instructions on making greetd greeters work with X11 sessions here: https://www.reddit.com/r/linux/comments/1c8zdcw/using_x11_window_managers_with_greetd_login/
I have made instructions on making greetd greeters work with X11 sessions here: https://www.reddit.com/r/linux/comments/1c8zdcw/using_x11_window_managers_with_greetd_login/
Thank you for the contribution @RayZ0rr ! I will try in the future in case I would give xorg another shot with regreet
Forgive me if I misunderstand something myself here, but aiui, the X session commands defined in
/usr/share/xsession
expect to be executed in an already running X server. regreet does not launch an X server before executing those scripts, and therefore does not seem to be able to launch X sessions defined in xsession files written for traditional display managers.Is this correct, and intended? Can this be clarified in the readme?
Just trying to understand what exactly regreet intends to support, absolutely do not fault you for not fully implementing this de-facto "standard". Having spent the better part of three hours trying to figure out why my X sessions aren't starting and going down the rabbit hole of Xsession scripts again, the entire thing seems fragile. No wonder display managers have always been a pain to configure.