Open probonopd opened 3 years ago
Possibly kgtk could be used.
Blocked by: https://github.com/sandsmark/kgtk/issues/12
@Vogtinator has made something like this before: https://gitlab.com/Vogtinator/qtkdialog
Hack to get Qt file dialogs into some applications like virt-manager
qtkdialog compiles with no issues on FreeBSD. But I could not get the override to work yet (am I doing it wrong?).
This didn't immediately work, more investigation needed:
FreeBSD% env LD_DEBUG=libs LD_PRELOAD=$(readlink -f libqtkdialog.so.1.0) /Applications/Chromium\ 94.0.4606.81.app/Chromium\ 94.0.4606.81 2>&1 | grep -e chooser
Most likely we need to override (some of) those:
FreeBSD% strings "/Applications/Chromium 94.0.4606.81.app/Resources/usr/local/share/chromium/chrome" | grep gtk_file_chooser
gtk_file_chooser_dialog_new
gtk_file_chooser_get_files
gtk_file_chooser_set_current_folder
gtk_file_chooser_set_filename
gtk_file_chooser_list_filters
gtk_file_chooser_get_filename
gtk_file_chooser_get_filenames
gtk_file_chooser_get_preview_filename
gtk_file_chooser_set_preview_widget_active
gtk_file_chooser_set_preview_widget
gtk_file_chooser_set_do_overwrite_confirmation
gtk_file_chooser_get_filters
gtk_file_chooser_get_type
gtk_file_chooser_add_filter
gtk_file_chooser_get_file
gtk_file_chooser_get_filter
gtk_file_chooser_set_create_folders
gtk_file_chooser_set_current_name
gtk_file_chooser_set_file
gtk_file_chooser_set_filter
gtk_file_chooser_set_select_multiple
env LD_DEBUG=libs /Applications/Chromium\ 94.0.4606.81.app/Chromium\ 94.0.4606.81 2>&1 | grep -e chooser
doesn't show any gtk_file_chooser_...
invocations; why?
Possibly one needs gdb
or lldb
to find out what is going on...
Possibly also helpful: https://github.com/danni/gobject-list
A simple LD_PRELOAD library for tracking the lifetime of GObjects. When loaded into an application, it prints a list of living GObjects on exiting the application
Note that some applications (e.g., GIMP) have additional checkboxes in Save dialogs, so replacing them with Qt default ones may not be the most sensible approach.
@Vogtinator has made something like this before: https://gitlab.com/Vogtinator/qtkdialog
Hack to get Qt file dialogs into some applications like virt-manager
qtkdialog compiles with no issues on FreeBSD. But I could not get the override to work yet (am I doing it wrong?).
This didn't immediately work, more investigation needed:
FreeBSD% env LD_DEBUG=libs LD_PRELOAD=$(readlink -f libqtkdialog.so.1.0) /Applications/Chromium\ 94.0.4606.81.app/Chromium\ 94.0.4606.81 2>&1 | grep -e chooser
Most likely we need to override (some of) those:
...
Yeah, qtkdialog was written mainly for virt-manager and works with some other applications (IIRC e.g. inkscape) by chance as well. It's a simpler design than kgtk and only supports applications which call gtk_run_dialog
in a blocking way. Chromium shows file dialog instances and runs them as part of the main event loop instead and also opens GTK libraries dynamically.
Generally, I recommend building up on the existing support for portals, which is the (barely) accepted way for GTK applications to actually attempt integration. Maybe it's possible to force portals even for applications which don't use GtkFileChooserNative
.
Apparently this can be done using
LD_PRELOAD
:https://github.com/sandsmark/kgtk
Maybe we can do something similar.