2

I have a pycharm.sh file and a pycharm.png. How do I create an executable given the two? I tried this:

sudo chmod +x ./pycharm.sh

but nothing is happening. I want and icon on the desktop and it to show up under my programs. I want to be able to pin it to the panel.

3
  • 1
    You don't need the ./ in front of your script to chmod, you only need that if you are running it from its directory.
    – troylatroy
    Sep 27, 2013 at 22:53
  • Not sure if I meet that condition. I 'cd' to where the 'pycharm.sh' file is. So do I need it or not.
    – user194862
    Sep 27, 2013 at 23:01
  • . stands for the current directory. So ./pycharm.sh just means "the file 'pycharm.sh' in the directory I'm in at the moment". Most tools look in the current directory unless you tell them otherwise, so with chmod you can ommit the ./. It's different when you execute a file. To find the binary you want to execute, the shell searches in the directories noted in your PATH variable. Otherwise, you'd have to do something like /bin/chmod +x pycharm.sh or /usr/bin/apt-get update all the time. For security reasons, the current directory isn't included in your PATH by default. Sep 28, 2013 at 9:45

2 Answers 2

4

The easiest way to add a shortcut like that is to install http://apt.ubuntu.com/p/alacarte. It's a graphical tool that enables you to add applications to the menus and the Unity Dash and then you should be able to add it to your launcher as well.

6
  • I am not using the default unity. Will it still work. I do not want to break anything.
    – user194862
    Sep 27, 2013 at 23:15
  • 1
    He noted using Mint in chat, and I stupidly tried to reference him to helpful question sets that he could read to figure out instead of just diverting him to UL. I should have just let it alone. ref: chat.stackexchange.com/transcript/message/11428324#11428324 Sep 27, 2013 at 23:20
  • I got it to work. I am using both LM and Ubuntu and Zorion.
    – user194862
    Sep 27, 2013 at 23:22
  • @IgorG.: I don't understand why you would say that when you haven't tried it and don't know what it is. Alacarte is a desktop-file editor. That means it's useful on all standards-based desktops, like Unity, Gnome Shell, Cinnamon, KDE, Xfce, LXDE, Pantheon (elementaryOS), Mate, Gnome Flashback... Pretty much any desktop you can find. Mar 29, 2015 at 20:40
  • 1
    @IgorG.: Yes there is. This is AskUbuntu. If you don't know something, then you should ask rather than making false claims. Look in the Apps-lens and show Filters. You'll see all the categories there. You can't have custom submenus though, but that's hardly a requirement. If you do add a submenu and add items to it, then they'll appear in the outermost menu. So "Internet > My Bookmarks > AskUbuntu.com" would appear as "Internet > AskUbuntu.com" in the Apps-lens. Mar 29, 2015 at 20:57
3

I recommend the way Jo-Erlend Schinstad gave you. In case you want to know about the technical background, I'll give you something here.

In Linux a file like a script or a binary file that is marked as executeable can execute code. To add things like keywords, names in different languages, icons and many more things, some kind of "wrapper files" (.desktop files) are stored in folders where they are searched for and then automatically are displayed in launchers etc. To find out where to store them so launchers find them by themselves, see here: Where are the Unity Launcher .desktop files?

They are basically just text files with a special syntax. Alacarte (and some other apps in the ubuntu store) can create them or you write/edit them yourself. To find out more about them, you can just search here on askubuntu.

A small example from an answer I found here:

[Desktop Entry]
Encoding=UTF-8
Terminal=0
Exec=/home/pierre/Desktop/XnViewMP/xnview.sh
Icon=/home/pierre/Desktop/XnViewMP/xnview.png
Type=Application
Categories=Graphics;
StartupNotify=true
Name=XnView Multi Platform
GenericName=XnViewMP

How to make a launcher(.desktop file) for a binary file?

Also, .desktop files offer some Unity features. The steam.desktop is a good example for this:

[Desktop Entry]
Name=Steam
Comment=Application for managing and playing games on Steam
Exec=/usr/bin/steam %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;
Actions=Store;Community;Library;Servers;Screenshots;News;Settings;BigPicture;Friends;

[Desktop Action Store]
Name=Store
Name[de]=Shop
Name[es]=Tienda
Name[fr]=Magasin
Name[it]=Negozio
Name[pt]=Loja
Name[ru]=Магазин
Name[zh_CN]=商店
Name[zh_TW]=商店
Exec=steam steam://store

[Desktop Action Community]
Name=Community
Name[es]=Comunidad
Name[fr]=Communauté
Name[it]=Comunità
Name[pt]=Comunidade
Name[ru]=Сообщество
Name[zh_CN]=社区
Name[zh_TW]=社群
Exec=steam steam://url/SteamIDControlPage

[Desktop Action Library]
Name=Library
Name[de]=Bibliothek
Name[es]=Biblioteca
Name[fr]=Bibliothèque
Name[it]=Libreria
Name[pt]=Biblioteca
Name[ru]=Библиотека
Name[zh_CN]=库
Name[zh_TW]=遊戲庫
Exec=steam steam://open/games

[Desktop Action Servers]
Name=Servers
Name[de]=Server
Name[es]=Servidores
Name[fr]=Serveurs
Name[it]=Server
Name[pt]=Servidores
Name[ru]=Серверы
Name[zh_CN]=服务器
Name[zh_TW]=伺服器
Exec=steam steam://open/servers

[Desktop Action Screenshots]
Name=Screenshots
Name[es]=Capturas
Name[fr]=Captures d'écran
Name[it]=Screenshot
Name[ru]=Скриншоты
Name[zh_CN]=截图
Name[zh_TW]=螢幕擷圖
Exec=steam steam://open/screenshots

[Desktop Action News]
Name=News
Name[de]=Neuigkeiten
Name[es]=Noticias
Name[fr]=Actualités
Name[it]=Notizie
Name[pt]=Notícias
Name[ru]=Новости
Name[zh_CN]=新闻
Name[zh_TW]=新聞
Exec=steam steam://open/news

[Desktop Action Settings]
Name=Settings
Name[de]=Einstellungen
Name[es]=Parámetros
Name[fr]=Paramètres
Name[it]=Impostazioni
Name[pt]=Configurações
Name[ru]=Настройки
Name[zh_CN]=设置
Name[zh_TW]=設定
Exec=steam steam://open/settings

[Desktop Action BigPicture]
Name=Big Picture
Exec=steam steam://open/bigpicture

[Desktop Action Friends]
Name=Friends
Name[de]=Freunde
Name[es]=Amigos
Name[fr]=Amis
Name[it]=Amici
Name[pt]=Amigos
Name[ru]=Друзья
Name[zh_CN]=好友
Name[zh_TW]=好友
Exec=steam steam://open/friends

This file is stored in /usr/share/applications/steam.desktop when Steam is installed.

1
  • thanks you. but for now this is to complicated so i did it with the GUI. I will keep this in mind for later though
    – user194862
    Sep 30, 2013 at 1:15

You must log in to answer this question.