8

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.

  • 1
    Is that .desktop file executable? – muru Dec 8 '14 at 21:20
  • I've had no idea that .desktop files should've executable permissions. :) – Mikhail Krutov Dec 8 '14 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). – don_crissti Dec 8 '14 at 21:34
6

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).

  • 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. – don_crissti Dec 8 '14 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 Dec 8 '14 at 22:54
  • @don_crissti, and Marcelo: I thing the current name is gnome-tweak-tool (singular). – JJoao Jul 31 '15 at 10:14
  • @JJoao, fixed the typo, thanks. Btw, I think the correct spelling is think and not thing :) – Marcelo Jul 31 '15 at 12:08
  • 2
    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. – Tim Richardson Jul 3 '17 at 13:39
1

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.