Hello,
Tumbleweed KDE Plasma
I have a Pyhton_script that should open a Zenity file_selector window.
It was working for a while but lately ( probably afther an update) it opens in xdg-desktop-portal-kde window.
On the other hand Yad open normal in a Yad_window
Where can i change it back to open in Zenity.
Thnks, rudi
It would probably be helpful if you shared the script. It’s really difficult to diagnose a programming issue without seeing the code.
import os
import subprocess
# Ask user to select a folder using Zenity
folder_path = subprocess.run(
["zenity", "--file-selection", "--directory", "--title=Select Folder to Rename .RGT Files"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
).stdout.strip()
# If no folder is selected, exit
if not folder_path:
subprocess.run(["zenity", "--error", "--text=No folder selected. Exiting."])
exit(1)
# Loop through files in the selected folder
for file in os.listdir(folder_path):
full_file_path = os.path.join(folder_path, file)
# Skip directories
if os.path.isdir(full_file_path):
continue
# Check if the file has .RGT extension (uppercase) and rename it to .rgt (lowercase)
if file.lower().endswith(".rgt") and not file.endswith(".rgt"):
new_name = file[:-4] + ".rgt" # Keep the filename, change only extension to lowercase
new_file_path = os.path.join(folder_path, new_name)
os.rename(full_file_path, new_file_path)
# Show success message
subprocess.run(["zenity", "--info", "--text=All .RGT files renamed to .rgt!"])
So , i have about 10 scripts, they where all working once opening with Zenity.
Now they open in xdg-desktop-portal-kde .
It looks like you’re explicitly calling zenity. What is the output of:
ls -l `which zenity`
How is this particular script invoked, and what version of python are you using?
-rwxr-xr-x 1 root root 140104 Jan 31 18:55 /usr/bin/zenity
python3.12 script.py
Zenity is showing the error and success boxes , only file or folder select is by xdg
What is the output of:
rpm -qi zenity
Name : zenity
Version : 4.1.90
Release : 1.1
Architecture: x86_64
Install Date: Mon Apr 7 09:19:22 2025
Group : System/GUI/GNOME
Size : 544055
License : LGPL-2.1-or-later
Signature : RSA/SHA512, Tue Mar 18 20:52:08 2025, Key ID 35a2f86e29b700a4
Source RPM : zenity-4.1.90-1.1.src.rpm
Build Date : Fri Jan 31 18:55:44 2025
Build Host : reproducible
Packager : https://bugs.opensuse.org
Vendor : openSUSE
URL : https://wiki.gnome.org/Projects/Zenity
Summary : GNOME Command Line Dialog Utility
Description :
Zenity is a basic rewrite of gdialog, without the pain involved of
trying to figure out commandline parsing. Zenity is zen-like; simple
and easy to use.
Zenity Dialogs: Calendar, Text Entry, Error, Informational, File
Selection, List, Progress, Question, Text Information, Warning and
Password.
Zenity is especially useful in scripts.
Distribution: openSUSE Tumbleweed
That’s the same version I’ve got installed.
How are you determining that it’s opening in xdg-desktop-portal-kde?
I tried running your code on my system, and it seemed to work as intended. I’m running on a GNOME desktop (it seems you’re maybe running on KDE?). Are you running it locally?
Yes, runnig KDE , the window show top left corner a KDE icon, when right_click this icon , select more actions, click “Configure special application settings” i show xdg-desktop-portal-kde. It should be Zenity.
Zenity uses the system dialog for the picker, and since you’re using KDE, that’s the system dialog you’re seeing.
It doesn’t create new dialog windows for all of its different types - it uses what the system makes available.
Similarly, when running it on GNOME, you see the GNOME file selector dialog.
As far as I can tell, this is the expected behavior.
Using kdialog --getexistingdirectory
results in the same dialog (kdialog is the KDE equivalent of Zenity, which is really written for GTK).
Firefox’s about:config
widget.use-xdg-desktop-portal.file-picker
=1 uses kde
widget.use-xdg-desktop-portal.file-picker
=0 uses gtk
i need to change something for Zenity, xdg-desktop-portal ?
Yad is opening correct by gtk, Zenity is highjacked by xdg-desktop-portal-kde.
Why, that’s the ?
Can’t say that I have any idea. Maybe someone else who does will hop in. I don’t think it’s being “hijacked”, though. I think it’s a system behavior that’s doing what it’s supposed to, but it’s not immediately clear why.
The code is available at the GNOME gitlab server (GNOME / zenity · GitLab) - maybe a look at that would provide some insight.
ETA: Something you might try is setting the environment variable (either in your code or before running it) XDG_CURRENT_DESKTOP to “GNOME”. After a little digging, it seems this might help you get the result you’re looking for.
What does this mean exactly, is it a line in the script trigger this or you typing a command? If so, which line of the script/which command?
[quote="bismarel, post:12, topic:184285"]
top left corner a KDE icon, when right_click this icon , select more actions, click “Configure special application settings” i show xdg-desktop-portal-kde. It should be Zenity.
[/quote]
It used to work opening in a Zenity_window. Something changed with an update?
I tried a “launcher” and insert a line in my script, no result
`#!/bin/bash
launcher.sh
export GTK_USE_PORTAL=0
python3.12 “$@”`
# Disable KDE file chooser portal
os.environ["GTK_USE_PORTAL"] = "0"
# Set the XDG_CURRENT_DESKTOP environment variable
os.environ['XDG_CURRENT_DESKTOP'] = 'GNOME'