You are not logged in.
Pages: 1
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
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
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
# pacman -Qo /usr/bin/startx
/usr/bin/startx is owned by xorg-xinit 1.2.1-1
Offline
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
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
Why can't you use ~/.bashrc? ~/.login may or may not also work.
Offline
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.
Last edited by Chimera (2010-04-08 03:50:24)
Offline
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
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
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
Last edited by Chimera (2010-04-08 15:55:07)
Offline
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
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
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
Hehe this thread is getting comical...it really shouldn't be that hard:
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
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
//github/
Offline
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
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
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
Pages: 1