Xfce Forum

Sub domains
 

You are not logged in.

#1 2012-10-29 18:48:15

shakebake
Member
Registered: 2012-05-14
Posts: 51

Can't get ~/.bachrc and ~/.bash_logout to work

hi

I am trying to get some commands to run at logout and at login.
Specifically:

At logout, I want to save my desktop icon settings by doing this with ~/.bash_logout:
   mkdir -p ~/.config/xfce4/desktop.bak
   cp -f ~/.config/xfce4/desktop/icons* ~/.config/xfce4/desktop.bak


and at login, I want to load the saved icon positions back in using ~/.bashrc:
   cp -f ~/.config/xfce4/desktop.bak/icons* ~/.config/xfce4/desktop


For some reason, ~/.bash_logout & ~/.bashrc will not run.

Offline

#2 2012-10-29 19:06:25

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: Can't get ~/.bachrc and ~/.bash_logout to work

I'm pretty sure that .bashrc is loaded each time you open an Terminal/console, if you ever open one ... I think it's better if you put the copy code in an autostart script so it will be executed once during login.
For .bash_logout, normally it is ran when logout, but that was in older time where you use console only. Now, with Xorg, session manager, etc ... I don't know if it is really loaded when you logout from Xfce ... Plus, it may depend on how your linux distribution configured it.
I remember that on Fedora 8 (once upon a time ... lol), .bash_login is not loaded when you login graphically. May be it's a bug but no one ever fix it.

PS: stupid question but ... make sure that your default shell is bash :-p

Last edited by angstrom (2012-10-29 19:07:19)


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#3 2012-10-29 21:18:26

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

I think I might try to make a startup script to put in start-up, so that they will load in as saved, and I will just have to
have a script on my desktop (  cp -f ~/.config/xfce4/desktop/icons* ~/.config/xfce4/desktop.bak ) to save the icons
whenever I get them the way I want.

~Or, I have a script that I can put on my desktop, to either:
sudo chattr +i ~/.config/xfce4/desktop/icons*  or   sudo chattr -i ~/.config/xfce4/desktop/icons*
to "lock" or "unlock" the icon files. Unlock, get them the way I want, then lock them back.
(Except, one would have to be a sudo user to do it)

I read on some post somewhere that there was a new desktop manager being used for Ubuntu  ->   /etc/lightdm
and that settings would have to work with lightdm to get bascrc and bash_logout to work on the desktop.

Offline

#4 2012-10-29 21:40:13

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

Well, I can't even get a script to run in "Application Autostart" in "Session and Startup"

so back to base 1

Offline

#5 2012-10-29 22:07:32

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: Can't get ~/.bachrc and ~/.bash_logout to work

About .bashrc and .bash_logout, you will have better change on your distriib forum.
About "I can't even get a script to run" : what do you mean ?? You don't have the add button ? Don't do anything ?


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#6 2012-10-29 22:50:34

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

I mean that I have this:
cp -f ~/.config/xfce4/desktop/icons* ~/.config/xfce4/desktop.bak
in a file in my folder that is executable, and I have it checked in the
"Settings/Session and startup/Application Autostart"
but it will not execute on login

Offline

#7 2012-10-29 22:59:53

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

I miss-typed.
This is the script file, but it won't load on log in.
cp -f ~/.config/xfce4/desktop.bak/icons*   ~/.config/xfce4/desktop

My desktop icon files are saved in folder desktop.bak and upon login I want them to be loaded in folder desktop,
It is checked, but does not run.

Offline

#8 2012-10-30 10:11:42

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: Can't get ~/.bachrc and ~/.bash_logout to work

To make sure that the script is not run, put something like "touch /tmp/myscript" in your startup script and check if the file /tmp/myscript is created or not (don't forget to delete it afterward).
Otherwise, errors are logged in ~/.xsession-errors


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#9 2012-10-30 10:41:18

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

I have tried putting these in the start-up as a command:

${HOME}/bin/bash_login
~/bin/bash_login
cody/bin/bash_login

I can't get anything to work.

bash_login does nothing except copy a file from one directory to another.
It works fine when I click on it with the mouse, but just won't work on auto-startup.

Offline

#10 2012-10-30 10:45:26

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: Can't get ~/.bachrc and ~/.bash_logout to work

Try this script :

#!/bin/bash

touch /tmp/running

Make it executable. Make it run on startup. Delete /tmp/running if exist. Re-login.
Does /tmp/running appear ?

Last edited by angstrom (2012-10-30 10:54:00)


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#11 2012-10-30 12:41:06

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

/tmp/running appears when I run the script manually, but it does not appear when I have it in the application-autostart and log off then log back on.

( also, I am using 12.04.01 with 4.8 )

Offline

#12 2012-10-30 18:17:17

Pindakoe
Member
From: NL
Registered: 2003-11-26
Posts: 116

Re: Can't get ~/.bachrc and ~/.bash_logout to work

.bash_logout will not run if you just login into Xfce from GDM (or similar like KDM, XDM). It will work if you login to a console or virtual terminal. The way to get this working in Xfce is by modifying xinitrc. You can do this either by modifying the system-wide version at/etc/xdg/xfce4/xinitrc or by creating a personalised xinitrc and file that in ~/.config/xfce4/.

Mine reads as follows, starting about two thirds down, above the note saying 'IMPORTANT NOTE'

# Run xfce4-session if installed
if which xfce4-session >/dev/null 2>&1; then
    xfce4-session

    if test "$ssh_agent_kill_cmd"; then
        echo "running '$ssh_agent_kill_cmd'"
        eval "$ssh_agent_kill_cmd"
    fi
   /home/username/.bash_logout
    exit 0
fi

Offline

#13 2012-10-30 23:50:48

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Can't get ~/.bachrc and ~/.bash_logout to work

I would prefer the personalised "xinitrc" file in  ~/.config/xfce4/
Would it be posible to add a ".bash_login'" at the beginning of this file, so as to
where it would run before the start of the session?

If so, this would allow the desktop icon settings that were saved from the previous
logout ( via .bash_logout ) to be loaded back in.  The xfce I am using ( 4.8 ) does not
remember the desktop icon configuration at log-in from the setting at previous log-out.

Offline

Board footer

Powered by FluxBB