You are not logged in.

#1 2020-06-11 14:18:59

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

.xinitrc won't run any scripts

I'm on the fresh install of arch linux. .xinitrc is able to start dwm and start the sxhkd, but it won't run any scripts, not even a simple "xsetroot -name "hello" script.

I installed xorg-xinit and did everything described on the wiki.
cp /etc/X11/xinit/xinitrc ~/.xinitrc

Last edited by Stafer (2020-06-11 15:18:46)

Offline

#2 2020-06-11 14:20:49

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: .xinitrc won't run any scripts

Post it.

I'm guessing you're putting it in the wrong place in the file.

Offline

#3 2020-06-11 14:23:35

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

Re: .xinitrc won't run any scripts

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# 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

statusbar &
# hello &
sxhkd &
dwm

Last edited by Stafer (2020-06-11 14:33:47)

Offline

#4 2020-06-11 14:29:44

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 341
Website

Re: .xinitrc won't run any scripts

This ~/.xinitrc could use a wee bit of editing, still try exec dwm as last line,

Offline

#5 2020-06-11 14:33:14

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

Re: .xinitrc won't run any scripts

I've already tried that without any success.

Edit: the scripts are working fine. They're in my ~/.local/bin which is in the PATH.

I can run the scripts without any issues from the terminal.

Last edited by Stafer (2020-06-11 14:34:50)

Offline

#6 2020-06-11 14:34:03

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: .xinitrc won't run any scripts

You don't have that running xsetroot. What's the problem?

Offline

#7 2020-06-11 14:38:34

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

Re: .xinitrc won't run any scripts

The problem isn't the xsetroot but that it won't run any scripts. That was just an example. Sorry if i wasn't clear.
I was just saying that it won't even run this:

#!/bin/bash

xsetroot -name "hello"

What i want to run is just this:

#!/bin/bash
xinput set-prop 12 "libinput Tapping Enabled" 1
xinput set-prop 12 "libinput Natural Scrolling Enabled" 1
statusbar &

Last edited by Stafer (2020-06-11 14:39:10)

Offline

#8 2020-06-11 14:39:28

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: .xinitrc won't run any scripts

And *how* are you trying to run these?

Offline

#9 2020-06-11 14:42:17

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

Re: .xinitrc won't run any scripts

By adding "autostart &" before "exec dwm".

The example above has "statusbar" instead of "autostart" because i'm just trying various things to see what happens. But nothing happens.

Edit: i've tried putting exec autostart & but the wiki says exec is ignored so obviously that didn't work.

Last edited by Stafer (2020-06-11 14:45:22)

Offline

#10 2020-06-11 14:44:40

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: .xinitrc won't run any scripts

Forget it. I'm done playing 20 questions. Post full information and maybe someone else will come along and attempt to help.

Offline

#11 2020-06-11 14:48:29

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

Re: .xinitrc won't run any scripts

Stafer wrote:

By adding "autostart &" before "exec dwm".

And what the hell is "autostart"?  (edit: is that the name of your script?  We can't read your mind).

If you put those scripts in xinitrc (before any 'exec' line) they will run.  But you seem to expect xinit to read your mind and know that you want things to run.  That will not happen.

Stafer wrote:

What i want to run is just this: ...

Then why haven't you put that in your xinitrc?

Last edited by Trilby (2020-06-11 14:51:53)


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

Offline

#12 2020-06-11 14:50:45

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

Re: .xinitrc won't run any scripts

Here since you can't just guess. That's exactly what i was doing.

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# 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

autostart &
sxhkd &
exec dwm

The problem is that ~/.xinitrc won't run any scripts no matter the name.

Last edited by Stafer (2020-06-11 14:53:45)

Offline

#13 2020-06-11 14:53:28

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

Re: .xinitrc won't run any scripts

Stafer wrote:

~/.xinitrc is just:

cp /etc/X11/xinit/xinitrc ~/.xinitrc

That would not be expected to work.  Xinit cannot read your mind any better than we can.  You need to put the commands you want to run into xinitrc.

EDIT: ok, you've just editted your post and included completely contradictory information to what was there 30 seconds ago.  I give up too.

Last edited by Trilby (2020-06-11 14:55:44)


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

Offline

#14 2020-06-11 14:55:45

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

Re: .xinitrc won't run any scripts

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

Can you see this:

autostart &
sxhkd &
exec dwm

At the end? I'm not telling it to read my mind, i'm telling to exactly what to do but it isn't doing that.

Offline

#15 2020-06-11 14:57:12

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

Re: .xinitrc won't run any scripts

I can see it now.  I couldn't see it when that post had something else.  You also haven't clearly said what "autostart" is.  I guessed it was the three line script you posted - but that's not been entirely clear.

How do you start x?


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

Offline

#16 2020-06-11 14:57:21

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

Re: .xinitrc won't run any scripts

Trilby wrote:
Stafer wrote:

~/.xinitrc is just:

cp /etc/X11/xinit/xinitrc ~/.xinitrc

That would not be expected to work.  Xinit cannot read your mind any better than we can.  You need to put the commands you want to run into xinitrc.

EDIT: ok, you've just editted your post and included completely contradictory information to what was there 30 seconds ago.  I give up too.

The point of me saying that i cp /etc/X11/xinit/xinitrc ~/.xinitrc was to say that i didn't fuck up the .xinitrc since i did what wiki said.

Offline

#17 2020-06-11 14:58:32

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,373

Re: .xinitrc won't run any scripts

This last file you've shown now should relevantly work, by what measure do you surmise that it doesn't? This last file you've shown now should relevantly work, by what measure do you surmise that it doesn't? But really, as you are spawning a seperate shell here you really should not add a & to the autostart. That will be killed as soon as the exec is reached, let that run normally.

Last edited by V1del (2020-06-11 15:01:03)

Offline

#18 2020-06-11 15:00:26

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

Re: .xinitrc won't run any scripts

V1del wrote:

you really should not add a & to the autostart

Better yet, just put the commands you want to run in .xinitrc rather than some additional script.


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

Offline

#19 2020-06-11 15:05:24

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

Re: .xinitrc won't run any scripts

How *exactly* do you start your X11 session?
xinit, startx, GDM, …?

Online

#20 2020-06-11 15:06:04

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

Re: .xinitrc won't run any scripts

V1del wrote:

This last file you've shown now should relevantly work, by what measure do you surmise that it doesn't? This last file you've shown now should relevantly work, by what measure do you surmise that it doesn't? But really, as you are spawning a seperate shell here you really should not add a & to the autostart. That will be killed as soon as the exec is reached, let that run normally.

It still won't run the script. I've already tried every way possible but just won't run any script.

Better yet, just put the commands you want to run in .xinitrc rather than some additional script.

I'm running dwm so my autostart script also runs my statusbar script. If i have to do what you said i'd have to write the statusbar script in my .xinitrc.

Edit: Even by removing statusbar from autostart and just putting it in .xinitrc doesn't work.

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

Offline

#21 2020-06-11 15:06:36

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

Re: .xinitrc won't run any scripts

seth wrote:

How *exactly* do you start your X11 session?
xinit, startx, GDM, …?

I just use startx.

Offline

#22 2020-06-11 15:18:39

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

Re: .xinitrc won't run any scripts

Does

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap

date > /tmp/startx.date

…

generate that file w/ the date in it?

Online

#23 2020-06-11 15:20:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,373

Re: .xinitrc won't run any scripts

What's in your statusbar script? Why do you hide that information? We are 22 posts in and no one knows what is actually supposed to be executed. I'm fairly certain that the xinput lines will have ran.

Offline

#24 2020-06-11 15:22:01

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

Re: .xinitrc won't run any scripts

Yes, it does.

[ktl@pkl ~]$ cat /tmp/startx.date
Thu Jun 11 17:20:21 CEST 2020

Offline

#25 2020-06-11 15:23:36

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

Re: .xinitrc won't run any scripts

Sorry, didn't want to hide just thought since it can be launched from the terminal without errors it won't be the cause of the problem.

#!/bin/bash

print_bat(){
        capacity=$(cat /sys/class/power_supply/BAT0/capacity)
        batstatus=$(cat /sys/class/power_supply/BAT0/status)
        if [ $batstatus == "Charging" ]; then
                echo "$capacity+"
        else
                echo "$capacity"
        fi
}

print_date(){
        date "+%r "
}

while true; do
        xsetroot -name "Bat: $(print_bat) | $(print_date)"
        sleep 1
done

Offline

Board footer

Powered by FluxBB