KDE shortcut to bash script

How do I create and make a file to create a shortcut to a script? Link to application keeps crashing. This is what I could find.

script name: scanvirus
version: 2.0.0 beta2

Name: Scanvirus - scan linux

do command: /bin/scanvirus -l

working directory: /bin/

I’d like to do a custom icon to. Else, script icon or kde icon.

[Desktop Entry]
Encoding=UTF-8
Name=Home
Name[ca]=Inici
Name[da]=Hjem
Name[de]=Persönlicher Ordner
Name[en_GB]=Home
Name[es]=Inicio
Name[fi]=Koti
Name[gl]=Cartafol persoal
Name[it]=Home
Name[ja]=ホーム
Name[ko]=홈
Name[lt]=Pradžia
Name[nl]=Home
Name[nn]=Heim
Name[pl]=Katalog domowy
Name[pt]=Pasta Pessoal
Name[pt_BR]=Pasta Pessoal
Name[ru]=Домашняя папка
Name[se]=Ruoktu
Name[sk]=Domov
Name[sl]=Dom
Name[sr]=Домаће
Name[sr@ijekavian]=Домаће
Name[sr@ijekavianlatin]=Domaće
Name[sr@latin]=Domaće
Name[sv]=Hem
Name[tr]=Başlangıç
Name[uk]=Домівка
Name[x-test]=xxHomexx
Name[zh_CN]=主文件夹
GenericName=Personal Files
GenericName[ca]=Fitxers personals
GenericName[da]=Personlige filer
GenericName[de]=Persönliche Dateien
GenericName[en_GB]=Personal Files
GenericName[es]=Archivos personales
GenericName[fi]=Omat tiedostot
GenericName[gl]=Ficheiros persoais
GenericName[it]=File personali
GenericName[ja]=個人のファイル
GenericName[ko]=개인적인 파일
GenericName[lt]=Asmeniniai failai
GenericName[nl]=Persoonlijke bestanden
GenericName[nn]=Personlege filer
GenericName[pl]=Pliki osobiste
GenericName[pt]=Ficheiros Pessoais
GenericName[pt_BR]=Arquivos pessoais
GenericName[ru]=Личные файлы
GenericName[se]=Iežat fiillat
GenericName[sk]=Osobné súbory
GenericName[sl]=Osebne datoteke
GenericName[sr]=Лични фајлови
GenericName[sr@ijekavian]=Лични фајлови
GenericName[sr@ijekavianlatin]=Lični fajlovi
GenericName[sr@latin]=Lični fajlovi
GenericName[sv]=Personliga filer
GenericName[tr]=Kişisel Dosyalar
GenericName[uk]=Особисті файли
GenericName[x-test]=xxPersonal Filesxx
GenericName[zh_CN]=个人文件
URL$e]=$HOME
Icon=user-home
Type=Link

It being a script, I assume it is not opening a Window by itself. Should you not configure somewhere that it should run in a terminal window?

Just a suggestion.

I used right-click -> link to application in the context menu and it crashes. I usually use that to make the link to script. How do modify the above to do that?

Click icon -> open terminal window -> scanvirus -l -> hold open window after it scans.

Yes, there are two problems here:

  • Create New->Link to Application is not working, because it cannot find the templates files.
  • The error messagebox causes a crash.

The latter bug has been fixed recently, it caused crashes in many other places too.
I added a workaround for the former to our packages.

So this should work again after the next Frameworks update for Leap.

You can “fix” it yourself meanwhile though, by copying over the KDE4 template files from /usr/share/kde4/templates/ to /usr/share/templates/.
For this particular one you need linkProgram.desktop and .source/Program.desktop .

References:
https://bugzilla.opensuse.org/show_bug.cgi?id=963680
https://bugs.kde.org/show_bug.cgi?id=356198
https://bugs.kde.org/show_bug.cgi?id=356321

It works now. How do I open terminal window with it? Open terminal window and have it stay open after it finishes.

Exactly like in KDE4:
Click on “Advanced Options” on the “Application” tab, and tick “Run in terminal” and “Do not close when command exits”.
http://wstaw.org/m/2016/02/20/props.png

Besides the above, which easily uses the graphical shortcut options,
You should be able to point your shortcut to konsole instead of your scanvirus app directly, eg assuming you also need elevated permissions

kdesu konsole scanvirus -l *path_to_file_ or_folder_being_scanned *

Note that at least based on your other posts related to your project, unless you include more code you can’t simply invoke your scanvirus app without also including the target file or folder.

TSU

I need superuser permissions. Most of the commands need it. In the command, I usually open a terminal window and enter PW. Then enter ‘scanvirus -l’. In the link, it should be ’ su -c scanvirus -l '.

I need to fix one bug before I can proceed to for icons for other systems, like gnome, red hat links. It’s a bit more flexible now for use on non-opensuse systems.

Can I open a gfx window directly as a superuser? I think it’s in KDE.

I have it working now. Thanks to all.