Preventing AR from autostarting at every login

Asked by Joseph J. Pollock

audio-recorder is great. I've been looking for an app that would do this for a long time.

What I don't like is that every time I login, it appears in my panel. I only want it there if I start it manually (or it would be even better if it could be hidden like many other apps can be).

How do I fix this?

Quitting, or telling it not to display the icon work fine for one session, but it comes back with the next session anyway.

I don't see it in ~/.kde/Autostart, .profile, or .bashrc. I also looked for a hidden file in my home directory and in ~/.config .

TIA

Joe - kubuntu precise 64-bit (with lots of backports, including KDE 4.12.0)

Question information

Language:
English Edit question
Status:
Solved
For:
Audio Recorder Edit question
Assignee:
No assignee Edit question
Solved by:
moma
Solved:
Last query:
Last reply:
Revision history for this message
Best moma (osmoma) said :
#1

Hello,
We had a similar issue with the systray icon.
Ref: https://bugs.launchpad.net/audio-recorder/+bug/1159341

But there is one important difference. The "auto-start this app" options has NO value in the desktop's dconf-database. It is not visible in the in the "dconf-editor" or
$ dconf dump /apps/audio-recorder/

The "Auto-start this app" is determined by existence of "$HOME/.config/autostart/audio-recorder.desktop" file and its "X-GNOME-Autostart-enabled" key. We must find a suitable general key/value for KDE.

Please check your $HOME/.config/autostart/ directory and open the audio-recorder.desktop file in a text editor.
$ ls -l $HOME/.config/autostart/

Please help me to fix the audio-recorder so it works on KDE-desktop too. Please compile A.r from source on your desktop. It is very easy to do.

0) Read the INSTALL file. It has a list of dependencies and tools you must apt-get in *Ubuntu.

1) Compile the program from source.

2) Quit existing audio-recorder and run your local src/audio-recorder.

3) Study src/auto-start.[ch] modules, and functions

  void autostart_set(gboolean on_off);
   gboolean autostart_get();

4) Send me your modifications.

Greetings
   Moma

Revision history for this message
moma (osmoma) said :
#2

Re-hi,
I hope you can send me a suggestion to how to treat the autostart file and its "X-GNOME-Autostart-enabled" key in KDE. Audio-recorder was made for GNOME/GTK3+.

Revision history for this message
Joseph J. Pollock (josephj) said :
#3
Revision history for this message
Joseph J. Pollock (josephj) said :
#4

Thanks for the reply.

I will try your full instruction later.

For now, I moved $HOME/.config/autostart/audio-recorder.desktop to $HOME/.config/autostart_dont/ (a new directory) and that eliminated the problem. A-r appears to run manually without it. I haven't tried recording since the change.

Since I still have it, I can put it back for further testing later.

I had not noticed $HOME/.config/autostart/ before.

Joe

Revision history for this message
Joseph J. Pollock (josephj) said :
#5

Thanks moma, that solved my question.

Revision history for this message
Joseph J. Pollock (josephj) said :
#6

I don't know anything about the key you mention.

I have always used KDE in Linux since I first ran Mandrake 9.1 (circa 2004). I have briefly used gnome, but did not try to configure it much.

What I do know is that standard practice for KDE is to put an executable startup script in the $HOME/.kde/Autostart directory. Any executable script found there will be run as part of KDE startup. I don't put anything like a Free Desktop desktop entry description file there.

There may be a similar facility for KDE that I just don't know about. KDE documentation is pretty hard to search and support on the forums is not always stellar.

In my ignorance, if I wanted to toggle autostart for my application, I would just copy my startup script to the Autostart directory or delete it from there. The directory is owned and grouped under the user, so there are no permission issues. The original could be saved in a config directory so the user could modify it if necessary.

From experience, autostart runs pretty early - before KDE is finished restoring the session.

In the past, I had to add a sleep command to one of my scripts. It was designed to launch applications on particular desktops, but I had coded it to do nothing if the application was already running (to avoid duplicates). (It is a common option to set KDE to automatically restore what was running when KDE was last closed.) The sleep was necessary to allow the restore to finish before checking to see what was already running.

There's a cool command called kstart (hard to find good documentation on it) which allows you to tell KDE which desktop to use and a number of other parameters like window geometry, position, and behavior like stay on top, minimized, or in panel.

kstart options -- your-script your-script-options your-script-parameters

(You usually need the -- so kstart doesn't try to interpret the application's options)

is what I put in my autostart script for each application. If you don't need any of the special options, then you can omit kstart, but I'm not sure which desktop the application would be associated with by default.

I'm a little rusty on this, but if your application was added to the KDE menu, then it probably gets its icon from there.

What audio-recorder was doing for me was that Autostart was turned off (and stayed turned off) in the application gui - but it started anyway. And, when I turned Put icon in taskbar off, it worked, but the setting did not stick and it was turned back on the next time KDE started.

If there's anything else I can do, or more info you need, let me know. I have my own small package on sourceforge, so I appreciate the work it takes.

Joe

Revision history for this message
moma (osmoma) said :
#7

Hello,
Thanks for your detailed research.

Both GNOME, KDE and other desktops should follow the freedesktop-standard for the directory locations.
The desktop-standard uses various XDG_xxxx variables to convey information. All desktop-systems do the same thing.

Please see this spec for the autostart directory:
http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html

It says that
if $XDG_CONFIG_HOME is not set, then the Autostart Directory in the user's home directory is $HOME/.config/autostart/

So audio-recorder should follow this logic:

if $XDG_CONFIG_HOME is set then
  autostart_dir = $XDG_CONFIG_HOME
else
  autostart = $HOME/.config/autostart/

This should also work for KDE because its manual says that it does check the $HOME/.config/autostart/ folder, but user can change this location in the settings. So we must check $XDG_CONFIG_HOME.
Ref: http://docs.kde.org/development/en/kde-workspace/kcontrol/autostart/
----

Would you please check these variables in your desktop-system. Run the commands in a terminal window. Do not type the $ variable. Just run the command. Report your findings here.

1) Check value of $XDG_CONFIG_HOME. Is it set in KDE?
$ echo $XDG_CONFIG_HOME

2) Check the other XDG variables too. Run: set | grep -i xdg
$ set | grep -i xdg

XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
XDG_CURRENT_DESKTOP=Unity <---- Unity, GNOME, KDE, XFC.... etc
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
XDG_MENU_PREFIX=gnome-
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_ID=c1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_VTNR=7

Just for your information:
The XDG (desktop standard) provides also some commands that other programs can use.
Ref: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Type "xdg" and TAB-key to see the commands. However we will not need these commands here.
$ xdg[TAB]
xdg-desktop-icon xdg-mime xdg-user-dir
xdg-desktop-menu xdg-open xdg-user-dirs-gtk-update
xdg-email xdg-screensaver xdg-user-dirs-update
xdg-icon-resource xdg-settings

Kindly
  Moma

Revision history for this message
Joseph J. Pollock (josephj) said :
#8

Looks like I may be missing things your program depends on.
Then, why and how to fix it.

I'll look at the specs link when I get a chance. Always learning - looks like "my ignorance" was the case this time.

Thanks.

Joe

bigbird@ramdass:~/bin$ echo "[$XDG_CONFIG_HOME]"
[]
bigbird@ramdass:~/bin$ set | grep -i xdg
XDG_CONFIG_DIRS=/etc/xdg/xdg-default:/etc/xdg
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/usr/share:/usr/share/default:/usr/local/share/:/usr/share/
XDG_SESSION_COOKIE=3b11784fbed72b61a83a522c0000000c-1390329991.386883-1274553129