command-tile: fix SIGSEGV and env variable passing

parent 75007967
......@@ -6,6 +6,9 @@ namespace XimperShellNotificationCenter.Widgets {
public CommandTile (Json.Object ?cfg) {
string icon_name = "application-x-executable-symbolic";
string label = "";
string cmd = "";
string ucmd = "";
bool initial_active = false;
if (cfg != null) {
string ?i = cfg.get_string_member_with_default (
......@@ -18,15 +21,18 @@ namespace XimperShellNotificationCenter.Widgets {
} else {
warning ("Command tile missing 'label'");
}
command = cfg.get_string_member_with_default (
cmd = cfg.get_string_member_with_default (
"command", "");
update_command = cfg.get_string_member_with_default (
ucmd = cfg.get_string_member_with_default (
"update-command", "");
active = cfg.get_boolean_member_with_default (
initial_active = cfg.get_boolean_member_with_default (
"active", false);
}
base (icon_name, label);
command = cmd;
update_command = ucmd;
active = initial_active;
}
public override void on_toggle () {
......
......@@ -304,12 +304,7 @@ namespace XimperShellNotificationCenter {
spawn_env += additions;
}
string[] argvp;
Shell.parse_argv ("/bin/sh -c \"%s\"".printf (cmd), out argvp);
if (argvp[0].has_prefix ("~")) {
argvp[0] = Environment.get_home_dir () + argvp[0].substring (1);
}
string[] argvp = { "/bin/sh", "-c", cmd };
Pid child_pid;
int std_output;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment