# CMake .desktop file on Ubuntu

**URL:** https://discourse.cmake.org/t/cmake-desktop-file-on-ubuntu/10611
**Category:** Usage
**Tags:** os:linux
**Created:** [April 8, 2024, 9:46pm UTC](https://discourse.cmake.org/t/cmake-desktop-file-on-ubuntu/10611 "2024-04-08T21:46:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tomhh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tomhh/32/493_2.png) [@tomhh](https://discourse.cmake.org/u/tomhh)
#### Post date: [April 8, 2024, 9:46pm UTC](https://discourse.cmake.org/t/cmake-desktop-file-on-ubuntu/10611/1 "2024-04-08T21:46:30Z")

</div>

This is probably a really simple thing to do, but on Linux (Ubuntu), if I download a CMake binary distribution from [https://cmake.org/download/](https://cmake.org/download/), is there a quick simple step to run to get the `.desktop` file installed and working correctly?

I see there is one included in `share/applications/cmake-gui.desktop`, but it’s not completely clear to me what I need to do with this. I’ve tried running `desktop-file-install --dir=$HOME/.local/share/applications cmake-gui.desktop` to copy it to the right spot, but it doesn’t get picked up after that.

I’ve created a `cmake-gui.desktop` file manually, which I can get to work, but annoyingly I can’t get the icon to show up 🙈

If anyone has a quick description of how to achieve this I’d really appreciate it. Thanks!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 9, 2024, 10:03pm UTC](https://discourse.cmake.org/t/cmake-desktop-file-on-ubuntu/10611/2 "2024-05-09T22:03:58Z")

</div>

I think icons need installed in a standard search location as well to be referred to by name. For the same reason, I think `desktop-file-install` doesn’t quite understand that the application is not being relocated as well; there may be flags you can use for that.

---

<div class="post-metadata">

### Author: ![tomhh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tomhh/32/493_2.png) [@tomhh](https://discourse.cmake.org/u/tomhh)
#### Post date: [May 10, 2024, 2:07pm UTC](https://discourse.cmake.org/t/cmake-desktop-file-on-ubuntu/10611/3 "2024-05-10T14:07:46Z")

</div>

Hi @ben.boeckel,

Thanks for getting back to me about this, I fortunately found a workaround that worked for me.

I created a `cmake-gui.desktop` file in my home directory that looks like the following:

```auto
[Desktop Entry] 
Name=CMake GUI 
Comment=Graphical interface for CMake 
Exec=/opt/cmake-3.28.1-linux-aarch64/bin/cmake-gui 
Icon=/opt/cmake-3.28.1-linux-aarch64/share/icons/hicolor/128x128/apps/CMakeSetup.png 
Terminal=false 
Type=Application 
Categories=Development 

```

Where `Exec` and `Icon` refer to the installed location of CMake GUI and the `CMakeSetup.png` icon. I then run:

```auto
desktop-file-install --dir=$HOME/.local/share/applications ~/cmake-gui.desktop 
update-desktop-database ~/.local/share/applications 

```

To install the desktop file to `$HOME/.local/share/applications` and then refresh that folder to populate the icons.

It might not be the most idiomatic usage but worked well for me, hopefully it might be useful to someone else potentially.

Thanks!
