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

Added -q option to terminal page #96

Open
wants to merge 4 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
1 change: 1 addition & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ namespace Ilia {
stdout.printf("\npages:\n");
stdout.printf("\t'apps' - launch desktop applications (default)\n");
stdout.printf("\t'terminal' - launch a terminal command\n");
stdout.printf("\t\t-q: quiet execution\n");
stdout.printf("\t'notifications' - launch notifications manager\n");
stdout.printf("\t'keybindings' - launch keybindings viewer\n");
stdout.printf("\t'textlist' - select an item from a specified list\n");
Expand Down
16 changes: 13 additions & 3 deletions src/commands/CommandPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace Ilia {

private Gtk.TreePath path;

private bool quiet = false;

public string get_name() {
return "<u>C</u>ommands";
}
Expand Down Expand Up @@ -53,6 +55,9 @@ namespace Ilia {
this.entry = entry;
this.session_controller = sessionController;

if (arg_map.contains("-q"))
this.quiet = true;

model = new Gtk.ListStore(ITEM_VIEW_COLUMNS, typeof (string), typeof (string));

filter = new Gtk.TreeModelFilter(model, null);
Expand Down Expand Up @@ -219,9 +224,14 @@ namespace Ilia {
// TODO ~ Enable two launch modes with some modifier. By default terminal exits when program exits.
// todo is to add another mode in which the terminal does not exit after program completes.

// string commandline = "/usr/bin/x-terminal-emulator -e \"bash -c '" + cmd_path + "; exec bash'\"";
// string commandline = "x-terminal-emulator -e \"bash -c '" + cmd_path + "'\"";
string commandline = "x-terminal-emulator -e '" + cmd_path + "'";
string commandline;
if (this.quiet)
// if -q is given, call cmd_path without opening a terminal emulator
commandline = cmd_path;
else
// commandline = "/usr/bin/x-terminal-emulator -e \"bash -c '" + cmd_path + "; exec bash'\"";
// commandline = "x-terminal-emulator -e \"bash -c '" + cmd_path + "'\"";
commandline = "x-terminal-emulator -e '" + cmd_path + "'";

// stdout.printf("%s\n", commandline);

Expand Down