Re: installing GUI launchers and mimes

2017-07-31 Thread Narcis Garcia
At user level there is this command to set an application as default for
a file type:
$ xdg-mime default MyProgram.desktop my/type
(not useful for system wide action)

System wide defaults I see that are registered at some of these files:
/usr/share/applications/mimeapps.list
/usr/share/applications/defaults.list
/usr/local/share/applications/mimeapps.list
/usr/local/share/applications/defaults.list

Is there a better way to setup this than writing directly to one of
these files?



Re: installing GUI launchers and mimes

2017-07-31 Thread Narcis Garcia
__
I'm using this express-made address because personal addresses aren't
masked enough at this mail public archive. Public archive administrator
should fix this against automated addresses collectors.
El 31/07/17 a les 03:23, Charles Plessy ha escrit:
> Le Sun, Jul 30, 2017 at 11:55:20AM +0200, Narcis Garcia a écrit :
>>
>> Do you mean that with only having at the package:
>> ./usr/share/applications/xxx.desktop
>> ./usr/share/mime/packages/xxx.xml
>> triggers are automatically run?
> 
> Hello Narcis,
> 
> yes they will:
> 
>   $ grep usr/share/applications /var/lib/dpkg/triggers/File 
>   /usr/share/applications mime-support/noawait
>   /usr/share/applications desktop-file-utils
>   /usr/share/applications gnome-menus/noawait
> 
>   $ grep usr/share/mime/packages /var/lib/dpkg/triggers/File 
>   /usr/share/mime/packages shared-mime-info
> 
> See /usr/share/doc/dpkg-dev/triggers.txt.gz for (a lot of) details.
> 

When no trigger seem to be in the system (I'm thinkng on other or older
distros), I'll try to use these two commands in postinst:
update-desktop-database
update-mime-database /usr/share/mime

I suppose these will cover most cases for this and other programs:
https://git.actiu.net/libre/xhash



Re: installing GUI launchers and mimes

2017-07-31 Thread Andrey Rahmatullin
On Mon, Jul 31, 2017 at 10:10:29AM +0200, Filip Hroch wrote:
> I encountered the problem some time ago in my Munipack 
> package. 
What problem?


-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: installing GUI launchers and mimes

2017-07-31 Thread Filip Hroch
Dear Narcis,

I encountered the problem some time ago in my Munipack 
package. I followed the recommendations on:

https://wiki.debian.org/MimeTypesSupport

If debhelper is used, the file 'transmission-gtk.install'
in debian/ with the content like:

...
usr/share/applications/xxx.desktop
usr/share/mime/packages/xxx.xml
...

would help to solve easy the problem.

FH




On Mon, 2017-07-31 at 09:46 +0200, Narcis Garcia wrote:
> __
> I'm using this express-made address because personal addresses aren't
> masked enough at this mail public archive. Public archive
> administrator
> should fix this against automated addresses collectors.
> El 31/07/17 a les 03:23, Charles Plessy ha escrit:
> > Le Sun, Jul 30, 2017 at 11:55:20AM +0200, Narcis Garcia a écrit :
> > > 
> > > Do you mean that with only having at the package:
> > > ./usr/share/applications/xxx.desktop
> > > ./usr/share/mime/packages/xxx.xml
> > > triggers are automatically run?
> > 
> > 
-- 
F. Hroch  e-mail: hr...@physics.muni.cz, tel.: +420549494470
Dept. of theor. physics and astrophysics, MU Brno, Kotlarska 2,CZ-611 37



Re: installing GUI launchers and mimes

2017-07-31 Thread Andrey Rahmatullin
On Mon, Jul 31, 2017 at 09:46:40AM +0200, Narcis Garcia wrote:
> I suppose "Debian menu system" is not the same as what xdg-desktop-menu
> manages
Yes, the former needs .menu files while the latter uses .desktop.

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: installing GUI launchers and mimes

2017-07-31 Thread Narcis Garcia
__
I'm using this express-made address because personal addresses aren't
masked enough at this mail public archive. Public archive administrator
should fix this against automated addresses collectors.
El 31/07/17 a les 03:23, Charles Plessy ha escrit:
> Le Sun, Jul 30, 2017 at 11:55:20AM +0200, Narcis Garcia a écrit :
>>
>> Do you mean that with only having at the package:
>> ./usr/share/applications/xxx.desktop
>> ./usr/share/mime/packages/xxx.xml
>> triggers are automatically run?
> 
> Hello Narcis,
> 
> yes they will:
> 
>   $ grep usr/share/applications /var/lib/dpkg/triggers/File 
>   /usr/share/applications mime-support/noawait
>   /usr/share/applications desktop-file-utils
>   /usr/share/applications gnome-menus/noawait
> 
>   $ grep usr/share/mime/packages /var/lib/dpkg/triggers/File 
>   /usr/share/mime/packages shared-mime-info
> 
> See /usr/share/doc/dpkg-dev/triggers.txt.gz for (a lot of) details.
> 
>> Why transmission-gtk/postinst calls update-menus and update-mime ? Is it
>> some kind of compatibility measure?
> 
> The short answer is: "because transmission-gtk/postinst is generated by 
> debhelper
> fia dh_installmenu".
> 
>   $ cat /var/lib/dpkg/info/transmission-gtk.postinst
>   #!/bin/sh
>   set -e
>   # Automatically added by dh_installmenu
>   if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; 
> then
>   update-menus
>   fi
> 
> I am not sure why this is still needed while there is already a dpkg trigger
> doing the work.
> 
> Anyway, as noted elsewhere, the Debian menu system is being phased out.
> 
> Have a nice day,
> 

Thanks, this is really useful information.
I suppose "Debian menu system" is not the same as what xdg-desktop-menu
manages (?) because it currently works perfectly to manually install any
launcher on any desktop on any distro.



Re: installing GUI launchers and mimes

2017-07-30 Thread Charles Plessy
Le Sun, Jul 30, 2017 at 11:55:20AM +0200, Narcis Garcia a écrit :
> 
> Do you mean that with only having at the package:
> ./usr/share/applications/xxx.desktop
> ./usr/share/mime/packages/xxx.xml
> triggers are automatically run?

Hello Narcis,

yes they will:

$ grep usr/share/applications /var/lib/dpkg/triggers/File 
/usr/share/applications mime-support/noawait
/usr/share/applications desktop-file-utils
/usr/share/applications gnome-menus/noawait

$ grep usr/share/mime/packages /var/lib/dpkg/triggers/File 
/usr/share/mime/packages shared-mime-info

See /usr/share/doc/dpkg-dev/triggers.txt.gz for (a lot of) details.

> Why transmission-gtk/postinst calls update-menus and update-mime ? Is it
> some kind of compatibility measure?

The short answer is: "because transmission-gtk/postinst is generated by 
debhelper
fia dh_installmenu".

$ cat /var/lib/dpkg/info/transmission-gtk.postinst
#!/bin/sh
set -e
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; 
then
update-menus
fi

I am not sure why this is still needed while there is already a dpkg trigger
doing the work.

Anyway, as noted elsewhere, the Debian menu system is being phased out.

Have a nice day,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan



Re: installing GUI launchers and mimes

2017-07-30 Thread Andrey Rahmatullin
On Sun, Jul 30, 2017 at 11:55:20AM +0200, Narcis Garcia wrote:
> Do you mean that with only having at the package:
> ./usr/share/applications/xxx.desktop
> ./usr/share/mime/packages/xxx.xml
> triggers are automatically run?
They should (I mean the triggers for update-mime-database and update-mime).

> With xdg-desktop-menu x.desktop the Categories variable altready
> determines menu placement. Without this command, triggers already update
> the menu?
Sorry, I don't understand the question.
Also, the menu is mostly dead.

> Why transmission-gtk/postinst calls update-menus and update-mime ? Is it
> some kind of compatibility measure?
It calls only update-menus.

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: installing GUI launchers and mimes

2017-07-30 Thread Narcis Garcia
El 30/07/17 a les 10:52, Andrey Rahmatullin ha escrit:
> On Sun, Jul 30, 2017 at 10:30:46AM +0200, Narcis Garcia wrote:
>> I'm observing how is transmission-gtk packaged and it seems that it's
>> not enough with including files as
>> ./usr/share/applications/xxx.desktop
>> ./usr/share/mime/packages/xxx.xml
>>
>> but postinst script should run update-menus and update-mime (or
>> update-mime-database) if available.
> update-menus is only for the menu files, not for desktop files.
> update-mime and update-mime-database are run via triggers, not maintainer
> scripts.
> 

Do you mean that with only having at the package:
./usr/share/applications/xxx.desktop
./usr/share/mime/packages/xxx.xml
triggers are automatically run?

With xdg-desktop-menu x.desktop the Categories variable altready
determines menu placement. Without this command, triggers already update
the menu?

Why transmission-gtk/postinst calls update-menus and update-mime ? Is it
some kind of compatibility measure?

Thanks.



Re: installing GUI launchers and mimes

2017-07-30 Thread Andrey Rahmatullin
On Sun, Jul 30, 2017 at 10:41:29AM +0200, Narcis Garcia wrote:
> A question about my way before packaging: Is a good practice to use this
> in postinst script?
> echo "..." > /tmp/MyType.xml
> xdg-mime install --mode system /tmp/MyType.xml
> echo "..." > /tmp/My-Program.desktop
> xdg-desktop-menu install --mode system /tmp/My-Program.desktop
No. Why do you need this?

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: installing GUI launchers and mimes

2017-07-30 Thread Andrey Rahmatullin
On Sun, Jul 30, 2017 at 10:30:46AM +0200, Narcis Garcia wrote:
> I'm observing how is transmission-gtk packaged and it seems that it's
> not enough with including files as
> ./usr/share/applications/xxx.desktop
> ./usr/share/mime/packages/xxx.xml
> 
> but postinst script should run update-menus and update-mime (or
> update-mime-database) if available.
update-menus is only for the menu files, not for desktop files.
update-mime and update-mime-database are run via triggers, not maintainer
scripts.

> It seems also that there are (or were) some need to write profiles as
> /usr/share/menu/PackageName
> /usr/lib/mime/packages/PackageName
> (time ago the first was at /usr/lib/menu/) to be located by update-menus
> program.
Probably. So?

> Packaging my program, how can I deal better with this
Do you have any actual problems with any of this?

> , in most compatible way as possible (with other distros and with old
> Debian versions)?
We don't do such compatibility in the official packages. Make separate
source packages for different distros.

> [Note that I write my own postinst script]
Don't do that.

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: installing GUI launchers and mimes

2017-07-30 Thread Narcis Garcia
A question about my way before packaging: Is a good practice to use this
in postinst script?

echo "..." > /tmp/MyType.xml
xdg-mime install --mode system /tmp/MyType.xml
echo "..." > /tmp/My-Program.desktop
xdg-desktop-menu install --mode system /tmp/My-Program.desktop


El 30/07/17 a les 10:30, Narcis Garcia ha escrit:
> I'm observing how is transmission-gtk packaged and it seems that it's
> not enough with including files as
> ./usr/share/applications/xxx.desktop
> ./usr/share/mime/packages/xxx.xml
> 
> but postinst script should run update-menus and update-mime (or
> update-mime-database) if available.
> It seems also that there are (or were) some need to write profiles as
> /usr/share/menu/PackageName
> /usr/lib/mime/packages/PackageName
> (time ago the first was at /usr/lib/menu/) to be located by update-menus
> program.
> 
> Packaging my program, how can I deal better with this, in most
> compatible way as possible (with other distros and with old Debian
> versions)?
> 
> [Note that I write my own postinst script]
> 



installing GUI launchers and mimes

2017-07-30 Thread Narcis Garcia
I'm observing how is transmission-gtk packaged and it seems that it's
not enough with including files as
./usr/share/applications/xxx.desktop
./usr/share/mime/packages/xxx.xml

but postinst script should run update-menus and update-mime (or
update-mime-database) if available.
It seems also that there are (or were) some need to write profiles as
/usr/share/menu/PackageName
/usr/lib/mime/packages/PackageName
(time ago the first was at /usr/lib/menu/) to be located by update-menus
program.

Packaging my program, how can I deal better with this, in most
compatible way as possible (with other distros and with old Debian
versions)?

[Note that I write my own postinst script]
-- 


__
I'm using this express-made address because personal addresses aren't
masked enough at this mail public archive. Public archive administrator
should fix this against automated addresses collectors.