Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for xfce4-terminal #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/budgie_desktop_view.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public const string[] SUPPORTED_TERMINALS = {
"konsole",
"mate-terminal",
"terminator",
"tilix"
"tilix",
"xfce4-terminal"
};

public class DesktopView : Gtk.ApplicationWindow {
Expand Down Expand Up @@ -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);
Expand Down
35 changes: 22 additions & 13 deletions src/file_item.vala
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,30 @@ 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
// 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 "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();
Expand Down Expand Up @@ -275,9 +284,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
}
}

Expand Down