[PATCH GnuPG 1/2] Keep temp files when opening images via xdg-open

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH GnuPG 1/2] Keep temp files when opening images via xdg-open

GnuPG - Dev mailing list
xdg-open spawns the user's preferred image viewer and then exits.
Therefore we must not remove the temp file when it exits,
otherwise by the time the actual image viewer is started the file
doesn't exist any more.

Signed-off-by: Nicolas Fella <[hidden email]>
---
 g10/photoid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/g10/photoid.c b/g10/photoid.c
index 592d5e484..e6f0a41a6 100644
--- a/g10/photoid.c
+++ b/g10/photoid.c
@@ -287,7 +287,8 @@ get_default_photo_command(void)
   else if (!path_access ("display",X_OK))
     return "display -title 'KeyID 0x%k' %i";
   else if (getuid () && !path_access ("xdg-open", X_OK))
-    return "xdg-open %i";
+    /* xdg-open spawns the actual program and exits so we need to keep the temp file */
+    return "xdg-open %I";
   else
     return "/bin/true";
 #endif
--
2.30.1


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH GnuPG 2/2] Prefer opening images with xdg-open over display

GnuPG - Dev mailing list
xdg-open respects the user's configured image viewer
and is therefore preferred.

display is still available as a fallback when xdg-open
isn't available.

Signed-off-by: Nicolas Fella <[hidden email]>
---
 g10/photoid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/g10/photoid.c b/g10/photoid.c
index e6f0a41a6..1ba8190b9 100644
--- a/g10/photoid.c
+++ b/g10/photoid.c
@@ -284,11 +284,11 @@ get_default_photo_command(void)
 #else
   if (!path_access ("xloadimage", X_OK))
     return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin";
-  else if (!path_access ("display",X_OK))
-    return "display -title 'KeyID 0x%k' %i";
   else if (getuid () && !path_access ("xdg-open", X_OK))
     /* xdg-open spawns the actual program and exits so we need to keep the temp file */
     return "xdg-open %I";
+  else if (!path_access ("display",X_OK))
+    return "display -title 'KeyID 0x%k' %i";
   else
     return "/bin/true";
 #endif
--
2.30.1


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH GnuPG 2/2] Prefer opening images with xdg-open over display

Ingo Klöcker
Hi Nicolas,

any reason why xloadimage should still be preferred over xdg-open?

Regards,
Ingo

On Sonntag, 28. Februar 2021 14:34:11 CET Nicolas Fella via Gnupg-devel wrote:

> xdg-open respects the user's configured image viewer
> and is therefore preferred.
>
> display is still available as a fallback when xdg-open
> isn't available.
>
> Signed-off-by: Nicolas Fella <[hidden email]>
> ---
>  g10/photoid.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/g10/photoid.c b/g10/photoid.c
> index e6f0a41a6..1ba8190b9 100644
> --- a/g10/photoid.c
> +++ b/g10/photoid.c
> @@ -284,11 +284,11 @@ get_default_photo_command(void)
>  #else
>    if (!path_access ("xloadimage", X_OK))
>      return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin";
> -  else if (!path_access ("display",X_OK))
> -    return "display -title 'KeyID 0x%k' %i";
>    else if (getuid () && !path_access ("xdg-open", X_OK))
>      /* xdg-open spawns the actual program and exits so we need to keep the
> temp file */ return "xdg-open %I";
> +  else if (!path_access ("display",X_OK))
> +    return "display -title 'KeyID 0x%k' %i";
>    else
>      return "/bin/true";
>  #endif
> --
> 2.30.1
>
>
> _______________________________________________
> Gnupg-devel mailing list
> [hidden email]
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH GnuPG 2/2] Prefer opening images with xdg-open over display

GnuPG - Dev mailing list
On Sun, 28 Feb 2021 17:40, Ingo Klöcker said:

> any reason why xloadimage should still be preferred over xdg-open?

Never change running code.  xloadimage is a simpler than display and
thus we should keep support for it.


Salam-Shalom,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH GnuPG 2/2] Prefer opening images with xdg-open over display

GnuPG - Dev mailing list
In reply to this post by GnuPG - Dev mailing list
On Sun, 28 Feb 2021 14:34, Nicolas Fella said:
> xdg-open respects the user's configured image viewer
> and is therefore preferred.

This would be a regression.  display and xloadimage both allow to pass
the title. This seems not to be possible with xdg-open.


Shalom-Salam,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH GnuPG 1/2] Keep temp files when opening images via xdg-open

GnuPG - Dev mailing list
In reply to this post by GnuPG - Dev mailing list
On Sun, 28 Feb 2021 14:34, Nicolas Fella said:
> xdg-open spawns the user's preferred image viewer and then exits.
> Therefore we must not remove the temp file when it exits,
> otherwise by the time the actual image viewer is started the file
> doesn't exist any more.

Thanks.  Pushed to master and 2.2



Salam-Shalom,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH GnuPG 2/2] Prefer opening images with xdg-open over display

GnuPG - Dev mailing list
In reply to this post by Ingo Klöcker
Hi Ingo,

no reason, IMHO xdg-open should be preferred over xloadimage too, but
Werner seems to disagree on that, for valid reasons.

Cheers

Nico

On 2/28/21 5:40 PM, Ingo Klöcker wrote:

> Hi Nicolas,
>
> any reason why xloadimage should still be preferred over xdg-open?
>
> Regards,
> Ingo
>
> On Sonntag, 28. Februar 2021 14:34:11 CET Nicolas Fella via Gnupg-devel wrote:
>> xdg-open respects the user's configured image viewer
>> and is therefore preferred.
>>
>> display is still available as a fallback when xdg-open
>> isn't available.
>>
>> Signed-off-by: Nicolas Fella <[hidden email]>
>> ---
>>   g10/photoid.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/g10/photoid.c b/g10/photoid.c
>> index e6f0a41a6..1ba8190b9 100644
>> --- a/g10/photoid.c
>> +++ b/g10/photoid.c
>> @@ -284,11 +284,11 @@ get_default_photo_command(void)
>>   #else
>>     if (!path_access ("xloadimage", X_OK))
>>       return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin";
>> -  else if (!path_access ("display",X_OK))
>> -    return "display -title 'KeyID 0x%k' %i";
>>     else if (getuid () && !path_access ("xdg-open", X_OK))
>>       /* xdg-open spawns the actual program and exits so we need to keep the
>> temp file */ return "xdg-open %I";
>> +  else if (!path_access ("display",X_OK))
>> +    return "display -title 'KeyID 0x%k' %i";
>>     else
>>       return "/bin/true";
>>   #endif
>> --
>> 2.30.1
>>
>>
>> _______________________________________________
>> Gnupg-devel mailing list
>> [hidden email]
>> http://lists.gnupg.org/mailman/listinfo/gnupg-devel

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

How to open images by default (Prefer opening images with xdg-open over display)

Bernhard Reiter-7
In reply to this post by GnuPG - Dev mailing list
Am Montag, 1. März 2021, 09:38:12 CET schrieb Werner Koch via Gnupg-devel:
> This would be a regression.  display and xloadimage both allow to pass
> the title. This seems not to be possible with xdg-open.

Would it make sense to file a wish for an additional optional parameter
for xdg-open to
   https://gitlab.freedesktop.org/xdg/xdg-utils
?
Bernhard

--
www.intevation.de/~bernhard   +49 541 33 508 3-3
Intevation GmbH, Osnabrück, DE; Amtsgericht Osnabrück, HRB 18998
Geschäftsführer Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (673 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to open images by default (Prefer opening images with xdg-open over display)

Ingo Klöcker
On Dienstag, 2. März 2021 15:49:51 CET Bernhard Reiter wrote:
> Am Montag, 1. März 2021, 09:38:12 CET schrieb Werner Koch via Gnupg-devel:
> > This would be a regression.  display and xloadimage both allow to pass
> > the title. This seems not to be possible with xdg-open.
>
> Would it make sense to file a wish for an additional optional parameter
> for xdg-open to
>    https://gitlab.freedesktop.org/xdg/xdg-utils
> ?

Probably not. I guess that most of the default image viewers by KDE, Gnome,
etc., don't support a command line argument to set the window title because
those viewers are full-fledged applications and not simple tools like display
or xloadimage which simply show an image in an X window without any menu,
buttons, etc.

Regards,
Ingo

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (201 bytes) Download Attachment