You are not logged in.
Pages: 1
I want to start both i3 and cinnamon.
This is my .xinitrc
#! /bin/bash
# Keeping i3 as default
session=${1:-i3}
case $session in
cinnamon ) exec cinnamon-session;;
i3|i3wm ) exec i3;;
# No known session, try to run it as command
*) exec $1;;
esac
Now,
I can log in on tty1 and start i3 with:
xinit i3 -- :0 vt1
and log in again with the same user on tty2 and start cinnamon with:
xinit cinnamon -- :1 vt2
Can I achieve the same with a modified .xinitrc without passing the flags everytime manually?
Also I tried to read this "Back to Basics With X and systemd", but did not understand this.
#!/bin/bash
TTY=${TTY:-$(tty)}
TTY=${TTY#/dev/}
if [[ $TTY != tty* ]]; then
printf '==> ERROR: invalid TTY\n' >&2
exit 1
fi
printf -v vt 'vt%02d' "${TTY#tty}"
xinit -- "$vt" "$@"
So here xinit is run. So if I want to run i3, should I do this -
xinit i3 -- "$vt" "$@"
This is not working.
Offline
What stops you from adding the $TTY logic to your .xinitrc and wrap it in some "case $TTY in" construct and start the whole thing with startx?y
Offline
This is my working .xinitrc
#! /bin/bash
# Keeping i3 as default
session=${1:-i3}
case $session in
cinnamon ) exec cinnamon-session;;
i3|i3wm ) exec i3;;
# No known session, try to run it as command
*) exec $1;;
esac
So now, when I do
xinit i3 -- :0 vt1
It runs.
When I put only this in the script, and just startx, it does open i3, just a black screen
#!/bin/bash
TTY=${TTY:-$(tty)}
TTY=${TTY#/dev/}
if [[ $TTY != tty* ]]; then
printf '==> ERROR: invalid TTY\n' >&2
exit 1
fi
printf -v vt 'vt%02d' "${TTY#tty}"
xinit i3 -- "$vt" "$@"
Does the .xinitrc require exec to be in the script? I guess the second .xinitrc does not work as it run
xinit i3 -- "$vt" "$@"
instead of
exec i3
If it does not run without the case statements and when I just try with i3, there is no use trying "case $TTY in" construct.
Offline
You do not need exec in an xinitrc, it's just handy to remove the extra process. But you definitely can't launch X from within X, and worse yet trying to do so recursively is crazy.
Did you read AWebb's advice? I was going to suggest the exact same thing he did after I read your first post.
Also, while it's not really harmful, there is no need of the extra process to get the tty number from /usr/bin/tty then trim it, just use $XDG_VTNR
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
It looks like you cannot set $DISPLAY in your .xinitrc. How would you pass $TTY to the X server?
Untested:
#!/bin/bash
startx $1 -- :$((XDG_VTNR-1)) vt${XDG_VTNR}
(I think you just put $@ at the wrong place.)
Also where are my input devices (I did startx i3 -- :1 on vt2)? I had to reset
Offline
It looks like you cannot set $DISPLAY in your .xinitrc. How would you pass $TTY to the X server?
Untested:
#!/bin/bash startx $1 -- :$((XDG_VTNR-1)) vt${XDG_VTNR}
(I think you just put $@ at the wrong place.)
Also where are my input devices (I did startx i3 -- :1 on vt2)? I had to reset
Yes. I think this is true "cannot set $DISPLAY in your .xinitrc"
If you see my working .xinitrc what I currently do to get things running,
When I only want to start one WM/DE -
On tty1, xinit i3 -- :0 vt1 OR xinit cinnamon -- :0 vt1
When I want to start two WM/DE -
On tty1, xinit i3 -- :0 vt1
AND
On tty2, xinit cinnamon -- :1 vt2
Offline
If you see my working .xinitrc what I currently do to get things running,
When I only want to start one WM/DE -
On tty1, xinit i3 -- :0 vt1 OR xinit cinnamon -- :0 vt1When I want to start two WM/DE -
On tty1, xinit i3 -- :0 vt1
AND
On tty2, xinit cinnamon -- :1 vt2
This thread is a little messy/confusing. Let's see if I understand the situation: this is what you do currently and it works, but you wanted to do this "without passing the flags everytime manually". If you use startx instead of xinit, you can simply do `startx i3` and `startx cinnamon` on those ttys. Would that work for you?
Offline
Pages: 1