Recent

Author Topic: Adding a Laz-built program to Ubuntu Favorites?  (Read 10806 times)

QEnnay

  • Full Member
  • ***
  • Posts: 115
Adding a Laz-built program to Ubuntu Favorites?
« on: June 20, 2021, 12:16:40 am »
Hi, I am leaving Mint (Upgrade crashed -- again) and installed Ubuntu 20.04.xx.

I have five programs I wrote with Lazarus and want to install them into the Ubuntu "Favorites" list on the Left side of the screen.

I installed Alacarte (menu manager) and added them in as new Items and they showed up in the "All" page. I click them and they launch fine, but there is no option to lock to the Favorites on the Left.

I did some searching and it was suggested to try making .desktop files and put them in the /usr/share/applications Folder and I did so. They too then showed up in the main "All" page, but none of them offered an "Add to favorites" option.

Currently back with Mint. Not sure if it is a Lazarus-build issue or a Ubuntu quirk, but thought I'd start here as the Alacarte install shows up with a "Add to favorites," option.
Linux-Mint 20.1 x64 + Cinnamon; Lenovo Flex 5 Ryzen 5 4500, 16GB memory
FPC: 3.2.0-1, Lazarus 2.0.12-0, all 64bit

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #1 on: June 20, 2021, 02:34:14 am »
You don't mention which desktop you are using, you question is really a "Desktop Question".

If using the default Gnome (yek !) desktop and you want it to appear in the dock, typically down the left side, open the app in question, its icon appears in the dock, right click the icon and choose add to favourite.

If using one of the other desktops such as Mate, open the menu, right click the entry for the app in question and choose "pin to favourite".

If these don't work, you need to ask the Desktop people, its not a Lazarus issue I am afraid.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #2 on: June 20, 2021, 10:28:35 am »
If these don't work, you need to ask the Desktop people, its not a Lazarus issue I am afraid.

Agreed. I think OP's "covered the bases" from the POV of anything that can be considered normal app installation: create a .desktop file, put it in the right place, check it appears in the menu system and works, the "missing link" being how to get it into the favourites list.

I'm not entirely surprised that whatever desktop environment OP's using has forgotten this, since several of them don't even have a program to create/edit .desktop files. However since these are standardised it might be that the location and behaviour of the favourites list is also standardised... not easy to grep for since I think names aren't saved as strict ASCII, some variant of one of the xdg-XXX programs might do it.

(Later) https://averagelinuxuser.com/ubuntu_custom_launcher_dock/ looks relevant:

"The application launcher will stay there after you close the app. That’s is the way to get a quick launcher for any app. However, this approach doesn’t work if you install an application not from the Ubuntu repository."

If that's the case and if the fix given works, then even if it's not a Lazarus problem it's something we need to be aware of.

MarkMLl
« Last Edit: June 20, 2021, 10:38:52 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #3 on: June 21, 2021, 03:20:33 pm »
>>  However, this approach doesn’t work if you install an application not from the Ubuntu repository.
> If that's the case and if the fix given works, then even if it's not a Lazarus problem it's something we need to be aware of.

I don't have time to fire up one of my Ubuntu Gnome VMs right now but I am absolutely sure that method does work for an app with a desktop file, in fact, I have in the past recommend that process for Gnome users as part of a workaround for Gnome's reluctance to show a SysTray icon, something I have a better solution for now.  But I frequently tested the process using a Lazarus app.   

There is nothing in a standard binary that is necessary for doing something like adding to favourites, thats a process a lot closer to the user than what goes on in a binary. So desktops do require an assigned icon to display as a menu at all and most "add to favorites" is a "manipulate the menu" process. Except, of course Gnome, the dock is not a menu but does use some menu infrastructure.

Some time ago I added a section about making a desktop file in the "Installing Lazarus on Linux" wiki page, its generally applicable. And, as Mark noted, quite easy.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #4 on: June 21, 2021, 04:50:36 pm »
There is nothing in a standard binary that is necessary for doing something like adding to favourites, thats a process a lot closer to the user than what goes on in a binary. So desktops do require an assigned icon to display as a menu at all and most "add to favorites" is a "manipulate the menu" process. Except, of course Gnome, the dock is not a menu but does use some menu infrastructure.

There's nothing /in/ /the/ /binary/. However in the general case there might be POSIX capabilities stored in the associated inode, or there might be something in an SE-Linux configuration file. Or perhaps elsewhere: Linux is getting so fragmented and messy that nothing would surprise me.

Quote
Some time ago I added a section about making a desktop file in the "Installing Lazarus on Linux" wiki page, its generally applicable. And, as Mark noted, quite easy.

Provided that ones distro-of-choice supplies an appropriate editor, which some don't. I've considered knocking one together using Lazarus in the past, but was discouraged by the amount of i18n involved.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #5 on: June 21, 2021, 06:55:46 pm »
Provided that ones distro-of-choice supplies an appropriate editor, which some don't. I've considered knocking one together using Lazarus in the past, but was discouraged by the amount of i18n involved.

Hmmm? You can create/edit .desktop files with any text editor; it's just a more or less standard ini-file, nothing magic there. Then you make the proper invocation to desktop-file-install and (usually) done.

The same can be said for adding to favourites, showing on the desktop, etc.: either use the desktop facilities/utilities or edit some config file, create a symlink somewhere, etc.

I'd even venture that nowadays is way much easier, what with almost everybody and their dogs following XDG specs, etc. :D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #6 on: June 21, 2021, 08:20:26 pm »
Provided that ones distro-of-choice supplies an appropriate editor, which some don't. I've considered knocking one together using Lazarus in the past, but was discouraged by the amount of i18n involved.

Hmmm? You can create/edit .desktop files with any text editor; it's just a more or less standard ini-file, nothing magic there. Then you make the proper invocation to desktop-file-install and (usually) done.

I'm /fully/ aware of that, but that doesn't mean that the average user will get it right. I was going to put a smiley in there, but in practice there are a few gotchas such as the limited number of valid categories (and the once-every-blue-moon proceedings to review the list), the erratic behaviour of various desktops to the commands that tell them that they are (or are not) permitted to display a particular entry in their menus and so on.

Quote
The same can be said for adding to favourites, showing on the desktop, etc.: either use the desktop facilities/utilities or edit some config file, create a symlink somewhere, etc.

I'd even venture that nowadays is way much easier, what with almost everybody and their dogs following XDG specs, etc. :D

But I don't see you contributing a robust response to OP's request for help... :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #7 on: June 21, 2021, 11:54:38 pm »
But I don't see you contributing a robust response to OP's request for help... :-)

Because I don't have it at the moment. But when I have needed something like that I,ve never needed more than a quarter hour searching, whether in freedesktop.org, askubuntu, or a couple or three other sites, including googling (or rather duckduckgoing) to find the site(s) with the answers.

But then I'm old-style (or just plain old) that way ;D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #8 on: June 22, 2021, 03:02:23 am »
I make deb and rpm files for my app, they place the one desktop file in /usr/share/applications and it works with every linux distribution I have tested. Now, that is certainly not every distro but would represent at least 80% of linux users IMHO. That includes Gnome desktops that don't have a menu but do, graciously allow the informed user to add one.

Its also possible to put the desktop file in user space, ~/.local/share/applications/ but thats not suited to an root install.

A tool to make and install a desktop file would target ~/.local/share/applications/ I think but honestly, its the application makers responsibility and anyone who can write a bit of code can write a desktop file. Again, IMHO. If the developer cannot be bothered making a deb or rpm, a very simple bash script would do it and would not need root access.

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #9 on: June 22, 2021, 09:23:27 am »
Because I don't have it at the moment. But when I have needed something like that I,ve never needed more than a quarter hour searching, whether in freedesktop.org, askubuntu, or a couple or three other sites, including googling (or rather duckduckgoing) to find the site(s) with the answers.

So far I've been unable to find what the (KDE) favourites folder actually is, even using brute force on Debian. It's likely to be worse on Gnome because of the- AIUI- registry used to store configuration, and GOK how it works on desktop environments which can't even be bothered to provide a menu editor.

Not that I'm saying it's a valid topic for deep research by this community, but knowing that there is a potential installation issue is.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #10 on: June 22, 2021, 01:03:12 pm »
.....
So far I've been unable to find what the (KDE) favourites folder actually is, even using brute force on Debian. It's likely to be worse on Gnome because of the- AIUI- registry used to store configuration, and GOK how it works on desktop environments which can't even be bothered to provide a menu editor.

KDE is one of the many that adds to favorites just by pulling down the menu, finding the relevant app and right clicking "Add to favorites".  Gnome does the same (if you have added a menu) and has a similar model to add to dock, this time right clicking the icon that appears transitionally in the dock. Other dock using DEs do the same.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #11 on: June 22, 2021, 01:06:13 pm »
.....
So far I've been unable to find what the (KDE) favourites folder actually is, even using brute force on Debian. It's likely to be worse on Gnome because of the- AIUI- registry used to store configuration, and GOK how it works on desktop environments which can't even be bothered to provide a menu editor.

KDE is one of the many that adds to favorites just by pulling down the menu,

Yes. But it's unclear where it's stored.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #12 on: June 23, 2021, 09:24:26 am »
MarkMLl
~/.config/kactivitymanagerd-statsrc
However, you have to check if you have
Code: [Select]
favoritesPortedToKAstats=trueinside ~/.config/plasma-org.kde.plasma.desktop-appletsrc

As it's not normally expected to be edited by hand (KDE aims to be fully GUI configurable, no hand editing of config files should be necessary), the detail is rather scarce by design.
However, those who need it is well informed: https://userbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Adding a Laz-built program to Ubuntu Favorites?
« Reply #13 on: June 23, 2021, 10:00:45 am »
MarkMLl
~/.config/kactivitymanagerd-statsrc
However, you have to check if you have
Code: [Select]
favoritesPortedToKAstats=trueinside ~/.config/plasma-org.kde.plasma.desktop-appletsrc

As it's not normally expected to be edited by hand (KDE aims to be fully GUI configurable, no hand editing of config files should be necessary), the detail is rather scarce by design.
However, those who need it is well informed: https://userbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting

Hmm. Although I'm still having difficulty following that through and finding where the actual things I've added (e.g. Konsole) are being stored.

In any event, I think the relevance there is that this appears to be firmly outside the xdg* family, so some different mechanism will be used for Ubuntu etc.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018