Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-10-22 22:20:34

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

to run xrandr before Xfce starts

i want to run xrandr before Xfce starts.  how should i do this?  the purpose is to change X to use a larger virtual buffer and for Xfce to initialize everything at that size ... on just one userid.

Offline

#2 2019-10-23 02:07:16

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: to run xrandr before Xfce starts

So, after X starts (which needs to be running for xrandr) and before Xfce starts (or rather, xfce4-session which kicks everything off).

I believe you are using xubuntu but I'm not sure of the version, so I'll talk to 18.04. On this distro, the /usr/bin/startxfce4 file is executed by the display manager. If you look at the bottom of the file, you'll see how it starts:

if [ -f $BASEDIR/xinitrc ]; then
  exec $prog $BASEDIR/xinitrc $CLIENTRC $SERVERRC
elif [ -f $HOME/.xfce4/xinitrc ]; then
  mkdir -p $BASEDIR
  cp $HOME/.xfce4/xinitrc $BASEDIR/
  exec $prog $BASEDIR/xinitrc $CLIENTRC $SERVERRC
else
  exec $prog /etc/xdg/xfce4/xinitrc $CLIENTRC $SERVERRC
fi

$prog is "xinit". $BASEDIR is "~/.config/xfce4". By default, the "else" statement is executed which loads and runs the content of /etc/xdg/xfce4/xinitrc . In this file, you will find the block:

  else
    # start xfce4-session normally
    xfce4-session
  fi

...this is where xfce4-session is kicked off, in effect starting Xfce.

You'll note in the first block of code, that it will check for the existence of a $BASEDIR/xinitrc file, and if that exists, it will execute that file. So to make work what you are asking, on a per user basis, do the following:

  1. Copy /etc/xdg/xfce4/xinitrc to ~/.config/xfce4

  2. Edit this new file and just before the xfce4-session command, add the X commands that you want to run. For example:

        # start xfce4-session normally
        xterm &
        xrandr ..... &
        xfce4-session
      fi

This will run these custom commands for just this user. Try it first just with xterm to make sure it works for you. Then try your xrandr command.

One caveat though, xfsettingsd adjusts display settings so it may overwrite whatever you put there. In that case, perhaps the best place for your xrandr commands is in Application Autostart, but unfortunately that will be run after Xfce is started.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2019-10-23 23:39:08

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: to run xrandr before Xfce starts

yes ... Xubuntu 18.04

i am changing just one userid to run X with a buffer size of 3840x2160 (i've tested this already) so i can try things in a UHD/4K environment even though my physical display is limited to 1920x1080 (HD/2K).  the reason i want to start this before Xfce start is because during my initial testing, done with Xfce already running, the buffer would not always be filled in even though Xfce did handle the size change.  it would leave the old pixel values in the new areas, which the very first time after user login is all black.  i have not yet tested this, but i feel confident that if Xfce starts at full size, it will fully deal with it in all cases.  and i won't need to do any later size changes for that user.  my guess is that Xfce will discover what buffer size it has.  of course, there is the possibility it discovers the physical display size and sets the buffer size to match.  i hope this works as expected since changing it later may sometimes leave 75% of the buffer all black (except for things that change as they are exposed).  switching user and coming back did not fill it in.  my background is a horizontal gradient but even the panel was not re-exsposed at full size (it may have been a lost expose action in X).

during my testing, i ran firefox and watched a UHD/4K video on YouTube in fullscreen mode, viewing a scrollable/pannable HD/2K portion, enlarged.  if i had a real UHD/4K display, i would not have seen as much detail unless i had a much larger screen. i even switched workspace during the fullscreen to verify it works (i now use keyboard shortcuts to switch both userid and workspace).

Offline

#4 2019-10-24 18:22:12

ctac
Member
Registered: 2017-05-08
Posts: 57

Re: to run xrandr before Xfce starts

ToZ wrote:

So, after X starts (which needs to be running for xrandr) and before Xfce starts (or rather, xfce4-session which kicks everything off).

I believe you are using xubuntu but I'm not sure of the version, so I'll talk to 18.04. On this distro, the /usr/bin/startxfce4 file is executed by the display manager. If you look at the bottom of the file, you'll see how it starts:
[

Interesting answer, so I look in /usr/bin/startxfce4 in debian testing.
I find that:

if test "x$XDG_DATA_DIRS" = "x"
then
  if test "x/usr/share" = "x/usr/local/share" -o "x/usr/share" = "x/usr/share"; then
    XDG_DATA_DIRS="/usr/local/share:/usr/share"
  else
    XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"
  fi
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
fi
export XDG_DATA_DIRS

It seems to me that this line is strange:

XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"

2 times '/usr/share' ?
It's the same on Openbsd6.6 but the dir change.

XDG_DATA_DIRS="/usr/local/share:/usr/local/share:/usr/share"

here 2 times '/usr/local/share'

Last edited by ctac (2019-10-24 18:38:13)

Offline

#5 2019-10-24 23:17:52

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: to run xrandr before Xfce starts

Here is the pre-compiled code:

if test "x$XDG_DATA_DIRS" = "x"
then
  if test "x@_datadir_@" = "x/usr/local/share" -o "x@_datadir_@" = "x/usr/share"; then
    XDG_DATA_DIRS="/usr/local/share:/usr/share"
  else
    XDG_DATA_DIRS="@_datadir_@:/usr/local/share:/usr/share"
  fi
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:@_datadir_@"
fi
export XDG_DATA_DIRS

The xdg spec calls for "/usr/local/share" and "/usr/share" to be included . You can specify any destination for the Xfce install which is delineated by "@_datadir_@". The compiled version then adds the current datadir to the list. If it is the same as one of the existing directories, it is replicated in the compiled script.

However, have a look at what the XDG_DATA_DIRS environment variable ends up being:

$ env | grep XDG_DATA_DIRS
XDG_DATA_DIRS=/usr/local/share:/usr/share

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#6 2019-10-24 23:30:38

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: to run xrandr before Xfce starts

the tests of constant expressions make it look like a generated script with simple substitution, rather than code generation that evaluates the test itself and decides whether to generate the code body or not.  it could be a simple template going through a simple substitution.  i can believe such a process can produce duplicate paths like that.  clearly the 2nd test in your quote does not need to be there since it will always be true.

Last edited by Skaperen (2019-10-24 23:31:38)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 548.42 KiB (Peak: 549.27 KiB) ]