You are not logged in.

#1 2011-03-22 06:22:23

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

[solved] What do these new lines in .xinitrc do?

What do the following lines in .xinitrc do? I noticed they were included in one of the last updates this month:

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

Last edited by trusktr (2011-03-22 23:17:34)


joe@trusktr.io - joe at true skater dot io.

Offline

#2 2011-03-22 06:46:17

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,360

Re: [solved] What do these new lines in .xinitrc do?

You're asking for help in reading a bash script? I don't even use bash very often and I know what that does.....


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2011-03-22 06:59:01

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] What do these new lines in .xinitrc do?

I've seen it in the wiki too and I don't get it: why does the file have to be executable to source it?

[karol@black test]$ ls -l 1 2
-rwxr-xr-x 1 karol users 29 03-22 07:52 1
-rw-r--r-- 1 karol users  4 03-22 07:52 2
[karol@black test]$ cat 1
#!/bin/bash

a=1
. 2
echo $a
[karol@black test]$ cat 2
a=2
[karol@black test]$ ./1
2

'2' gets sourced by '1' even though '2' is not executable.

I'm not a bash guru, so feel free to correct me.

Offline

#4 2011-03-22 07:56:08

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

Basically it source files from /etc/X11/xinit/xinitrc.d/
nothing special, I notice it there's a file named "30-dbus" in there.
It's contain some dbus session-related mention in wiki which usually need to be done manually by the user.
Guess you don't have to do it manually any more big_smile
and as for why it's have to be executable: If I say your system will run ANY FILE in a certain folder without care what it is, do you still think it's OK?


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#5 2011-03-22 08:05:58

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] What do these new lines in .xinitrc do?

lives2evil wrote:

If I say your system will run ANY FILE in a certain folder without care what it is, do you still think it's OK?

That's basically what I figured out, but is it OK to say that files have to be executable, is it a convention of sorts?
https://wiki.archlinux.org/index.php?ti … oldid=prev

Offline

#6 2011-03-22 08:30:24

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

Oh, I think it's just a secured method. It's not necessary to be executable. But it SHOULD BE executable.
For a fun example:
A file/a driver must be executable/have a licence to be execute/drive. Without this, unexpected problem/traffice accident may occur. big_smile

Last edited by lives2evil (2011-03-22 08:35:26)


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#7 2011-03-22 09:08:27

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved] What do these new lines in .xinitrc do?

lives2evil wrote:

Oh, I think it's just a secured method. It's not necessary to be executable. But it SHOULD BE executable.
For a fun example:
A file/a driver must be executable/have a licence to be execute/drive. Without this, unexpected problem/traffice accident may occur. big_smile

Yeah but when you haul (source) a car onto a tow truck, it can still move without driving. wink


ᶘ ᵒᴥᵒᶅ

Offline

#8 2011-03-22 09:12:31

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

litemotiv wrote:

Yeah but when you haul (source) a car onto a tow truck, it can still move without driving. wink

Oh yeah, never thought of that tongue


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#9 2011-03-22 10:53:18

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: [solved] What do these new lines in .xinitrc do?

... But this file (/etc/X11/xinit/xinitrc) is never executed, right? Once there is a ~/.xinitrc that launches our WM/DE of choice...

Offline

#10 2011-03-22 10:57:26

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

True enough. It won't be executed if you do not wish it to do.
Perhaps we should update the /etc/skel/.xinitrc file to included this template?


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#11 2011-03-22 11:34:43

jakobm
Member
Registered: 2008-03-24
Posts: 132

Re: [solved] What do these new lines in .xinitrc do?

lives2evil wrote:

Perhaps we should update the /etc/skel/.xinitrc file to included this template?

The skel xinitrc file already includes them, see xorg-xinit/trunk/xinitrc.

Offline

#12 2011-03-22 12:51:41

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

It's true. Guess I haven't updated recently.


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#13 2011-03-22 19:09:21

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: [solved] What do these new lines in .xinitrc do?

That's exactly why I was asking, lives2evil. hehe.

@ngoonee Not everyone that uses Linux uses Bash yet (I'm still learning, that is).

I haven't noticed any lack of performance with those lines omitted. What is the best reason to add those lines?

Last edited by trusktr (2013-08-31 18:52:17)


joe@trusktr.io - joe at true skater dot io.

Offline

#14 2011-03-22 19:14:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] What do these new lines in .xinitrc do?

trusktr wrote:

I haven't noticed any lack of performance with those lines omitted. What is the best reason to add those lines?

You omit those lines, executable files in /etc/X11/xinit/xinitrc.d/ won't get sourced. If you don't have any - nothing should change.

Offline

#15 2011-03-22 19:25:30

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

It should help on newly installation rather than already existed one. Note that dbus I mentioned. Nothing will change if everything is already working for you. And performance is nothing you can boost so easily my friend smile
So to sum it up, its purpose is to make life easier in the future smile

Last edited by lives2evil (2011-03-22 19:29:52)


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#16 2011-03-22 20:48:47

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: [solved] What do these new lines in .xinitrc do?

Thanks for the tidbit Karol! big_smile

How is it exactly that that would help on a new system vs an already existent one, lives2evil?


joe@trusktr.io - joe at true skater dot io.

Offline

#17 2011-03-22 21:24:49

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

OK, I found it's quite interesting.
So as you know if you're using a standalone wm (openbox for example) you'll have to add this to your .xinitrc

exec ck-launch-session dbus-launch openbox-session

which is so........ long and many people usually make mistake in this step. (at least I did https://bbs.archlinux.org/viewtopic.php?id=115488)
So I tried and use the new method to see if anything different. Edited /etc/slim.conf

login_cmd           exec ck-launch-session /bin/bash -login ~/.xinitrc %session

Add those lines to .xinitrc and change my exec line to "exec openbox-session".
Guess what, no error or whatsoever when I tried to automount a cd or usb.
so except for the line in slim.conf (which I think will be fixed in the future) just a "exec openbox-session" worked like a charm.
But why must we source files instead of added code directly to ~/.xinitrc? The answer is "for future convenient".


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#18 2011-03-22 22:01:45

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: [solved] What do these new lines in .xinitrc do?

aha, i see! So i'm guessing in the future they'll actually replace

exec ck-launch-session dbus-launch openbox-session

with

exec openbox-session

and the user won't ever have to see

login_cmd           exec ck-launch-session /bin/bash -login ~/.xinitrc %session

right?

Last edited by trusktr (2011-03-22 22:01:58)


joe@trusktr.io - joe at true skater dot io.

Offline

#19 2011-03-22 22:37:20

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

Oops, sorry, I jumped to conclusion. I have found out that slim some out get dbus running without me knowing (I disable these lines and it worked fine).
Since then I have been trying to figure it out what exactly this dbus is all about.
According to the wiki it's needed:
https://wiki.archlinux.org/index.php/Db … nvironment
After a while I found out.
this time I use startx to run X instead of slim. changed my "exec openbox-session" to "exec pcmanfm".
1st: with those lines commented out.
When I tried accessing Trash folder, it say: not supported.
2nd: uncommented.
Accessing trash is no problemo.
Obviously pcmanfm is using dbus to communicating with gvfs.

So you still have to uses "exec ck-launch-session dbus-launch openbox-session" big_smile
The only people who get benefit from this is those who run only one application.

However I'm still think this is an improvement and probably it's gonna be useful in the future (I'm not talking about this DBUS case).
PS:
There's also a file about libcanberra.
http://0pointer.de/lennart/projects/lib … /#overview

Last edited by lives2evil (2011-03-22 22:43:09)


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#20 2011-03-22 22:43:07

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: [solved] What do these new lines in .xinitrc do?

oh, ok, gotcha! hehe. I'll just leave the lines there and see what happens in the future. big_smile


joe@trusktr.io - joe at true skater dot io.

Offline

#21 2011-03-22 22:59:53

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [solved] What do these new lines in .xinitrc do?

If you have nothing else to ask, then please mark this as [Solve]


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#22 2011-03-22 23:17:49

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: [solved] What do these new lines in .xinitrc do?

Thank you lives2evil. smile


joe@trusktr.io - joe at true skater dot io.

Offline

Board footer

Powered by FluxBB