Skip to content

Instantly share code, notes, and snippets.

@leucos
Created February 6, 2012 10:18
Show Gist options
  • Save leucos/1751320 to your computer and use it in GitHub Desktop.
Save leucos/1751320 to your computer and use it in GitHub Desktop.
Quoting problems with i3-sensible-terminal
My $TERMINAL is set to "gnome-terminal"
When introducing a typo in my i3 config, the nagbar is started this way (as seen in processes) :
i3-nagbar -t error -m You have an error in your i3 config file! -b edit config i3-sensible-terminal -e sh -c "i3-sensible-editor \"/home/user/.i3/config\" && i3-msg reload" -b show errors i3-sensible-terminal -e i3-sensible-pager "/tmp/i3-user.6swBVu/errorlog.11524"
Clicking 'edit config' or 'show errors' spaws a new window that disappear immediately.
The problem is that gnome-terminal expects a single argument after '-e', while other terminals are ok with that since -e is the last argument that can appear on their command line. Thus, the whole `sh -c "i3-sensible-editor \"/home/user/.i3/config\"` should be quoted.
When trying from a command line, it works quoted, it doesn't unquoted.
The attached diff should solve the problem for gnome-terminal.
diff --git a/src/cfgparse.y b/src/cfgparse.y
index 073ff24..6d7337a 100644
--- a/src/cfgparse.y
+++ b/src/cfgparse.y
@@ -286,8 +286,8 @@ static void start_configerror_nagbar(const char *config_path) {
if (configerror_pid == 0) {
char *editaction,
*pageraction;
- sasprintf(&editaction, "i3-sensible-terminal -e sh -c \"i3-sensible-editor \\\"%s\\\" && i3-msg reload\"", config_path);
- sasprintf(&pageraction, "i3-sensible-terminal -e i3-sensible-pager \"%s\"", errorfilename);
+ sasprintf(&editaction, "i3-sensible-terminal -e 'sh -c \"i3-sensible-editor \\\"%s\\\" && i3-msg reload\"'", config_path);
+ sasprintf(&pageraction, "i3-sensible-terminal -e 'i3-sensible-pager \"%s\"'", errorfilename);
char *argv[] = {
NULL, /* will be replaced by the executable path */
"-t",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment