The basic scenario is that I'm sharing my dot files across multiple machines and want to have my session definitons synced as well.

Since I use different laptops and monitors with significantly different DPIs I want to be able to manually specify the desired DPI for each session.

After a few ugly(s/y/ier/g) hacks I settled on the .xsession running a wrapper script instead of directly calling xmonad-start (or gnome-session or whatever), and passing the desired DPI to that wrapper script. Like so:


[Desktop Entry]


[Desktop Entry]
Name=Xmonad HiDPI
Exec=/home/itsamemario/.xmonad/xmonad-start 192



xrdb -merge "$HOME/.Xresources"

# For setting DPI by passing an argument from display manager
if [ ! -z "$1" ]; then
  echo "! Fonts {{{
Xft.dpi: $1
! }}}" > "$TMPFILE"
  xrdb -merge "$TMPFILE"
  notify-send "Setting DPI to $1"
  rm -f "$TMPFILE"

# Other unimportant stuff here

exec /usr/bin/xmonad

Everything works great on two installs, but on the third one I can't run any session except the default one with no arguments passed. I just get the following error in .xsession-errors and it drops back to lightdm:

/etc/lightdm/Xsession: line 76: /home/itsamemario/.xmonad/xmonad-start 192: No such file or directory

In the course of debugging I've also noticed that I can also normally use $HOME/.xmonad/xmonad-start and .xmonad/xmonad-start on the other two installs but on this one it only works if I explicitly include /home/itsamemario/. All three are running Arch and I can't see any relevant difference in how they were installed or configured.

What could be causing exec lines in .xsessions to not pass arguments properly, and possibly also not expand session variables like $HOME?

(I know there are better workarounds to the DPI issue but my wrapper script approach addresses other requirements. I'm just focusing on DPI only here for the sake of simplicity.)

  • 1
    Maybe using bash and it's debug + error mode - set -x and set -e might be a way to further diagnose this. – Chris Stryczynski Apr 16 '18 at 7:18

Excerpt from https://help.gnome.org/admin/system-admin-guide/stable/session-custom.html.en

On Debian change the following in /etc/X11/Xsession.d/20x11-common_process-args

Change STARTUP_FULL_PATH=$(/usr/bin/which "$1"|| true) to STARTUP_FULL_PATH=$(/usr/bin/which $1 || true)

Change STARTUP="$1" to STARTUP=$1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.