Menu entry after installation

I don’t know if this should be taken as a feature request, but then again a feature - as the saying goes - is just a bug with seniority, or I’m being nitpicking here.

But either way, it’d be nice to have it available after a new installation, either through the precompiled distro specific package or through sources.

It’s being relative easy to include it under xfce, but this is something that other editors have taken care during installation.

kak-icon-1

other-editors

I assume by “logo” you mean “icon in the start menu”, or whatever various GUIs have instead of a start menu these days.

This sort of integration is generally taken care of by distro packagers, who might have opinions about how to do these things “properly”. However, it’s not too difficult to hack up yourself:

  • copy doc/kakoune_logo.svg to $PREFIX/share/icons/kakoune.svg

    • technically it’s supposed to go in $PREFIX/share/icons/hicolor/scalable/apps/and other sizes and resolutions are supposed to go in other directories, but we don’t have any other sizes and resolutions and I don’t know what happens if you don’t have, say, at least a 32x32px PNG icon.
  • Write a desktop entry like the following to $PREFIX/share/applications/org.kakoune.kakoune.desktop:

      [Desktop Entry]
      Name=Kakoune
      Comment=Kakoune Text Editor
      Exec=kak %U
      Icon=kakoune
      Terminal=true
      Type=Application
      Categories=Development;Office;
      MimeType=text/plain;text/*;
    

    Note that you should probably put the full path to the kak binary in the Exec= line. For more details on this file, see the Desktop Entry specification.

4 Likes

The title heading is misleading. I got sidetracked by the logo svg file size while scaling it up. The title should have been about the desktop file instead, that other editors use during installation.

Either way, +1 for breaking it down @Screwtapello, I couldn’t have said it better.

This sort of integration is generally taken care of by distro packagers

That’s what I thought. And I haven’t compiled GNU/Emacs from sources in a while now, and this is precisely where my confusion about this issue stemmed from. Emacs, if memory serves well, was not distro specific regarding this issue.

copy doc/kakoune_logo.svg to $PREFIX/share/icons/kakoune.svg

  • technically it’s supposed to go in $PREFIX/share/icons/hicolor/scalable/apps/ and other sizes and resolutions are supposed to go in other directories, but we don’t have any other sizes and resolutions and I don’t know what happens if you don’t have, say, at least a 32x32px PNG icon.

thanks!

 [Desktop Entry]
 Name=Kakoune
 Comment=Kakoune Text Editor
 Exec=kak %U
 Icon=kakoune
 Terminal=true
 Type=Application
 Categories=Development;Office;
 MimeType=text/plain;text/*;

Thanks for this, but when you have Exec=kak %U rather than say Exec=kak %F is this supposed to be for a system-wide installation instead?

I’m asking because all destkop files for Emacs, vim and neovim currently have %F filetype specification right after Exec but I noticed that just having kak works as well.

I also find the documentation installation pretty straightforward if not breakthrough in the installation itself.

I can’t remember right at the moment, how different installations of emacs - one from sources and the other one from the distro packager - handled it in this regard, but it was definitely some sort of inconvenience as one installation would overwrite the destination directories of the prior one.Of course! one could always specify it [destination dirs] accordingly, but then again, and if I’m not mistaken here, default values would always overwrite.

kak on the other hand, takes care of this beautifully as destination directories are never shared among different installations. For this alone I’m grateful.

For some given reason and right after I specified the image on the desktop file, the original image that is, I noticed this difference iwth the other icons such as the ones from emacs and neovim.

Why did the kakoune icon under Applications differed considerably from the rest?

At first I thought it was an optical illusion because of the design of the logo itself.

But then I came across this nvim.png icon is wrongly shaped · Issue #9715 · neovim/neovim · GitHub which just didn’t add up. The kakoune file was rightly shaped or so I thought.

And someone can correct me here if I’m wrong, but it wasn’t until after I cropped the image following alongside both the baseline and top of the K that the icon matched the rest.

I had an existing .desktop file laying around I copy/pasted without thinking too hard.

Apparently %U is “a list of URLs” and %F is “a list of files”, so yeah, I guess it should be %F.

… I noticed that just having kak works as well.

It probably works just as well for launching Kakoune from a menu, but you’ll probably need %F to associate Kakoune with files in your file-manager, or handle files being dragged and dropped onto the task-bar icon.

@nonumeros at the end, did you come up with a solution you liked? Can you share your final solution?

did you come up with a solution you liked?

@robertmeta Before I opened the thread I had followed howto:customize-menu [Xfce Wiki] and rather than going by their suggestion of having it [destkop file] on /.local/share/applications I created the desktop file under /usr/share/applications/ instead.

What happened is that - unfortunately - the exo utility from xfce for example, will eventually throw an error if one would like to further edit this file.

Something in the lines of a dbus error of some sort.

So whatever configuration was on that fdesktop file at /usr/share/applications would not work. Even after modifying the values around this wasn’t possible.

So yes, exo-desktop-item-edit defaults to .local/share/applications rather than /usr/share/applications

Sooner or later one would realize that certain configurations under /usr/share/applications would simply not work.

You might ask “What did you do when the configuration under /usr/share/applications stopped working?” tt

It was actually simple: I removed the file under that directory. It defaults to .local/share/applications

At the end of the day, this is the desktop environment I run it under, and it’s one of the few envs that allows me without major setbacks a certain degree of customization compared with the rest.

One of these desktop files configuration is

 [Desktop Entry]
 Version=1.0
 Type=Application
 Categories=Development;TextEditor;
 Name=Kakoune1
 Comment=
 Icon=kakoune1.png
 Exec=uxterm /usr/local/bin/kak
 Path=
 Terminal=false
 StartupNotify=false

and the other desktop file i have it specified as

 [Desktop Entry]
 Version=1.0
 Type=Application
 Name=kakoune
 Comment=
 Icon=kakoune11.png
 Exec=kak
 Path=
 Terminal=true
 StartupNotify=false

the latter created its own subdirectory under Applications

But there are two main concerns which I had when I opened the thread,

The first concern is that all the editors out there or most of them, include a desktop file. Emacs for example has included it even from sources.

Secondly, and this is the one issue by which I got easily carried away, was by the insignificant size of the icon image. Perhaps it was optical illusion or the way that the logo image was designed in the first place compared with the rest.

Look at the first image compared with the second one

image10

And that’s the original svg file

Now the second one

Kakoune’s icon is diamond-shaped, so it’s always going to look smaller than a square icon with the same dimensions. However, Kakoune’s icon is a bit smaller again.

Opening up /usr/share/icons/hicolor/scalable/apps/gvim.svg (another diamond-shaped icon), Inkscape tells me the overall icon is 282×282pt, while the actual drawn part is ~281×281pt, or about 99% of the overall icon area.

Meanwhile, the overall icon size of kakoune.svgis 240×240px, and the actual drawn part is 220×220px, or 84%. But even that’s not quite right, since the icon has a very subtle drop-shadow on it so the actual dimensions are larger than it appears. If we turn off the drop-shadow, the final dimensions are 200×200px, or 69% of the overall icon area.

You’d definitely want the full icon with all its drop-shadows for things like web-pages and t-shirts, but maybe there’s room for a simplified, cropped icon for desktop GUI purposes.

Meanwhile, the overall icon size of kakoune.svg is 240×240px

Yes. And neovim has 104x128 which is about right, but it appears wider than the rest.

but maybe there’s room for a simplified, cropped icon for desktop GUI purposes.

looking forward to it, thanks!