How to create desktop shortcut or launcher on Linux

If you have a program you use regularly on Linux desktop, you may want to create a "desktop shortcut", so you can launch the program by simply clicking on the shortcut. While most GUI programs automatically create their desktop shortcut during installation, GUI programs built from their source or terminal applications may require you to set up associated shortcuts manually.

In this tutorial, I will describe how to create a desktop shortcut or launcher on various Linux desktops.

A desktop shortcut is represented by a corresponding .desktop file which contains meta information of a given app (e.g., name of the app, launch command, location of icon file, etc.). Desktop shortcut files are placed in /usr/share/applications or ~/.local/share/applications. The former directory stores desktop shortcuts that are available for every user, while the latter folder contains shortcuts created for a particular user only.

Create a Desktop Shortcut From the Command Line

To manually create a desktop shortcut for a particular program or command, you can create a .desktop file using any text editor, and place it in either /usr/share/applications or ~/.local/share/applications. A typical .desktop file looks like the following.

[Desktop Entry]
Encoding=UTF-8
Version=1.0                                     # version of an app.
Name[en_US]=yEd                                 # name of an app.
GenericName=GUI Port Scanner                    # longer name of an app.
Exec=java -jar /opt/yed-3.11.1/yed.jar          # command used to launch an app.
Terminal=false                                  # whether an app requires to be run in a terminal.
Icon[en_US]=/opt/yed-3.11.1/icons/yicon32.png   # location of icon file.
Type=Application                                # type.
Categories=Application;Network;Security;        # categories in which this app should be listed.
Comment[en_US]=yEd Graph Editor                 # comment which appears as a tooltip.

Besides manually create .desktop file, there are various desktop-specific ways to create an application shortcut, which I am going to cover in the rest of the tutorial.

Create a Desktop Shortcut on GNOME Desktop

In GNOME desktop, you can use gnome-desktop-item-edit to configure a desktop shortcut easily.

$ gnome-desktop-item-edit ~/.local/share/applications --create-new

In this example, gnome-desktop-item-edit will automatically create a desktop launcher file in ~/.local/share/applications. To customize icon location and other info, you may have to edit the .desktop file manually afterward.

If gnome-desktop-item-edit is not available (e.g., on Ubuntu), you can install it as follows.

$ sudo apt-get install --no-install-recommends gnome-panel

Create a Desktop Shortcut on KDE Desktop

kickoff is the default application launcher in KDE desktop. Adding a new application shortcut to kickoff is straightforward.

First right-click on kickoff icon located at the left bottom corner of your desktop, and then choose "Edit Applications" menu.

Click on an appropriate category (e.g., "Utilities") under which you want to create a shortcut, and click on "New Item" button on the top. Type in the name of the app.

Finally, fill in the meta information of the app being launched by the shortcut.

Create a Desktop Shortcut on Xfce Desktop

If you are on Xfce desktop, right-click on the desktop background, and then select "Create Launcher" menu. Then fill out the details of the shortcut.

Create a Desktop Shortcut on Cinnamon Desktop

If you are on Linux Mint Cinnamon desktop, you can create an application launcher by right-clicking on the desktop background, and selecting "Create Launcher" menu.

Create a Desktop Shortcut on LXDE Desktop

On LXDE desktop, simply right click on the desktop background, and choose "Create New Shortcut".


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Desktop shortcut是指在桌面上创建的一个快捷方式,用于快速启动一个应用程序。\[1\]在Linux系统中,一个desktop shortcut由一个对应的.desktop文件表示,其中包含了应用程序的元信息(例如应用程序的名称、启动命令、图标文件的位置等)。这些.desktop文件可以放置在/usr/share/applications或~/.local/share/applications目录下。前者存储着对所有用户可用的桌面快捷方式,而后者则包含了为特定用户创建的快捷方式。\[1\] 在Linux系统中,有多种方法可以创建桌面快捷方式。除了手动创建.desktop文件外,还可以使用特定于桌面环境的工具来创建应用程序的快捷方式。例如,在GNOME桌面环境中,可以使用gnome-desktop-item-edit命令来轻松配置桌面快捷方式。\[2\]可以通过以下命令创建一个新的桌面快捷方式: $ gnome-desktop-item-edit ~/.local/share/applications --create-new \[3\] 这将打开一个对话框,让你填写应用程序的相关信息,如名称、命令和图标等。填写完毕后,点击保存即可创建一个新的桌面快捷方式。 #### 引用[.reference_title] - *1* *2* *3* [How to create desktop shortcut or launcher on Linux](https://blog.csdn.net/xkfz008/article/details/24323479)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值