1

I am fairly new to Linux. I have successfully created a desktop shortcut using the method where you create a new .desktop file and add in the information.

The issue I'd like to overcome is that the new shortcut has a dummy icon image and gives the 'untrusted application warning' when first launched.

I'd like to be able to create the shortcut and have it already trusted and have the icon appear nicely as soon as the command is executed. I've written a bash script for this and I think there must be a way to set this up so that it works nicely.

The end result is to eventually run a script that configures a new box to have all my desktop shortcuts pre-made and ready to go.

Here's the script:

#! /bin/bash
LT_RED='\033[1;31m'
LT_GREEN='\033[1;32m'
LT_BLUE='\033[1;36m'
NC='\033[0m' # NO COLOR


function CreateGeanyEnvVar(){
    if [ ! -n "$GEANY_LN" ]; then
        printf "${LT_GREEN}\n => Creating GEANY_LN env var.${NC}"
        GEANY_LN=$HOME/Desktop
    else
        printf "${LT_RED}\n => GEANY_LN already exits.${NC}"
    fi
}

function CreateGeanyDesktopIcon(){
    printf "${LT_GREEN}\n => Creating Geany Desktop Icon.${NC}\n"
    touch ${GEANY_LN}/geany.desktop
    echo "[Desktop Entry]" >> ${GEANY_LN}/geany.desktop
    echo "Type=Application" >> ${GEANY_LN}/geany.desktop
    echo "Version=1.0" >> ${GEANY_LN}/geany.desktop
    echo "Name=Geany" >> ${GEANY_LN}/geany.desktop
    echo "GenericName=Integrated Development Environment" >> ${GEANY_LN}/geany.desktop
    echo "Comment=A fast and lightweight IDE using GTK+" >> ${GEANY_LN}/geany.desktop
    echo "Exec=geany %F" >> ${GEANY_LN}/geany.desktop
    echo "Icon=geany" >> ${GEANY_LN}/geany.desktop
    echo "Terminal=false" >> ${GEANY_LN}/geany.desktop
    echo "Categories=GTK;Development;IDE;" >> ${GEANY_LN}/geany.desktop
    echo "MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;" >> ${GEANY_LN}/geany.desktop
    echo "StartupNotify=true" >> ${GEANY_LN}/geany.desktop
    echo "Keywords=Text;Editor;" >> ${GEANY_LN}/geany.desktop
    echo "X-Desktop-File-Install-Version=0.22" >> ${GEANY_LN}/geany.desktop
    chmod 755 ${GEANY_LN}/geany.desktop
}

printf "${LT_GREEN}Setup Geany on CentOS 7\n${NC}"

printf "${LT_GREEN}*********************************\n${NC}"

CreateGeanyEnvVar
CreateGeanyDesktopIcon

1 Answer 1

0

As described by red-hat documetations: .desktop files with executable permission gives a chance to attacker for ricking the users. So, the new security system treats all the .desktop files from outside pakage as untrusted. Althougth you have generated a good .desktop file, it is still untrusted by system security part. So, how to make it trusted?

  1. First, change the owner and group of .desktop file, so you have the permission to mark is as trusted, such as: # chown john:john ${GEANY_LN}/geany.desktop

  2. After that, double click the .desktop file, it will show a message-box for you to select "cancel" or "trust and launch". Select the second one and the .desktop will be trusted and shown rightly.

This may not be the best solution and keep in searching docs for it!

You must log in to answer this question.

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