You are not logged in.

#1 2011-04-23 11:07:18

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

(Solved) urxvtc not starting with xinitrc

Hello all,

I recently switched to urxvt and am liking it a lot.

I have setup urxvtd, and 2 urxvtc to launch at startup through .xinitrc.

Here's my .xinitrc

#!/bin/bash
##
## ~/.xinitrc
##
## Executed by startx (run your window manager from here)
##
#

# activate num lock
numlockx &

# start xscreensaver backgrounded
xscreensaver -no-splash &

# set left-pointer
xsetroot -cursor_name left_ptr &

# start unclutter
unclutter -idle 5 -noevents -root &

# start xbindkeys
xbindkeys &

# set wallpaper (start feh)
sh ~/.fehbg &

# start terminal
#roxterm --title=%s &
#roxterm --title=%s &
urxvtd -q -o -f &
urxvtc &
urxvtc &

# set window manager name (for java) 
wmname LG3D &

# run conky
conky | while read -r; do xsetroot -name "$REPLY"; done &

# launch dwm
exec /home/x33a/bin/dwm-start.sh

Till yesterday, everything was starting as expected. But, when i switched on
the computer today, my dwm didn't have 2 urxvtc windows started. I checked the
running processes, and found that all other applications from .xinitrc had
started properly, and even urxvtd was running.

Launching urxvtc manually works fine.

I restarted X 2-3 times, but the result was the same. I even restarted the
computer, but still the result was the same.

Anyone has an idea about what's going on?

Last edited by x33a (2011-04-23 12:12:31)

Offline

#2 2011-04-23 11:26:48

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: (Solved) urxvtc not starting with xinitrc

It may be as simple as urxvtd does not get started soon enough for urxvtc to make the connection. I would try adding a sleep between them, say try 5s (should be more than plenty) to start with, and if that works knock it back until it works with the least amount of time.

Offline

#3 2011-04-23 11:49:14

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

Re: (Solved) urxvtc not starting with xinitrc

Instead of such a sleep, I'd use a separate script where urxvtc is not called until urxvtd completes (hence without backgrounding urxvtd). Call that script in .xinitrc in the background.


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

#4 2011-04-23 12:11:42

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: (Solved) urxvtc not starting with xinitrc

@ jac, the sleep trick worked. But, interestingly, it was launching fine without the sleep command previously. Though, i understand that without the daemon, the clients won't launch.

@ ngoonee, your idea seems better, since using sleep adds a certain delay to the overall process. I'll give it a try.

Thanks to both of you.

Offline

#5 2011-04-23 14:39:54

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

Re: (Solved) urxvtc not starting with xinitrc

x33a wrote:

@ jac, the sleep trick worked. But, interestingly, it was launching fine without the sleep command previously. Though, i understand that without the daemon, the clients won't launch.

Race condition.


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

#6 2011-04-23 16:24:07

Meyithi
Member
From: Wirral, UK
Registered: 2009-06-21
Posts: 550
Website

Re: (Solved) urxvtc not starting with xinitrc

You are backgrounding a daemon, it's not necessary.  The following works fine for me, admittedly I only spawn one term.

# Start urxvt daemon
urxvtd -q -f -o

# Spawn a terminal
urxvtc &

The mind roams more freely in empty rooms.
dwm - colours - ncmpcpp - system
irc://irc.freenode.net:meyithi

Offline

#7 2011-04-24 06:56:48

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: (Solved) urxvtc not starting with xinitrc

Meyithi wrote:

You are backgrounding a daemon, it's not necessary.  The following works fine for me, admittedly I only spawn one term.

# Start urxvt daemon
urxvtd -q -f -o

# Spawn a terminal
urxvtc &

I thought only the wm line in xinitrc should be foregrounded, rest everything should be backgrounded.

Anyway, i switched to this script from the wiki, and added an extra urxvtc line, to spawn 2 terminals

#!/bin/sh
urxvtc "$@"
if [ $? -eq 2 ]; then
   urxvtd -q -o -f
   urxvtc "$@"
   urxvtc "$@"
fi

Last edited by x33a (2011-04-24 07:02:47)

Offline

#8 2011-04-24 12:20:05

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

Re: (Solved) urxvtc not starting with xinitrc

x33a wrote:

I thought only the wm line in xinitrc should be foregrounded, rest everything should be backgrounded.

Backgrounding means the process is instructed to start and then immediately 'ignored', with the next process starting almost immediately. Obviously that causes a problem in your case. As I said, a race condition.

Rules like 'everything should be backgrounded' need more understanding. Yes, in general if you run something in xinitrc it should be backgrounded (or everything after that won't be run till the process exits) but urxvtd, like most daemons, forks off and returns control to the caller.


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

#9 2011-04-24 18:09:31

hellomynameisphil
Member
From: /home/phil/Vancouver
Registered: 2009-10-02
Posts: 257
Website

Re: (Solved) urxvtc not starting with xinitrc

urxvtcd

Offline

#10 2011-04-24 19:01:16

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: (Solved) urxvtc not starting with xinitrc

edit: nvm, I missed the previous post in which you've already discovered the script

Last edited by Xyne (2011-04-24 19:02:27)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#11 2011-04-24 19:05:11

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: (Solved) urxvtc not starting with xinitrc

Xyne wrote:

edit: nvm, I missed the previous post in which you've already discovered the script

Anyway thanks, i'm also using your clipboard script smile

Offline

Board footer

Powered by FluxBB