terminalgoogle-chrome-os

How do I make an app icon for a .sh or .py file


I am using a Chromebook with Linux turned on, and am wondering how I can add a shortcut to the app drawer that opens the terminal and runs a .py or .sh file. Does anyone know how to do this?

Thanks in advance,

Gomenburu


Solution

  • Create a desktop file under /usr/share/applications.
    For example:

    $ ls -l /home/norioy01/hoge.sh
    -rwxr-xr-x 1 norioy01 norioy01 28 Sep 27 09:04 /home/norioy01/hoge.sh
    $ 
    $ cat /home/norioy01/hoge.sh
    #!/bin/bash
    
    touch hoge.txt
    $ 
    $ ls -l /usr/share/applications/hoge.desktop 
    -rw-r--r-- 1 root root 158 Sep 27 09:14 /usr/share/applications/hoge.desktop
    $ 
    $ cat /usr/share/applications/hoge.desktop
    [Desktop Entry]
    Version=1.0
    Name=hoge
    Exec=/home/norioy01/hoge.sh
    Terminal=false
    Type=Application
    $ 
    

    enter image description here