You are not logged in.

#1 2010-04-08 01:44:43

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

[SOLVED] is there a .loginrc?

I'm sure this is somewhere, but I've looked and can't find it
There's a lot of things I'd like to do exactly at login time--is there a .loginrc or something like it?

I'd like to be able to edit one file to change what window manager I use, and I'd also like to be able to have X start automatically when I login from terminal--I want to move away from graphical login managers

thx in advance

Last edited by Chimera (2010-04-10 03:03:57)

Offline

#2 2010-04-08 01:47:41

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: [SOLVED] is there a .loginrc?

Well, http://wiki.archlinux.org/index.php/Start_X_at_Boot  has some information on directly booting into X.
As far as starting a window manager and everything, using ~/.xinitrc is pretty handy.  http://wiki.archlinux.org/index.php/Xinitrc

Offline

#3 2010-04-08 02:08:52

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

thanks! the first wiki had exactly what I wanted--/etc/profile. Good thing that works for zsh.

one thing though--I don't have startx, and "pacman -Ss | grep startx" doesn't show anything. Any ideas why?

Offline

#4 2010-04-08 02:39:14

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: [SOLVED] is there a .loginrc?

# pacman -Qo /usr/bin/startx
/usr/bin/startx is owned by xorg-xinit 1.2.1-1

Offline

#5 2010-04-08 02:51:17

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

okay, I wasn't able to login for a while (screwed around with /etc/profile), but I have what I want now!

I added this line to /etc/profile: ". $HOME/.loginrc". Now I'll just have .loginrc define WM and startx, and startx will ". $WM"

Offline

#6 2010-04-08 03:33:05

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

okay never mind! that didn't work!
if anyone is still reading this, here's my new .xinitrc and .loginrc

.loginrc:
     WM=/usr/bin/openbox-session
     export WM
     PATH=$PATH:~/scripts/
     startx

.xinitrc:
     "exec dbus-launch --exit-with-session $WM"

Offline

#7 2010-04-08 03:43:02

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

Re: [SOLVED] is there a .loginrc?

Why can't you use ~/.bashrc? ~/.login may or may not also work.

Offline

#8 2010-04-08 03:49:57

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

the problem with .zshrc (I'm using z-shell) is that whenever I open a terminal, it will run that file. I specifically want a script that will be run whenever I login, and only when I login, so that it will start my x session. I also tried .login--zsh/bash/the kernel nothing pays any attention to it.

and .loginrc is pretty cool. However, whenever I open a terminal, it seems to try running x, because it tells me there was a fatal error because an xserver was already running. I'm working on it. wink

Last edited by Chimera (2010-04-08 03:50:24)

Offline

#9 2010-04-08 04:07:17

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

Oh wait.../etc/profile is run whenever I open a terminal too...? Is it? It seems to
I have a line in /etc/profile that echo's $USER, and whenever I open a terminal it prints my user name SO...

are there ANY files that are only ever run once--when you login? What I have works, but...it tries to start an xsession whenever I open a terminal...which could be done in .zshrc......

Last edited by Chimera (2010-04-08 04:07:37)

Offline

#10 2010-04-08 05:50:45

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: [SOLVED] is there a .loginrc?

Chimera wrote:

are there ANY files that are only ever run once--when you login? What I have works, but...it tries to start an xsession whenever I open a terminal...which could be done in .zshrc......

You really should use .xinitrc, because it does exactly what you want and even
without modifying system-wide config files like /etc/profile. Just put the
commands you want to run exactly once for each login before the line that starts
your window manager.

P.S.: Nice Futurama quote in your sig. I'll give you one, too:

His Neutralness, in the face of death: "If I should die, tell my wife 'Hello'."

Offline

#11 2010-04-08 15:54:13

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

the_isz wrote:

You really should use .xinitrc, because it does exactly what you want and even
without modifying system-wide config files like /etc/profile. Just put the
commands you want to run exactly once for each login before the line that starts
your window manager.

But I specifically want a file that will run startx when I login to the virtual terminal, which will then run .xinitrc. Whatever I put in .xinitrc will still only be run when either I or a login manager starts it, right? I need a file that will startx for me. I've heard something about .bash_profile/.zsh_profile, so I might check that out.

Oh, and thanks for the quote. I'd forgotten about that one wink

Last edited by Chimera (2010-04-08 15:55:07)

Offline

#12 2010-04-08 16:20:00

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: [SOLVED] is there a .loginrc?

Chimera wrote:

But I specifically want a file that will run startx when I login to the virtual terminal, which will then run .xinitrc. Whatever I put in .xinitrc will still only be run when either I or a login manager starts it, right? I need a file that will startx for me. I've heard something about .bash_profile/.zsh_profile, so I might check that out.

Oh, and thanks for the quote. I'd forgotten about that one wink

So logging in and just saying 'startx' will really be too much of a hassle?
Hmm... Then I don't think there'll be a 'clean' solution. Differentiating
between a virtual terminal and a... well... graphical virtual terminal is not
that easy. It would be a design flaw if it was^^

You might consider checking for the DISPLAY variable in your .bashrc and execute
your startx script only if it exists.

Another Futurama quote:

Fry: So there's an infinite number of parallel universes?
Farnsworth: No, just the two.

Offline

#13 2010-04-08 16:31:28

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] is there a .loginrc?

I'm not quite sure what exactly you would want, so bear with me please. First I will describe how to have x started automatically at bootup without asking for a password (this is what I do). Then I will suggest a way of modding that so it will ask for a password before starting x. This is all based on the wiki article linked above.

First, my .xinitrc is something like,

#!/bin/bash

# Do preliminary stuff here.

# window manager, last thing called
exec xmonad

Then, in inittab x:5:once:/bin/su username -l -c "/bin/bash --login -c startx >/dev/null 2>&1". Replace username with user account name.

It doesn't ask for a password because su is being executed as root. If you'd want it to, then you can add a second su; something like x:5:once:/bin/su username -l -c "su username -c '/bin/bash --login -c startx >/dev/null 2>&1'".

etc.

Last edited by fsckd (2010-04-08 16:31:46)


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#14 2010-04-08 18:38:41

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: [SOLVED] is there a .loginrc?

Hehe this thread is getting comical...it really shouldn't be that hard:

zsh(1) man page wrote:

Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.

Just drop something like this into ~/.zprofile or ~/.zlogin (create the file if necessary):

    xinit >& ~/.myXLog
    logout

thayer williams ~ cinderwick.ca

Offline

#15 2010-04-08 19:02:59

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] is there a .loginrc?

ok i skimmed...

user wants to start x when he logs into a tty the first time.  doesn't want to put startx into his .zshrc b/c that gets run at every new terminal so that doesn't make sense.

does that sum it?

if so, here's the last bit of my bashrc which does exactly this:

if [ $(tty) = /dev/tty1 ] && [ -z "$DISPLAY" ]; then
  startx
  logout
fi

Offline

#16 2010-04-08 19:24:55

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] is there a .loginrc?

Awesome trick: testing /dev/pts/0

Put this in .bash_login for Bash or .zlogin for Zsh:

test -c /dev/pts/0 || startx

(I use `startx > /dev/null 2>&1 &` for startx, so the tty remains usable.)

Does exactly what you expect. Start X, if it isn't already running, when you log in.
No ugly messing around with inittab.


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#17 2010-04-10 03:02:56

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [SOLVED] is there a .loginrc?

Perfect! My internet was down for a bit so it took me a while to get these replies, but this is what I'm looking for. The problem was I tried .zshlogin/etc instead of .zlogin/etc
thx again.

Offline

#18 2010-04-10 09:34:33

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] is there a .loginrc?

Check the man pages; it's where i found the info myself.
Zsh has about a dozen man pages on different topics, plus one called 'zshall' that has all of them merged into one page (nearly 17'000 lines!) so you can use a simple search to find what you want. Although the overview page `man zsh` already tells you about the startup files.


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

Board footer

Powered by FluxBB