You are not logged in.

1

Tuesday, June 13th 2006, 11:55am

Run script at KDE login

I'm using an encrypted home folder which has to be mounted before it can be accessed. I'd like to run a script at KDE login after the user has been authenticated but before KDE tries to access the home directory.

The script should ask for a password and mount the home folder. (The best thing obviously would be if I could use the login password to unlock my home directory.)
Where should I put the script that it is called at the right time?

I also need another script to run at logout, which unmounts the home older again. Where should I put that?

Thanks,

Lotharster

bram85

Professional

Posts: 948

Location: Eindhoven

Occupation: Software Engineer

  • Send private message

2

Thursday, June 15th 2006, 3:29pm

RE: Run script at KDE login

You could modify the startkde script.
Bram Schoenmakers
KDE Netherlands (www.kde.nl)

noranthon

Beginner

Posts: 8

Location: Australia

  • Send private message

3

Saturday, July 1st 2006, 4:04am

startup on login

I suppose it's in order to tag my question to this thread rather than starting a new thread.

I want bittorrent to start when I logon to kde. I just want it to start so that I can contribute to seeding and I can forget to start it myself.

Gnome evidently has a gui command which enables a user to add a startup command and even that other OS has such a method but kde, it seems, cannot cope with the concept. In another forum, it was suggested that I create a file in the user's home directory called .xinitrc. I finally settled on the following:

Quoted

#!/bin/bash
#
/usr/bin/bittorrent
I tried first without the path name which is not used in the menu shortcut. With or without, the file was ignored by kde.

I've also tried placing a symlink in the .kde/Autostart folder. No start. Today I looked at the .xsession-errors file. .xinitrc gets no mention but the symlink does:

Quoted

File "/home/terry/.kde/Autostart/bittorrent", line 3809, in ?
d = DownloadInfoFrame(config,TorrentQueue.ThreadWrappedQueue(torrentqueue))
File "/home/terry/.kde/Autostart/bittorrent", line 2727, in __init__
self.mainwindow = Window(gtk.WINDOW_TOPLEVEL)
File "/usr/lib/python2.4/site-packages/BitTorrent/GUI.py", line 287, in __init__
IconMixin.__init__(self)
File "/usr/lib/python2.4/site-packages/BitTorrent/GUI.py", line 280, in __init__
icon16 = gtk.gdk.pixbuf_new_from_file_at_size(iconname, 16, 16)
gobject.GError: Failed to open file '/home/terry/.kde/Autostart/images/bittorrent.ico': No such file or directory
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/home/terry/.kde/Autostart/bittorrent", line 3799, in btgui_exit_gtk
mainloop.run()
File "/home/terry/.kde/Autostart/bittorrent", line 3767, in run
self.mainwindow.traythread.start()
AttributeError: 'NoneType' object has no attribute 'traythread'

There seems to be a dearth of information on this subject. The documentation on the kde website deals with system files like startkde and kdeinit. This is something that's required only at the user level.

Any ideas, anyone?

bram85

Professional

Posts: 948

Location: Eindhoven

Occupation: Software Engineer

  • Send private message

4

Saturday, July 1st 2006, 7:24pm

RE: startup on login

You may want to specify the work dir of the torrent client in the *.desktop file located in your Autostart folder. Try adding the following line:

Source code

1
Path=/path/to/workdir
Bram Schoenmakers
KDE Netherlands (www.kde.nl)

noranthon

Beginner

Posts: 8

Location: Australia

  • Send private message

5

Sunday, July 2nd 2006, 2:35pm

Thank you, bram85. I regret that I did not explain myself adequately. The two methods I tried were suggested by users of distros other than the one I am using at present, Mandriva 2006.

The first method involves placing a symlink in ~/.kde/Autostart. That method seems to be suitable only for kde applications, possibly only those which minimise to a tray icon. I have used it for some time to have klipper (the clipboard extension) start on login.

The second method is the script named .xinitrc, which is placed in the user home directory, not in the Autostart folder. That method does not work in Mandriva 2006, at least.

What does work is the method to which you allude, namely, placing a script in the Autostart folder. I've just experimented further with that. My understanding is that, if a command or its symlink is present in /usr/bin, the path need not be specified. That proves to be correct. The amended wording of the script is:

Quoted

#!/bin/bash
#
#/usr/bin/bittorrent
bittorrent

That has the desired effect. I struggled to get it to work because I forgot to set permissions appropriately: rwx rx rx. Thanks for your reply.

Incidentally, adding the command to the user's file .bash_profile seemed to call bittorrent before kde had finished loading and in a form unaffected by settings in the user directory.

EDIT: BTW, a similar question to the OP is asked in this thread which I crashed as well.

This post has been edited 1 times, last edit by "noranthon" (Jul 2nd 2006, 2:50pm)


6

Monday, July 31st 2006, 5:40pm

RE: Run script at KDE login

I seemed to have made a program start on login by dragging the executive file it to the .kde/Autostart folder creating a symbolic link using konqueror. It gets listed in the TOP command, so it must be ok.

Of course if I log into Icewm it won't work.

This post has been edited 2 times, last edit by "thulemanden" (Jul 31st 2006, 5:59pm)