I recently asked this question about adding a shell script to Dash:
In 14.04 how do I run a bash script I wrote without opening a terminal?
It worked perfectly.
Follow-up question: How can I pass command-line arguments through Dash? Example: In this case, my dash command is named "Panel". The script panels my screen with 8 terminals. Here's an example of the usage:
panel # Tile the screen with 8 terminal windows.
panel --left # Tile the left side with 4 terminals
panel --right # Tile the right side with 4 terminals
And so on. How can I pass arguments like --left
or --right
through Dash? Ideally I'd like to have this workflow:
- Press the SUPER key
- Type
panel --left
(for example) - Dash goes away and the left side is paneled.
Right now it runs the right script, but ignores --left
.
Tips?
Best Answer
The problem is that you cannot "run" a
.desktop
file from Dash with arguments, so the setup exactly like you have in mind is impossible I am afraid. However, assuming your script does take arguments, there are a few elegant alternative options, maybe even better:Save your script in
~/bin
run it by pressing AltF2, type the command
Create a quicklist in the Unity launcher:
(assuming you saved the script in
~/bin
, made it executable and removed the extension as in 1.)Save it as
panel.desktop
in~/.local/share/applications
and drag it on to the launcher.Create three different keyboard shortcuts, for example Alt+<, Alt+^, Alt+> to run your script+arguments:
"System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts"
Click "+" to add your commands:
<scriptname> <argument>
Not the most obvious one, but exploring the options, it should be mentioned: you can call a (zenity) option list from Dash:
Type the first character of your option, press return and your script will run with the chosen argument.
Again assuming that you saved the script in ~/bin, made it executable and removed the language extension as in 1.:
Copy the script below into an empty file, save it as
panel_options.sh
, make it executable.Create the .desktop file from the code below. In the
Icon=
line, set the path to your icon, in theExec=
line the path topane_options.sh
, save it aspanel.desktop
in~/.local/share/applicatios