Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve xdg-open behaviour #30

Closed
ghost opened this issue Sep 10, 2015 · 16 comments
Closed

Improve xdg-open behaviour #30

ghost opened this issue Sep 10, 2015 · 16 comments

Comments

@ghost
Copy link

ghost commented Sep 10, 2015

by setting XDG_CURRENT_DESKTOP=gnome in the environment and making sure that gvfs-open is installed (maybe pulled in by a gtk dependency already?).

The issue came up here: http://crunchbang.org/forums/viewtopic.php?pid=438920#p438920 & http://crunchbang.org/forums/viewtopic.php?pid=438940#p438940. The problem is that xdg-open's generic file opening procedure produces mediocre results at best. Marshalling gvfs-open could be a viable workaround and a nice configuration detail.

@hungaborhorvath
Copy link

Ok, now I am really confused. Apparently, having DE=gnome (which is basically the same as settings XDG_CURRENT_DESKTOP=gnome, seems to solve the problems I was having on_certain_sftp_servers. Same with DE=xfce. That is: if I open an sftp link to my university server, then I can open files and get back mc. However,if I open an sftp link to my raspberry pi on my local network, then somehow the file is not copied into /tmp/mc-username. The weird thing is that the file itself is probably transferred from the pi to my machine, because there is network activity, and I have to wait until the appropriate application opens. (And the waiting time seems to be proportional to the filesize.) It just is not written to disk. And then the application is launched and complains about not finding the file that should be there.

@johnraff
Copy link
Member

Improve xdg-open behaviour by setting XDG_CURRENT_DESKTOP=gnome in the environment and making sure that gvfs-open is installed

Does setting that variable actually fix the issue that user was having with mc (or possibly xdg-open)? exo-open is already available, (comes with thunar-volman) so we could also try XDG_CURRENT_DESKTOP=XFCE
I'm a little bit nervous about announcing to the whole environment that we're using GNOME, and #! users in general are more familiar with the XFCE tools. OTOH the Gnome tools are probably more sophisticated...

btw the xdg-open code you quoted is probably from a later version than what comes with Debian Jessie, where the DE options are more limited.

    if [ -n "${XDG_CURRENT_DESKTOP}" ]; then
      case "${XDG_CURRENT_DESKTOP}" in
         GNOME)
           DE=gnome;
           ;;
         KDE)
           DE=kde;
           ;;
         LXDE)
           DE=lxde;
           ;;
         XFCE)
           DE=xfce
      esac
    fi

@hungaborhorvath
Copy link

Does setting that variable actually fix the issue that user was having with mc (or possibly xdg-open)?

I tried setting the variable DE=xfce and also tried DE=gnome in the shell before starting jessie. As I wrote, the result is promising. That is: locally it behaves exactly as it should, but using an sftp link it may or may not copy over the file to /tmp/mc-username. More precisely it looks that it always copies the file to RAM, but may or may not put it to /tmp/mc-username. From Thunar I think it works as intended without setting any variables. (I vaguely remember trying this but I am not sure.)

Edit: Also tried setting XDG_CURRENT_DESKTOP=GNOME or XFCE, with the same result as setting DE=gnome or xfce.

@hhhorb
Copy link
Contributor

hhhorb commented Jan 8, 2016

Jens and John, what's your recommendation here?

@johnraff
Copy link
Member

johnraff commented Jan 8, 2016

I'd say try to use exo-open, which we already have on the system.
I'm not sure if setting XDG_CURRENT_DESKTOP to XFCE is needed or not.
Someone would have to spend some time playing with this stuff...

@2ion Jens, what do you think?

@ghost
Copy link
Author

ghost commented Jan 8, 2016

Do not leave the setting unset, set to XFCE, that is a reasonable default. I have no chance to investigate ATM but IIRC exo-open should be what the XFCE setting is triggering.


Personally, I'm using KDE here but only because I am already using KDE desktop applications. Using kde-open would launch a KDE daemon, so that'd be a suboptimal solution.

@johnraff
Copy link
Member

johnraff commented Jan 8, 2016

OK let's put XDG_CURRENT_DESKTOP=XFCE in the most appropriate file.
(...think a moment...)
~/.config/openbox/environment?
~/.xsessionrc?

@johnraff
Copy link
Member

...hold this a moment.

exo-open still fails the directory-name-with-spaces test (I just checked). On Wheezy gvfs-open failed too, but on Jessie it works OK. (On default BunsenLabs plain xdg-open (with no XDG_CURRENT_DESKTOP set) works too, because open_generic_xdg_mime() checks the bl-file-manager.desktop we installed.)

That's a different issue from what brought this question up of course, but since gvfs-open covers both:

gvfs-bin is a 444kB install. Should we add that to the default system and set XDG_CURRENT_DESKTOP=GNOME after all?

@johnraff
Copy link
Member

More complications - using either GNOME or XFCE will cause some of the .desktop files in /usr/share/applications to hide or show themselves differently. OnlyShowIn and NotShowIn refer to XDG_CURRENT_DESKTOP.
Checking my BunsenLabs install:

john@bunsen:~$ grep -r 'OnlyShowIn' /usr/share/applications
/usr/share/applications/exo-file-manager.desktop:OnlyShowIn=XFCE;
/usr/share/applications/software-properties-gnome.desktop:OnlyShowIn=GNOME;
/usr/share/applications/xfce4-notifyd-config.desktop:OnlyShowIn=XFCE;
/usr/share/applications/exo-mail-reader.desktop:OnlyShowIn=XFCE;
/usr/share/applications/synaptic-kde.desktop:OnlyShowIn=KDE;
/usr/share/applications/exo-preferred-applications.desktop:OnlyShowIn=XFCE;
/usr/share/applications/exo-terminal-emulator.desktop:OnlyShowIn=XFCE;
/usr/share/applications/exo-web-browser.desktop:OnlyShowIn=XFCE;
/usr/share/applications/rxvt-unicode.desktop:OnlyShowIn=Unity
john@bunsen:~$ grep -r 'NotShowIn' /usr/share/applications
/usr/share/applications/gdebi.desktop:NotShowIn=KDE;
/usr/share/applications/xfce4-power-manager-settings.desktop:NotShowIn=GNOME;KDE;Unity;
/usr/share/applications/synaptic.desktop:NotShowIn=KDE;
/usr/share/applications/software-properties-gtk.desktop:NotShowIn=GNOME;
/usr/share/applications/flash-player-properties.desktop:NotShowIn=KDE;
/usr/share/applications/nm-connection-editor.desktop:NotShowIn=KDE;
/usr/share/applications/lxappearance.desktop:NotShowIn=GNOME;KDE;XFCE;
/usr/share/applications/org.gnome.FileRoller.desktop:NotShowIn=KDE;
/usr/share/applications/ibus-setup.desktop:NotShowIn=GNOME;Unity;
/usr/share/applications/nm-applet.desktop:NotShowIn=KDE;

But... this: https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1212408 suggests that not having XDG_CURRENT_DESKTOP set might possibly be responsible for the suspend/locking issues some users are getting.

@ghost
Copy link
Author

ghost commented Jan 19, 2016

That's true; as I have said earlier, not having XDG_CURRENT_DESKTOP set causes all kinds of unexpected or broken in software. This also affects proprietary programs which some users might use.

While some of the settings are questionable (lxappearance not in GNOME/KDE/XFCE?), XFCE is maybe a good choice because we are using thunar as the file manager already, aren't we?

@hhhorb
Copy link
Contributor

hhhorb commented Jan 19, 2016

XFCE is maybe a good choice because we are using thunar as the file manager already, aren't we?

Thunar, as well as xfce4-volumed, xfce4-notifyd and xfce4-power-manager.

@johnraff
Copy link
Member

Yes, XFCE looks like the better choice on the whole, for compatibility.
It's a pity the LXDE devs decided not to show lxappearance if XDG_CURRENT_DESKTOP=XFCE though. It won't affect our hard-coded menu, but anyone with a dynamically generated menu will find lxappearance missing, unless we ship a modified lxappearance.desktop in skel/.local/share/applications - which would not be out of the question to do of course.

OK as for the best place to set XDG_CURRENT_DESKTOP, ~/.config/openbox/environment would apply to any session using Openbox, while ~/.xsessionrc would apply for all X sessions.

I'm starting to think that in the long term we should have a startbunsen script to hold things we want only for BunsenLabs, leaving LXDE or XFCE sessions clean. It could be triggered from a /usr/share/xsessions/bunsenlabs.desktop which we would set as default in lightdm.conf.

But that's for our next release maybe, so for now I'll put export XDG_CURRENT_DESKTOP=XFCE in skel/.config/openbox/environment if that sounds OK?

@johnraff
Copy link
Member

More reason not to use GNOME:

john@bunsen:~$ grep -r 'NotShowIn' /etc/xdg/autostart
/etc/xdg/autostart/pulseaudio.desktop:NotShowIn=KDE;
/etc/xdg/autostart/xfce4-power-manager.desktop:NotShowIn=GNOME;KDE;Unity;
/etc/xdg/autostart/nm-applet.desktop:NotShowIn=KDE;
john@bunsen:~$ grep -r 'OnlyShowIn' /etc/xdg/autostart
/etc/xdg/autostart/gsettings-data-convert.desktop:OnlyShowIn=GNOME;Unity;
/etc/xdg/autostart/gnome-keyring-secrets.desktop:OnlyShowIn=GNOME;Unity;MATE;
/etc/xdg/autostart/gnome-keyring-pkcs11.desktop:OnlyShowIn=GNOME;Unity;MATE;
/etc/xdg/autostart/pulseaudio-kde.desktop:OnlyShowIn=KDE;
/etc/xdg/autostart/xfce4-volumed.desktop:OnlyShowIn=XFCE;
/etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop:OnlyShowIn=GNOME;XFCE;Unity;
/etc/xdg/autostart/gnome-keyring-gpg.desktop:OnlyShowIn=GNOME;Unity;MATE;
/etc/xdg/autostart/gnome-keyring-ssh.desktop:OnlyShowIn=GNOME;Unity;MATE;
/etc/xdg/autostart/at-spi-dbus-bus.desktop:OnlyShowIn=GNOME;Unity;
/etc/xdg/autostart/clipit-startup.desktop:OnlyShowIn=GNOME;XFCE;LXDE;Unity;

Like, with GNOME xfce4-power-manager wouldn't be autostarted any more, and a bunch of other stuff would be...

Anyway, whichever we use, we'll have to check over all those autostarts and see if anything needs adding to or removing from openbox/autostart.

@hhhorb
Copy link
Contributor

hhhorb commented Jan 20, 2016

for now I'll put export XDG_CURRENT_DESKTOP=XFCE in skel/.config/openbox/environment if that sounds OK?

Yes, we can change this down the road if need be.

@johnraff
Copy link
Member

OK test. The variable is in the environment, but isn't affecting the OnlyShowin XFCE autostart items for some reason. More research needed...
(GNOME etc entries removed)

# With no variable set:
john@bunsen:~$ /usr/lib/i386-linux-gnu/openbox-xdg-autostart --list

[*] Screen Locker
      File: /etc/xdg/autostart/light-locker.desktop
      Executes: light-locker

[ ] XFCE Volume Daemon
      File: /etc/xdg/autostart/xfce4-volumed.desktop
      Executes: xfce4-volumed
    * Excluded by: OnlyShowIn (XFCE)

[*] vboxclient
      File: /etc/xdg/autostart/vboxclient.desktop
      Executes: /usr/bin/VBoxClient-all

[*] PulseAudio Sound System
      File: /etc/xdg/autostart/pulseaudio.desktop
      Executes: start-pulseaudio-x11

[ ] PolicyKit Authentication Agent
      File: /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop
      Executes: /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
    * Excluded by: OnlyShowIn (GNOME, XFCE, Unity)

[*] Power Manager
      File: /etc/xdg/autostart/xfce4-power-manager.desktop
      Executes: xfce4-power-manager

[*] Network
      File: /etc/xdg/autostart/nm-applet.desktop
      Executes: nm-applet

[ ] ClipIt
      File: /etc/xdg/autostart/clipit-startup.desktop
      Executes: clipit
    * Excluded by: OnlyShowIn (GNOME, XFCE, LXDE, Unity)

# and after adding XDG_CURRENT_DESKTOP=XFCE to
# ~/.config/openbox/environment:

john@bunsen:~$ echo $XDG_CURRENT_DESKTOP
XFCE
john@bunsen:~$ /usr/lib/i386-linux-gnu/openbox-xdg-autostart --list

[*] Screen Locker
      File: /etc/xdg/autostart/light-locker.desktop
      Executes: light-locker

[ ] XFCE Volume Daemon
      File: /etc/xdg/autostart/xfce4-volumed.desktop
      Executes: xfce4-volumed
    * Excluded by: OnlyShowIn (XFCE)

[*] vboxclient
      File: /etc/xdg/autostart/vboxclient.desktop
      Executes: /usr/bin/VBoxClient-all

[*] PulseAudio Sound System
      File: /etc/xdg/autostart/pulseaudio.desktop
      Executes: start-pulseaudio-x11

[ ] PolicyKit Authentication Agent
      File: /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop
      Executes: /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
    * Excluded by: OnlyShowIn (GNOME, XFCE, Unity)

[*] Power Manager
      File: /etc/xdg/autostart/xfce4-power-manager.desktop
      Executes: xfce4-power-manager

[*] Network
      File: /etc/xdg/autostart/nm-applet.desktop
      Executes: nm-applet

[ ] ClipIt
      File: /etc/xdg/autostart/clipit-startup.desktop
      Executes: clipit
    * Excluded by: OnlyShowIn (GNOME, XFCE, LXDE, Unity)

@johnraff
Copy link
Member

Re: above:
/usr/lib/i386-linux-gnu/openbox-xdg-autostart --help

Usage: openbox-xdg-autostart [OPTION]... [ENVIRONMENT]...
ENVIRONMENT specifies a list of environments for which to run autostart
applications. If none are specified, only applications which do not
limit themselves to certain environments will be run.
ENVIRONMENT can be one or more of:
GNOME Gnome Desktop
KDE KDE Desktop
ROX ROX Desktop
XFCE XFCE Desktop
Old Legacy systems

So it's not referring to $XDG_CURRENT_DESKTOP but wants the environment passed as an argument.
(Tested by running /usr/lib/i386-linux-gnu/openbox-xdg-autostart --list XFCE)

Which means our current openbox/autostart entries won't be affected by setting that variable and can stay as they are.

Panic over, I'll just go ahead and set it in openbox/environment in bunsen-configs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants