Hello everyone,
I have a few questions about running scripts and apps on startup of gnome.
First of all I have custom key mapping which I can start with xmodmap ~/.Xmodmap command.
But it isn’t autostarting so I made a .desktop entry in /home/ryxwaer/.config/autostart.
Unfortunately it isn’t working. Is there something what I amd doing wrong?
Also is there a way to execute bash script at startup? I am autostarting TeamViewer with .desktop entry but it always opens the TeamViewer window and I can not seem to find a way to start it hidden. So I decided to write a script to close it:
While I don’t use Gnome, I did a quick search about running something on startup, finding:
Open Startup Applications via the Activities overview. Alternatively you can press Alt + F2 and run the gnome-session-properties command. Click Add and enter the command to be executed at login (name and comment are optional).
Regarding TeamViewer, that looks like quite the hacky workaround. It would be better to start it minimized, or in the background. So I did another bit of googling finding this page, where a user states:
Open Teamviewer then click Connection, Setup unattended access. I think that’s what you’re asking for.
Hello. I know how to use google. I am trying to resolve this issue for a few days.
This command isn’t working. I am accessing startup application with gnome tweaks and I can clearly see my xmodmap.desktop here because I have it located in ~/.config/autostart. Everything there is executed at startup except this file. So I am asking if there is something wrong with the way I wrote .desktop file.
This article is 6 years old. Teamviewer isn’t the same anymore. From the teamviewer documentation I found that it should be started hidden automatically if it is executed by system. It was working under KDE Plasma but not under gnome so I was pushed to this ugly workaround. But I hope there is better solution that is also working.
I validated my .desktop files with desktop-file-validate command. I found some deprecated lines and deleted them. Unfortunately they still don’t work.
My edited xmodmap.desktop:
Well, after some more searching, I came across this page that states:
The correct place to put xmodmap ~/.Xmodmap (so that your changes are read at startup) is in ~/.xinitrc (see explanation below), although you could alternately place the xmodmap command as a startup item (/usr/bin/xmodmap /home/user/.Xmodmap). I can say that for 12.04 (and presumably 12.10) that these two alternatives definitely do work, as either way they are read after you log in with lightdm. (I changed Return to Right Shift, and the change only took effect after entering my password and logging in).
Teamviewer uses systemd to start the service, has to be enabled, and has its own way to enable startup when system starts.
Gnome has a proper example file how to autostart applications. Please check those.
Thanks. You was right. All I had to do was enable autostart in TeamViewer settings. I wasn’t expecting it to work so I ignored that setting
But my biggest concern is still the Xmodmap which should also work without autostarting script.
So I managed to find a workaround. It is working only if I call xmodmap ~/.Xmodmap from .sh script executed by .desktop file on startup. But there is yet another thing! It is working only if script wait at least 3 seconds before executing xmodmap ~/.Xmodmap. So when my laptop boots up I am stuck with black screen for about 10 seconds until the script successfully ends.
Is there a way to speed this process up ?