New project, a .desktop launcher editor

So you have written that new, must have program. Let us see it here.
Post Reply
User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

New project, a .desktop launcher editor

Post by BruceSteers » Sunday 18th July 2021 7:44pm

This is the latest thing i've been playing with.

It has potential i think

No docs yet but if you understand how .desktop files work this will be straight forward enough.

it's a launcher editor but unlike the rest you can also edit the alternative Actions

for those who do not know "Actions" are other ways to run the program you can set and can be selected by right clicking the launcher when it is in certain places (like a panel)
Like for example how you can right click the Gambas3 launcher icon in a panel and run it with gtk3 or qt

Here's a couple of screenshots of how the gambas launcher icon looks in this application...
The main page..
DE_Main.png
DE_Main.png (205.04 KiB) Viewed 430 times
The Actions page...
DE_Act.png
DE_Act.png (230.61 KiB) Viewed 430 times
As you can see i also have my gambas set so from the panel icon i can also copy the System Information (needed on the bugtracker) and run it as root.

this app works but has the following issues...

launchers (in panels and other areas do not update till next boot)
there may be a way to make the launchers update right away but i do not know how.
I have the launchers on my desktop and i edit those files. when changed i then remover the panel launcher and drag the desktop one over again to make anew.

It's gtk only as you can drag launchers onto the app to load them but with qt the drop data does not include the paths on some files.

i will further develop this a bit and add more features/handling.

Maybe others will find it useful as an app to use or a starting base for their own version?
i've had to import and monkey about with the DesktopFile.class to get the Actions able to save.

Seems to work okay now :) (except the icons not instantly updating)

Enjoy
Attachments
DesktopIconEd.zip
(113.56 KiB) Downloaded 27 times
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

Re: New project, a .desktop launcher editor

Post by BruceSteers » Sunday 18th July 2021 7:50pm

This is how my gambas launcher looks when i right click it...
DE_G3Icon.png
DE_G3Icon.png (311.93 KiB) Viewed 429 times
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

Re: New project, a .desktop launcher editor

Post by BruceSteers » Sunday 18th July 2021 8:14pm

here's how to install it..

An example of how to get the application installed.
Simply run the gambas application from your desired location and select "create launcher" from the menu.
A desktop launcher or menu item can be created.
That launcher can then be simply dragged onto your panel (as shown in this clip...)


Now your desktop launcher icons can be dragged onto this applications icon and it will load the .desktop file for editing.
Last edited by BruceSteers on Sunday 18th July 2021 9:39pm, edited 2 times in total.
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

Re: New project, a .desktop launcher editor

Post by BruceSteers » Sunday 18th July 2021 9:36pm

Re: the Copy System information bit.

If I am on the Bugtracker webpage and gambas is closed i had to do the following to get the system info Ben wants...
Load gambas..
Load a project..
Select the system information menu to open the info page..
Press "Copy" to copy to clipboard..
Then paste into the web page but do not close gambas or the clipboard clears.

Now i have done this.
I installed clipit
sudo apt-get install clipit

clipit is a global clipboard utility that allows clips to survive when an app is closed (plus other features)

Now if i am on the Bugtracker i just right click my gambas panel launcher icon and hit "Copy system info" then paste in the bugtracker.

the launcher executes the file /usr/bin/g3toclip ...
it looks like this..

Code: Select all

#!/usr/bin/env bash

gambas3 --system-information|clipit
I could not get the clipboard info to survive without making a seperate bash script and running it, using the command directly did not work.
But that did.
Maybe it's useful for you? :)
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
PJBlack
Posts: 159
Joined: Tuesday 09th June 2020 10:26pm
Location: Florstadt, Hessen, Germany

Re: New project, a .desktop launcher editor

Post by PJBlack » Monday 19th July 2021 7:23am

after a first quick look i've changed a few things:

changed project/properties/components/gb.gtk3 --> gb.gui (afaik everything works)

Startup:
Public Sub Main()

  FMain.GridView1.Columns.Count = 3
Public Sub Main()

  Application.Theme = "gambas-mono"

  FMain.GridView1.Columns.Count = 3
nothing essential only my taste ...
when starting a program from a module at least the setting application.theme works so why not ...


-

FMain:
Public Sub Form_Open()
  ' get a couple of settings , the last used file chooder path and the icon size

End
Public Sub Form_Open()
  ' get a couple of settings , the last used file chooder path and the icon size

  btnSave.Picture = Picture.Load("icon:/16/save")
  btnSaveAs.Picture = Picture.Load("icon:/16/save-as")
  Button_Quit.Picture = Picture.Load("icon:/16/quit")
  Me.Center

End
again ... nothing essential only my taste ...
me.center fix the diffent opening behaviour between gtk and qt


-
Public Sub OpenFile(Optional FileName As String) As Boolean

  If Not FileName Then
    Dialog.Path = User.Home &/ "Desktop/.desktop"
Public Sub OpenFile(Optional FileName As String) As Boolean

  If Not FileName Then
    Dialog.Path = User.Home &/ "Schreibtisch/.desktop"
yes yes ... the stupid germans again ...
error if path does not exist

-
Private Sub Icon2Button()

  Dim p As Picture = Picture.Load(ds.Icon)

  btnIcon.Picture = p.Image.Stretch(96, 96).Picture
  btnIcon.Tag = ds.Icon

End
Private Sub Icon2Button()

  Dim p As Picture

  Try p = Picture.Load(ds.Icon)

  If Not Error Then
    btnIcon.Picture = p.Image.Stretch(96, 96).Picture
    btnIcon.Tag = ds.Icon
  Endif

End
error if icon does not exist

-

as usual i am running on majaro with xfce

good work and as always a nice idea !

User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

Re: New project, a .desktop launcher editor

Post by BruceSteers » Monday 19th July 2021 8:47am

PJBlack wrote:
Monday 19th July 2021 7:23am
after a first quick look i've changed a few things:

changed project/properties/components/gb.gtk3 --> gb.gui (afaik everything works)

good work and as always a nice idea !
dragging files on to the app does not work with QT , QT is buggy.
that's why i used gtk
(i thought i'd explained that lol)
check out this clip of me dragging icons onto the app with QT and the debugger printing the paths...
https://youtu.be/h8CMT3dZ5Ss

I only started writing this a couple of days ago. it's probably got some creases to iron out ;)
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 652
Joined: Thursday 23rd July 2020 5:20pm

Re: New project, a .desktop launcher editor

Post by BruceSteers » Monday 19th July 2021 2:01pm

I fixed the Desktop path error. i added gb.desktop and used Desktop.Path instead.

Updated version on git...
https://gitlab.com/bsteers4/desktopiconed
Wishing well
Bruce

If at first you don't succeed , try it differently.

Post Reply