Search code examples
bashkeyboard-shortcutsgnomegnome-terminal

Gnome Shortcut: Failed to execute child process "if" (No such file or directory)


I tried to write a one-liner to toggle my panel on and off.

if [ $(dconf read /org/gnome/shell/extensions/dash-to-panel/intellihide) = "false" ]; then dconf write /org/gnome/shell/extensions/dash-to-panel/intellihide true; else dconf write /org/gnome/shell/extensions/dash-to-panel/intellihide false; fi

Formatted for readability:

if [ $(dconf read /org/gnome/shell/extensions/dash-to-panel/intellihide) = "false" ];
then
    dconf write /org/gnome/shell/extensions/dash-to-panel/intellihide true;
else
    dconf write /org/gnome/shell/extensions/dash-to-panel/intellihide false;
fi

It works when run in zsh or bash, but not when run with a gnome keyboard-shortcut. When I tried to run it with gnome-terminal -e <command> it said

Failed to execute child process "if" (No such file or directory).

Which file/directory is the error message referring to?


Solution

  • Your code seems perfectly fine. I had the same problem and after trying out different things I realized it was actually working. This gnome extension works in such a way, that when intellihide is activated the panel only disappears when a window is obstructed by it. Try maximizing a window and running your toggler.