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

runtime.c: Set XDG_DATA_DIRS if it is empty to begin with #481

Open
Juniorsnet opened this issue Sep 20, 2017 · 11 comments
Open

runtime.c: Set XDG_DATA_DIRS if it is empty to begin with #481

Juniorsnet opened this issue Sep 20, 2017 · 11 comments

Comments

@Juniorsnet
Copy link

I have a GTK# mono APP, in ubuntu and debian runs without problems.
However in manjaro 17.0.2 I have problems with GTK theme, get errors loading png icons.

** (SerialTerminal:1190): WARNING **: Pixbuf theme: Cannot load pixmap file /usr/share/themes/Vertex-Maia-Dark/gtk-2.0/Entry/entry-border-fill.png: No se pudo reconocer el formato de imagen del archivo «/usr/share/themes/Vertex-Maia-Dark/gtk-2.0/Entry/entry-border-fill.png»


(SerialTerminal:1190): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(SerialTerminal:1190): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

** (SerialTerminal:1190): WARNING **: Invalid borders specified for theme pixmap:
        /usr/share/themes/Vertex-Maia-Dark/gtk-2.0/Entry/entry-border-fill.png,
borders don't fit within the image

runing the application directly whitout create appimage load the icons correctly, so the problem is the XDG_DATA_DIRS, in manajro this variable is not set so when AppRun loader set the XDG_DATA_DIRS put only one path in the variable, and the icons can't be loaded.
adding
export XDG_DATA_DIRS=$(printenv XDG_DATA_DIRS):/usr/local/share:/usr/share
to my app bash script solves de problem.

However I thing that the AppRun loader must set correctly de XDG_DATA_DIRS.

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

@probonopd
Copy link
Member

As you can see AppRun.c appends the path inside the AppImage to the path the system provides. I think the bug here is that Manjaro does not set the variable.

AppImageKit/AppRun.c

Lines 172 to 173 in ed13661

old_env = getenv("XDG_DATA_DIRS") ?: "";
snprintf(new_env[4], length, "XDG_DATA_DIRS=%s/usr/share/:%s", appdir, old_env);

But you can use your own AppRun bash script instead of AppRun.c.

@azubieta
Copy link
Contributor

Closing it due inactivity. Reopen if required.

@probonopd probonopd changed the title GTK# Theme error when XDG_DATA_DIRS is unset runtime.c: Set XDG_DATA_DIRS if it is empty to begin with Nov 24, 2018
@probonopd
Copy link
Member

I guess we need to set some XDG_DATA_DIRS initial value if it is empty to begin with.

@probonopd probonopd reopened this Nov 24, 2018
@TheAssassin
Copy link
Member

Then, all XDG vars need to be set. And we cannot guarantee that this will work. It might even break.

I think this counts as "you need to write an AppRun to solve this", and would rather document when and how to write an AppRun script on https://docs.appimage.org.

@probonopd
Copy link
Member

Why not set all XDG variables to their default values in case they are empty?

@TheAssassin
Copy link
Member

TheAssassin commented Nov 24, 2018

What "default values"? If any, you need to append to the existing values.

@probonopd
Copy link
Member

For example, XDG_DATA_DIRS=/usr/share might be a sane default that we could append to, in case the variable was entirely unpopulated before.

@TheAssassin
Copy link
Member

Is that relative to the AppDir?

@probonopd
Copy link
Member

No. Which is why I wrote that we should append our (relative) path to that.

@TheAssassin
Copy link
Member

TheAssassin commented Nov 24, 2018

We shouldn't invent defaults outside the scope of the AppImage. Especially since there's default values specified by XDG. Those directories are part of that.

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html:

$XDG_DATA_DIRS defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory. The directories in $XDG_DATA_DIRS should be seperated with a colon ':'.

If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.

@JonathanHuot
Copy link

JonathanHuot commented Oct 2, 2022

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

5 participants