Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Should you create ~/.xinitrc for Openbox?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Sun Apr 11, 2021 9:32 pm    Post subject: Should you create ~/.xinitrc for Openbox? Reply with quote

On the Openbox wiki page, it says,
Quote:
...note that a common misconception is to create a ~/.xinitrc file - please do not do that, as it will prevent X from executing all the automatically provided scripts in /etc/X11/xinit/xinitrc.d/ - if you wish to add anything in particular, you can create an executable file in that directory.

and instead put export XSESSION=openbox in ~/.bashrc or to use a display manager. I did this and it did not work. Using exec openbox-session in ~/.xinitrc did however, though I'm not sure how that affected any scripts in xinitrc.d.

Contrary to Gentoo's Openbox page, the Arch wiki mentions none of this, and just says to use xinit. Why is it that only this page says not to use a ~/.xinitrc file?
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Sun Apr 11, 2021 9:48 pm    Post subject: Reply with quote

Yes, I run Openbox by setting XSESSION to "openbox", and don't have an ~/.xinitrc file. It works.

Shidouuu wrote:
Contrary to Gentoo's Openbox page, the Arch wiki mentions none of this, and just says to use xinit. Why is it that only this page says not to use a ~/.xinitrc file?

Because it is a Gentoo-specific setup. There's an /etc/X11/chooser.sh script on Gentoo that handles XSESSION.
Back to top
View user's profile Send private message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Sun Apr 11, 2021 10:05 pm    Post subject: Reply with quote

Huh, is this specific to Openbox aswell?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54234
Location: 56N 3W

PostPosted: Sun Apr 11, 2021 10:24 pm    Post subject: Reply with quote

Shidouuu,

~/.xinitrc is only used when you run startx.

If you use a display manager, its not consulted.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Sun Apr 11, 2021 10:24 pm    Post subject: Reply with quote

I don't understand the question. On Gentoo, the value of XSESSION tells startx what it should start. If you set it to "openbox", then startx will start Openbox.

The complete mechanism that makes this work is:
  • startx is a shell script that runs the xinit program. If you do not have an ~/.xinitrc file, startx will supply /etc/X11/xinit/xinitrc as the client.
  • /etc/X11/xinit/xinitrc is also a shell script that will source all files in /etc/X11/xinit/xinitrc.d. That's what the Wiki article mentions.
  • /etc/X11/xinit/xinitrc will also call /etc/X11/chooser.sh to determine what to run, using the value of XSESSION.
  • If the value of XSESSION is "openbox", /etc/X11/chooser.sh will run /etc/X11/Sessions/openbox, which is provided by Gentoo's x11-wm/openbox package.
  • /etc/X11/Sessions/openbox calls /usr/bin/openbox-session, and that's what ultimately launches Openbox.
If you use a display manager, then nothing of this applies. Display managers have their own way to determine which desktop environment or window manager to start.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2964
Location: Edge of marsh USA

PostPosted: Mon Apr 12, 2021 3:25 am    Post subject: Reply with quote

"... please do not do that, ..." is a little bit too strong, in my opinion.

My ~/.xinitrc takes care of the necessary duties, plus then some.
Code:
setxkbmap -option terminate:ctrl_alt_bksp
#exec startkde
#exec xfce4-session
#exec startxfce4
#exec startlxde
xhost +local:root > /dev/null
/usr/bin/numlockx on
#DEPRECATED ck-launch-session
# ck-launch-session dbus-launch --sh-syntax --exit-with-session startlxde
export XDG_MENU_PREFIX=lxde-
#dbus-launch --sh-syntax --exit-with-session startlxde
#dbus-launch --sh-syntax --exit-with-session openbox-session
/usr/bin/dbus-launch --sh-syntax --exit-with-session /usr/bin/openbox-session

The commented-out lines (#) are for my historical reference.

More that one way to skin a cat.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum