p-e-w / argos

Create GNOME Shell extensions in seconds
https://extensions.gnome.org/extension/1176/argos/
1.68k stars 114 forks source link

Command chaining/calling sudo in bash attribute #90

Open calexandru2018 opened 5 years ago

calexandru2018 commented 5 years ago

I am running Manjaro 18. The Argos script runs well won simple files/programs, but it gets a bit querky when sudo is needed or a script needs additional arguments.

I am configuring to run "sudo /opt/lampp/lampp start" but this get truncated at "sudo", if I type in the bash value to be "/opt/lampp/lampp start" then the value gets truncated at "/opt/lampp/lampp" so, no command is run. It seems that the script truncates all whitespaces, even if they are in quotes and/or double quotes.

maxjf1 commented 5 years ago

I had an similar problem and solved it using this


echo "My button | bash='pkexec sh -c \"command-a && command-b\"' terminal=false"
santrancisco commented 5 years ago

So i think i may have a decent template for these kind of complex task where you actually want to build a bash function and run it. I have documented it in the wiki here.

TLDR: If no argument is supplied, the script echo the menu. The bash values actually just call the argos script itself with a function name. When run with a function name + argument, the script skip echoing out the menu but simply call the function with its argument.