From 41ff93c3435246eab99ef52c87da5a9e00288419 Mon Sep 17 00:00:00 2001 From: JakeIsMeh Date: Sat, 3 Sep 2022 06:32:28 +0800 Subject: [PATCH 1/3] Fix the opening of files in the terminal --- src/file_item.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/file_item.vala b/src/file_item.vala index 38fbeb8..3661fe9 100644 --- a/src/file_item.vala +++ b/src/file_item.vala @@ -275,9 +275,9 @@ public class FileItem : DesktopItem { args += editor; args += path; } else { + string[] cmd = { editor, path }; args += "-e"; - args += editor; - args += path; + args += string.joinv(" ", cmd); // join command so that it is one argument } } From d8b108da2cbf960036504e42eeefe81f52a91518 Mon Sep 17 00:00:00 2001 From: JakeIsMeh Date: Sat, 3 Sep 2022 06:37:05 +0800 Subject: [PATCH 2/3] Rework terminal tab logic; Add xfce4-terminal --- src/budgie_desktop_view.vala | 5 +++-- src/file_item.vala | 29 +++++++++++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/budgie_desktop_view.vala b/src/budgie_desktop_view.vala index d9aaeab..426b0e6 100644 --- a/src/budgie_desktop_view.vala +++ b/src/budgie_desktop_view.vala @@ -42,7 +42,8 @@ public const string[] SUPPORTED_TERMINALS = { "konsole", "mate-terminal", "terminator", - "tilix" + "tilix", + "xfce4-terminal" }; public class DesktopView : Gtk.ApplicationWindow { @@ -475,7 +476,7 @@ public class DesktopView : Gtk.ApplicationWindow { // get_all_desktop_files will get all the files in our Desktop folder and generate items for them private void get_all_desktop_files() { var c = new Cancellable(); // Create a new cancellable stack - FileEnumerator? desktop_file_enumerator = null; + FileEnumerator? desktop_file_enumerator = null; try { desktop_file_enumerator = desktop_file.enumerate_children("standard::*,standard::display-name", FileQueryInfoFlags.NONE, c); diff --git a/src/file_item.vala b/src/file_item.vala index 3661fe9..4138a82 100644 --- a/src/file_item.vala +++ b/src/file_item.vala @@ -233,16 +233,25 @@ public class FileItem : DesktopItem { // konsole supports --new-tab and -e, --workdir WITHOUT equal // kitty supports --directory WITH equal // terminator supports --new-tab and -e, --working-directory (no -w) WITH equal - // tilix uses just -e, supports both --working-directory and -w WITH equal - if ( - (preferred_terminal != "alacritty") && // Not Alacritty, no tab CLI flag - (preferred_terminal != "gnome-terminal") && // Not GNOME Terminal which uses --tab instead of --new-tab - (preferred_terminal != "tilix") && // No new tab CLI flag (that I saw anyways) - (preferred_terminal != "kitty") // No new tab CLI flag for Kitty, either - ) { - args += "--new-tab"; // Add --new-tab - } else if ((preferred_terminal == "gnome-terminal") && (_type == "file")) { // GNOME Terminal, self explanatory really - args += "--tab"; // Create a new tab in an existing window or creates a new window + // xfce4-terminal supports -e, --tab, --window, and --working-directory (no -w) WITH equal + + switch (preferred_terminal) { + // Terminals that use --tab + case "gnome-terminal": + case "mate-terminal": + case "xfce4-terminal": + args += "--tab"; + break; + + // Terminals that use --new-tab + case "konsole": + case "terminator": + args += "--new-tab"; + break; + + // Terminals that don't support tabs + default: + break; } string path = file.get_path(); From 3609d4ec2699990ed836fa3c8b2692cbfbf2fd98 Mon Sep 17 00:00:00 2001 From: JakeIsMeh Date: Sat, 3 Sep 2022 18:52:51 +0800 Subject: [PATCH 3/3] Handle GNOME Terminal quirk --- src/file_item.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/file_item.vala b/src/file_item.vala index 4138a82..b4917b5 100644 --- a/src/file_item.vala +++ b/src/file_item.vala @@ -228,7 +228,8 @@ public class FileItem : DesktopItem { string[] args = { preferred_terminal }; // Add our preferred terminal as first arg // alacritty supports -e, --working-directory WITHOUT equal - // gnome-terminal supports --tab and --working-directory (no -w) WITH equal, but not -e + // gnome-terminal supports --working-directory (no -w) WITH equal, but not -e + // --tab is used for specifying tabs in a new window // mate-terminal supports --tab and -e, --working-directory (no -w) WITH equal // konsole supports --new-tab and -e, --workdir WITHOUT equal // kitty supports --directory WITH equal @@ -237,7 +238,6 @@ public class FileItem : DesktopItem { switch (preferred_terminal) { // Terminals that use --tab - case "gnome-terminal": case "mate-terminal": case "xfce4-terminal": args += "--tab";