Something like
xdg-open path
Gio.open(path)
There is not enough information.
Please explain what you’re trying to achieve.
export var imagePath = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES);
const menu_browse = new PopupMenu.PopupImageMenuItem('Browse', 'folder-directory-symbolic', {});
menu_browse.connect('activate', () => {
//FIX ME
//xdg-open $imagePath
});
this._indicator.menu.addMenuItem(menu_browse);
You can use gtk_file_dialog_set_initial_folder()
.
Refer:
File chooser dialog is not open action.
The example reads more like gnome-shell extension code, so using gtk would be wrong. For gnome-shell this is what is usually done:
Gio.app_info_launch_default_for_uri(imagePath, global.create_app_launch_context(0, -1));
Uri need ‘file://’ scheme
let uri = 'file://' + imagePath;
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));