12

I'm a long time KDE user, never seen GNOME since may be Mandrake Linux 10 something. Yesterday I took a look at GNOME Shell on Youtube and thought it may worth a look.

It actually is worth, but I can't figure out one moment.

I've got a shell script that used to run on my KDE Laptop installations for ages:

synclient |grep -E 'TapT|RightB|EdgeScr'|awk '{print $1}'|while read item; do synclient $item=0; done
synclient VertScrollDelta=-111
synclient HorizScrollDelta=1
synclient RightEdge=999999999
synclient TopEdge=0
synclient CircularScrolling=0
synclient BottomEdge=999999999
synclient RightButtonAreaLeft=9999999
synclient ClickFinger3=2
synclient HorizScrollDelta=0
synclient HorizTwoFingerScroll=0 

This disables right-click, all taps, inverts scroll directions, disables horizontal scrolling and stuff. Touchpad menu nor in KDE neither in gnome doesn't allow this kind of configuration. (TBH, only Mac of all the operating systems has the gui to set up touchpad exactly like that :)).

I can't figure out, how do I run this after gnome shell session starts? I've already tried this with no results:

[1] % cat /home/neko/.config/autostart/script.desktop 
[Desktop Entry]
Name="Auto stuff"
GenericName="Auto startup stuff"
Comment="Synclient mostly"
Exec=/home/neko/bin/auto_stuff.sh
Terminal=false
Type=Application
X-Gnome-Autostart=true

Any other suggestions,please? Thank you.

3
  • 1
    Is that .desktop file executable?
    – muru
    Commented Dec 8, 2014 at 21:20
  • I've had no idea that .desktop files should've executable permissions. :) Commented Dec 8, 2014 at 21:23
  • 3
    The local (user) launchers, yeah, they have to be +x. Open ~/.config/autostart in Nautilus and double click your script.desktop, you will be prompted to "mark as trusted" (which is equivalent to chmod +x). Commented Dec 8, 2014 at 21:34

2 Answers 2

11

You can use the program gnome-session-properties. Just execute it from your shell prompt (gnome-terminal):

$ gnome-session-properties

This will open a GUI where you can configure (i.e., add, edit, remove, enable and disable) startup programs.

Nice and easy. Enjoy.

Update: As noted by don_crissti (thanks) in the comments below, the gnome-session-properties startup programs functionality has migrated to gnome-tweak-tool since Gnome 3.12 (which btw is a great tool, but a little messier as it concentrates just too many functions). So, for versions 3.12 and above, this is the new place to look.

OBS: And btw, using this method, you don't need to create a .desktop file, you can simply specify the command line of the /home/neko/bin/auto_stuff.sh script you created (or any other script or command you want).

7
  • Worth noting that the gnome-session-properties binary is no longer present in recent Gnome 3 releases (removed as of 3.12 IIRC). Its functionality was included in gnome-tweak-tool. Commented Dec 8, 2014 at 22:50
  • Interesting... I'm using Fedora 20 (with Gnome 3.10), which still has it. Sad that the Gnome team continuously cripple (or shape) the software against users' taste. At least they kept the functionality in gnome-tweak-tool, so here is it the new place to look...
    – Marcelo
    Commented Dec 8, 2014 at 22:54
  • gnome-tweak-tools does not allow you to add scripts at a specific location. You need to jump through hoops with desktop files.
    – RichieHH
    Commented Jun 24, 2017 at 9:43
  • However, gnome-session-properties is still working at least in ubuntu gnome 17.04; just start it from a shell. Commented Jul 2, 2017 at 1:09
  • 5
    Hi @Marcelo for me, (Ubuntu 17.04) I could not find any UI element in gnome-tweak-tool which lets me enter command line scripts or even browse for them. Maybe Gnome on Ubuntu is a bit behind, even though it's mostly 3.24. This could be why gnome-session-properties is still available. I am new to gnome, migrating from xfce. From what I can see, gnome-tweak-tool doesn' have anything like the functionality of gnome-session-properties when it comes to startup scripts and it is weird how hard it seems to be. Commented Jul 3, 2017 at 13:39
3

In .desktop files the case is significant. The following template works under Fedora 27 with GNOME shell (i.e. the Exec= value is executed during session start):

[Desktop Entry]
Encoding=UTF-8
Exec=/path/to/myscript arg1
Name=myscript
Comment=script some stuff
Terminal=false
OnlyShowIn=GNOME
Type=Application
StartupNotify=false
X-GNOME-Autostart-enabled=true

(to be stored as $HOME/.config/autostart/myscript.desktop)

The main difference: you used the key X-Gnome-Autostart= in your example.

Double check if your script /path/to/myscript is executable, i.e. if it has the executable permission bit(s) set.

The OnlyShowIn= is perhaps not significant for the autostart functionality, but I haven't tested it without it. You can list multiple desktop environments like this: OnlyShowIn=GNOME;LXDE;Unity; Consult the XDG_CURRENT_DESKTOP environment variable to verify correct values.

If you want to check whether your script prints any error messages you can check journalctl --user, i.e. the session journal.

2
  • This worked for me but I had to use chmod +x myscript.desktop /path/to/myscript.sh as suggested in a comment. Otherwise journalctl --user would give the error Could not parse desktop file myscript.desktop or it references a not found TryExec binary. Commented Feb 8, 2020 at 2:03
  • 1
    @sergio, sure, the /path/to/myscript.sh you want to exec has to be executable. But myscript.desktop does not need to have executable permissions. Commented Feb 8, 2020 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .