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

[bug]: xdg-open on Plasma 6 Wayland: Invalid environment block #668

Open
1 task done
xfzv opened this issue Sep 3, 2024 · 0 comments
Open
1 task done

[bug]: xdg-open on Plasma 6 Wayland: Invalid environment block #668

xfzv opened this issue Sep 3, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@xfzv
Copy link

xfzv commented Sep 3, 2024

What happened?

Plasma 6 was recently stabilized on Gentoo.

After updating (using Wayland session), I'm getting the following error every time I try to open a mimetype that use a Plasma app as default, e.g.

  • Gwenview for images:
% xdg-open example.png
kf.kio.gui: Failed to launch process as service: "[email protected]" "org.freedesktop.DBus.Error.InvalidArgs" "Invalid environment block."
Invalid environment block.
Exited with status code: 4
Process failed
  • Okular for PDFs:
% xdg-open example.pdf
kf.kio.gui: Failed to launch process as service: "[email protected]" "org.freedesktop.DBus.Error.InvalidArgs" "Invalid environment block."
Invalid environment block.
Exited with status code: 4
Process failed

After digging further, I eventually found that the problem can be solved by either:

  • disabling all plug-ins loading in zinit
  • keeping plug-ins loading in zinit but disabling ALL_EXPORT Zsh option:

man 1 zshoptions

   Initialisation
       ALL_EXPORT (-a, ksh: -a)
              All parameters subsequently defined are automatically exported.

My zinit config:

declare -A ZINIT
ZINIT[HOME_DIR]="$XDG_DATA_HOME/zsh/zinit"
ZINIT[BIN_DIR]="${ZINIT[HOME_DIR]}/bin"
ZINIT[COMPINIT_OPTS]=-C
ZINIT[NO_ALIASES]=1
ZINIT[ZCOMPDUMP_PATH]="${XDG_CACHE_HOME}/zsh/zcompdump"
ZSH_CACHE_DIR="${XDG_CACHE_HOME}/zsh/zinit"

[[ -e "${ZINIT[HOME_DIR]}" ]] || git clone https://github.com/zdharma-continuum/zinit "${ZINIT[BIN_DIR]}"

source "${ZINIT[BIN_DIR]}/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

zinit ice depth=1 ; zinit light romkatv/powerlevel10k
zinit ice depth=1 ; zinit light jeffreytse/zsh-vi-mode
zinit light zdharma-continuum/history-search-multi-word
zinit ice lucid wait has'fzf'
zinit light Aloxaf/fzf-tab
zinit snippet https://github.com/intrntbrn/icon_customizer/raw/master/dynamictitles.zsh

if [[ ! -d "${XDG_CACHE_HOME}/zsh/fsh" ]]; then
  mkdir "${XDG_CACHE_HOME}/zsh/fsh"
fi

zicompinit
zicdreplay

zinit wait lucid for \
  atinit"FAST_WORK_DIR=${XDG_CACHE_HOME}/zsh/fsh" \
  zdharma-continuum/fast-syntax-highlighting \
  atload"!_zsh_autosuggest_start" \
  zsh-users/zsh-autosuggestions

If I only use this (without any plug-ins loading), no issue:

declare -A ZINIT
ZINIT[HOME_DIR]="$XDG_DATA_HOME/zsh/zinit"
ZINIT[BIN_DIR]="${ZINIT[HOME_DIR]}/bin"
ZINIT[COMPINIT_OPTS]=-C
ZINIT[NO_ALIASES]=1
ZINIT[ZCOMPDUMP_PATH]="${XDG_CACHE_HOME}/zsh/zcompdump"
ZSH_CACHE_DIR="${XDG_CACHE_HOME}/zsh/zinit"

[[ -e "${ZINIT[HOME_DIR]}" ]] || git clone https://github.com/zdharma-continuum/zinit "${ZINIT[BIN_DIR]}"

source "${ZINIT[BIN_DIR]}/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

if [[ ! -d "${XDG_CACHE_HOME}/zsh/fsh" ]]; then
  mkdir "${XDG_CACHE_HOME}/zsh/fsh"
fi

zicompinit
zicdreplay

Steps to reproduce

  1. Run Plasma 6 with Wayland
  2. Use the full zinit config mentioned above with Zsh option setopt ALL_EXPORT
  3. Try to open any file that use any KDE Plasma app as default opener with xdg-open $file.ext
  4. The Invalid environment block. mentioned error is printed
  5. Remove setopt ALL_EXPORT and run xdg-open $file.ext again: no error
  6. Add setopt ALL_EXPORT again and only keep the second zinit config (without any plug-in loading)
  7. Run xdg-open $file.ext: no error

Relevant output

No response

Screenshots and recordings

No response

Operating System & Version

OS: linux-gnu | Vendor: pc | Machine: x86_64 | CPU: x86_64 | Processor: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz | Hardware: x86_64

Zsh version

zsh 5.9 (x86_64-pc-linux-gnu)

Terminal emulator

xterm-kitty

If using WSL on Windows, which version of WSL

None

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@xfzv xfzv added the bug Something isn't working label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants