gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
openSelectedFolder() { const nautilus =…
- User
openSelectedFolder() { const nautilus = Shell.AppSystem.get_default().lookup_app('org.gnome.Nautilus'); const currentFolderPath = nautilus.get_window().get_selection().get_nth_file(0).get_path();
const vscodeCommand = `code -n ${GLib.shell_quote(currentFolderPath)}`; GLib.spawn_command_line_async(vscodeCommand);} change this method to first check if nautilus is open and only then do everything else
- Assistant
openSelectedFolder() { const nautilus = Shell.AppSystem.get_default().lookup_app('org.gnome.Nautilus');
if (nautilus && nautilus.get_state() === Shell.AppState.RUNNING) { const currentFolderPath = nautilus.get_window().get_selection().get_nth_file(0).get_path(); const vscodeCommand = `code -n ${GLib.shell_quote(currentFolderPath)}`; GLib.spawn_command_line_async(vscodeCommand); } else { console.log("Nautilus is not open."); // Handle the case when Nautilus is not open }}