You are not logged in.

#1 2014-05-19 20:19:12

krax
Member
From: Tory;Mi
Registered: 2010-06-26
Posts: 62
Website

Making DE/WM in ~/.xinitrc

Hello;
I want to be able to start several WM from TTY (i.e xinit musca). So this is my ~/.xinitrc :

[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
case $1 in
awesome)
	 /usr/home/avalon/awesomeexec &
	exec ck-launch-session dbus-launch --sh-syntax --exit-with-session awesome
	;;
echinus)
	 /usr/home/avalon/echinusexec &
	exec ck-launch-session dbus-launch --sh-syntax --exit-with-session echinus
	;;
evilwm)
	 /usr/home/avalon/evilwmexec &
	exec ck-launch-session dbus-launch --sh-syntax --exit-with-session evilwm -snap 10 -term sakura -nosoliddrag -fn xft:PragmataPro:pixelsize=13
	;;
goomwwm)
	exec ck-launch-session dbus-launch --sh-syntax --exit-with-session goomwwm
	;;


esac

The only problem is the first line in each case. I use them to start some apps. for example evilwmexec :

#!/bin/sh

#xsetroot -cursor_name left_ptr &
xbindkeys &
compton -cCGfF -o 0.38 -O 200 -I 200 -t 0 -l 0 -r 3 -D2 -m 0.88 &
feh --bg-scale ~/.bg/fruits.png &
wmtime &

but doing xinit evilwm starts evilwm but it doesn't start the evilwmexec.
Plz share what is wrong and if I could write my xinitrc in a better way

Last edited by krax (2014-05-19 20:20:54)

Offline

#2 2014-05-19 20:22:55

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

Re: Making DE/WM in ~/.xinitrc

I honestly don't even know what to *expect* to happen when you combine `exec` with `&` to background the process.

Get rid of the first exec in each case statement.  And don't bother backgrounding it either.  In fact you could just source it rather than calling it as a subprocess:

...
  awesome)
    . ~/awesomeexec
    exec ck-launch....

In fact, is there any reason to keep these as separate files?  You could just include those commands in each case statment - or any that are shared across all of them can be put before the case statement.

Also, I don't think there is any reason to use ck-launch or dbus-launch anymore - that is if you are using systemd.

Last edited by Trilby (2014-05-19 20:24:16)


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

Offline

#3 2014-05-19 20:31:26

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Making DE/WM in ~/.xinitrc

As Trilby says, you could also learn how to put the things you now start in "XXwmexec" instead in .xinitrc (all of the things you start in evilwmrc can be done directly).

Learn how to use the native startup functions of the window managers for the rest. (edit) as Inxsible says below.

And also as Trilby says, most things in xinitrc don't need to be backgrounded, and only one (start the window manager) should be used with "exec."

And if you are using evilwm from the AUR (you must be) most of the options you are starting on the command line can be specified in ~/.evilwmrc. See "man evilwm" for more details.

Last edited by 2ManyDogs (2014-05-19 20:33:03)

Offline

#4 2014-05-19 20:32:09

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Making DE/WM in ~/.xinitrc

to autostart apps, I would just use the WM's own config file.

for eg. i3 has its config file from which you can start your apps.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#5 2014-05-19 20:35:55

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

Re: Making DE/WM in ~/.xinitrc

To clarify, there's nothing wrong with backgrounding many things in xinitrc.  But backgrounding a script which then backgrounds all it's commands that just seemed odd.  I think compton may need to be backgrounded (once).  Feh and xbindkeys it should not matter either way.  I'm not sure what wmtime is, so I can't comment on that one.


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

Offline

#6 2014-05-19 20:47:07

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Making DE/WM in ~/.xinitrc

Trilby wrote:

To clarify, there's nothing wrong with backgrounding many things in xinitrc.

True. But many things people often background in .xinitrc don't need to be, and sometimes the backgrounding causes timing issues. Sorry if I used "as Trilby says" inappropriately.

Offline

#7 2014-05-19 20:57:07

krax
Member
From: Tory;Mi
Registered: 2010-06-26
Posts: 62
Website

Re: Making DE/WM in ~/.xinitrc

Ok
1. "you could also learn how to put the things you now start in "XXwmexec" instead in .xinitrc (all of the things you start in evilwmrc can be done directly)." How exactly?
2. and tell me if I got it right. I should remove the first exec in each instance and all the backgroundings (yes?) What about backgroundings in **wmexec?
Thanks

Offline

#8 2014-05-19 21:05:49

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Making DE/WM in ~/.xinitrc

krax wrote:

Ok
1. "you could also learn how to put the things you now start in "XXwmexec" instead in .xinitrc (all of the things you start in evilwmrc can be done directly)." How exactly?
2. and tell me if I got it right. I should remove the first exec in each instance and all the backgroundings (yes?) What about backgroundings in **wmexec?
Thanks

"man evilwm"

an example ~/.evilwmrc (not mine, but this works)

term urxvt 
fg red 
fn -*-ohsnap-medium-*-*-*-12-*-*-*-*-*-*-*

.xinitrc (not to say this is the only way, but it works)

#!/bin/sh
xrdb ~/.Xresources
xsetroot -cursor_name left_ptr
xbindkeys
xsetroot -solid "#2a2a37"

exec evilwm

Last edited by 2ManyDogs (2014-05-20 03:23:49)

Offline

#9 2014-05-19 21:06:17

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Making DE/WM in ~/.xinitrc

Just so you know, krax, there is actually something like this available from the AUR, called CDM. It's just a bash script that presents you with a menu to choose from multiple installed environments, and then reads ~/.xinitrc for all your startup processes/applications. You could consider installing that, or just downloading the source for some insight.

Offline

#10 2014-05-20 20:31:12

krax
Member
From: Tory;Mi
Registered: 2010-06-26
Posts: 62
Website

Re: Making DE/WM in ~/.xinitrc

So if I want to go with **wmexec file for WMs without start-up function; Should I use & in that file or not?

Offline

#11 2014-05-20 20:32:17

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

Re: Making DE/WM in ~/.xinitrc

You can use "&" in those files (but it is still rarely helpful), just don't use it when you execute/source those files from within xinitrc.

Last edited by Trilby (2014-05-20 20:32:39)


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

Offline

Board footer

Powered by FluxBB