Start Script when Gnome Starts Up

前端 未结 6 1981
一向
一向 2020-12-04 17:40

I have a script that I need to start up after the user logs in via a nx client. From what I understand, Gnome starts up after a user logs in (correct me if I am wrong here).

相关标签:
6条回答
  • 2020-12-04 18:16

    GNOME Ships an Application called "GNOME Tweak Tool" or simply called "Tweaks". This does have an section called "Startup Applications".

    After you added something to autostart, i recommend to you too look in ~/.config/autostart what this tool did.

    0 讨论(0)
  • 2020-12-04 18:21

    In gnome3, if you prefer a GUI based approach you could run the command: ALT + F2, then type in the window that pop ups:

    gnome-session-properties
    
    0 讨论(0)
  • 2020-12-04 18:23

    There's no handy tool to do it in GNOME 3, so you can create a .desktop file manually or use this app.

    0 讨论(0)
  • 2020-12-04 18:27

    Just put the script or call you script in your ~/.profile file. For me works very well, I needed to execute fusuma -d at the startup session.

    0 讨论(0)
  • 2020-12-04 18:31

    There is a specification for this purpose, and it works with any desktop environment that supports the specification (eg. KDE, GNOME2, GNOME3, ...).

    You should put a Desktop Entry file (with .desktop extension) inside of ~/.config/autostart (for a user) or /etc/xdg/autostart (for the whole system). In the file you set the script to run (see the option Exec). For more information, check the Desktop Application Autostart Specification.

    For example, you can put a file with the following content:

    [Desktop Entry]
    Name=MyScript
    GenericName=A descriptive name
    Comment=Some description about your script
    Exec=/path/to/my/script.sh
    Terminal=false
    Type=Application
    X-GNOME-Autostart-enabled=true
    

    You can also use the graphical user interface to create one entry or Add a new entry:

    • in GNOME 2 is System/Preferences/Startup Applications.
    • in GNOME 3, press Alt+R and look for Startup Applications Preferences (typing the first letters of the name will filter it quickly) or run gnome-session-properties from there or a terminal.
    0 讨论(0)
  • 2020-12-04 18:34

    In Gnome3, you'd have to create a folder ~/.config/autostart and put the script in there

    0 讨论(0)
提交回复
热议问题