You are not logged in.

#26 2020-06-11 15:27:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,767

Re: .xinitrc won't run any scripts

If you put the "date > /tmp/startx.date" on the top of your statusbar script (above the print_bat function block), does that create/update the file?

Offline

#27 2020-06-11 15:32:56

Stafer
Member
Registered: 2020-06-11
Posts: 17

Re: .xinitrc won't run any scripts

No it doesn't create it.

Edit: I've even tried with a test script:

#!/bin/bash
tocuh ~/file1

And it does nothing. It just won't touch the script.

Last edited by Stafer (2020-06-11 15:36:09)

Offline

#28 2020-06-11 15:47:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,767

Re: .xinitrc won't run any scripts

"touch", not "tocuh"

stat /path/to/statusbar

Offline

#29 2020-06-11 15:52:02

Stafer
Member
Registered: 2020-06-11
Posts: 17

Re: .xinitrc won't run any scripts

Yeah, sorry that was just a mistype.

  File: .local/bin/statusbar
  Size: 397             Blocks: 8          IO Block: 4096   regular file
Device: 803h/2051d      Inode: 12585171    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/     ktl)   Gid: (  998/   wheel)
Access: 2020-06-11 17:31:22.914720213 +0200
Modify: 2020-06-11 17:28:55.534710022 +0200
Change: 2020-06-11 17:28:55.661376696 +0200
 Birth: 2020-06-11 17:28:55.534710022 +0200

Offline

#30 2020-06-11 15:53:32

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,767

Re: .xinitrc won't run any scripts

Add

echo $PATH > /tmp/startx.path

to your xinitrc.

Offline

#31 2020-06-11 15:55:55

Stafer
Member
Registered: 2020-06-11
Posts: 17

Re: .xinitrc won't run any scripts

It is in the path:

/usr/local/sbin:/usr/local/bin:/usr/bin:~/.local/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Last edited by Stafer (2020-06-11 15:58:31)

Offline

#32 2020-06-11 15:59:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,767

Re: .xinitrc won't run any scripts

In the path of *what*?
Where is that path defined?
startx does not interpret the xinitrc w/ bash, you can't rely on your bashrc nor bashisms nor bash variables.
Can you "/home/ktl/.local/bin/statusbar" in your xinitrc?

Offline

#33 2020-06-11 16:09:00

Stafer
Member
Registered: 2020-06-11
Posts: 17

Re: .xinitrc won't run any scripts

I didn't add to path in bashrc but in /etc/profile

...
appendpath '~/.local/bin'
unset -f appendpath
export PATH
...

Can you "/home/ktl/.local/bin/statusbar" in your xinitrc?

This worked.

Am i just supposed to do this from now? I was on manjaro cli and i ran the scripts as i did before.

Offline

#34 2020-06-11 16:15:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,767

Re: .xinitrc won't run any scripts

You could export the path or ". /etc/profile" in your xinitrc - if you consider that a good idea.

Offline

#35 2020-06-11 16:43:39

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,518
Website

Re: .xinitrc won't run any scripts

You should not use "~" in /etc/profile as that is used in processes other than your own user's.  That should be in your user's shell profile, e.g., ~/.bash_profile if you use bash.

If the PATH is set and exported from ~/.bash_profile it will be available under xinit, and almost certainly startx (unless startx has recently changed to override it ... which sadly wouldn't be a huge surprise to me).

EDIT: D'Oh, the actual problem is that you quote the tilde so it is never expanded.  While it is still not ideal to have that in /etc/profile, it will work if you get rid of those single quotes.

However, if these scripts work in your interactive shell, you are already appending ~/.local/bin to your PATH somewhere else.  Consolodate these into the proper place: ~/.bash_profile.

Last edited by Trilby (2020-06-11 16:45:38)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#36 2020-06-11 17:44:19

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: .xinitrc won't run any scripts

Trilby wrote:

You should not use "~" in /etc/profile as that is used in processes other than your own user's.  That should be in your user's shell profile, e.g., ~/.bash_profile if you use bash.

If the PATH is set and exported from ~/.bash_profile it will be available under xinit, and almost certainly startx (unless startx has recently changed to override it ... which sadly wouldn't be a huge surprise to me).

EDIT: D'Oh, the actual problem is that you quote the tilde so it is never expanded.  While it is still not ideal to have that in /etc/profile, it will work if you get rid of those single quotes.

However, if these scripts work in your interactive shell, you are already appending ~/.local/bin to your PATH somewhere else.  Consolodate these into the proper place: ~/.bash_profile.

Well, it's better than that. From a POSIX sh shell, you can define the PATH variable to have the string literal "~/.local/bin" in it, and it will NOT be used, because POSIX sh doesn't interpret that, and even bash --posix will not interpret that.

If you later start a bash shell, with that existing PATH, the bash shell will see the tilde and actually look in the current user's home directory. Because you started bash.

Stafer wrote:

Am i just supposed to do this from now? I was on manjaro cli and i ran the scripts as i did before.

Stafer wrote:

My god. People warned me about arch forums but did't expect they would be this bad.

Did they also warn you that this is not the Manjaro support forums, and you don't get to ask about other distros here?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#37 2020-07-10 15:40:24

Stafer
Member
Registered: 2020-06-11
Posts: 17

Re: .xinitrc won't run any scripts

If anyone's facing this non-issue, just ad an script in your /etc/profile.d/script.sh

export PATH="$HOME/.local/bin:$PATH"

Or whatever directory you want to add to path. After doing that you'll have to either logout or reboot.

Offline

#38 2020-07-11 14:16:35

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: .xinitrc won't run any scripts

# start some nice programs

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

This default comment in /etc/X11/xinit/xinitrc already suggests where some nice programs should be.

Offline

Board footer

Powered by FluxBB