Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple plug-in system for file context menu #5

Closed
wants to merge 2 commits into from
Closed

Simple plug-in system for file context menu #5

wants to merge 2 commits into from

Conversation

puux
Copy link
Contributor

@puux puux commented Jul 10, 2016

I would like to add a very simple scripting support in the file context menu.

preview

How it works?

  1. Create ~/.gnome-commander/scripts/ directory
  2. Create shell script in this place, like as:

!/bin/sh

name: Make tar gz

tar -cf archive.tar.gz $@ -z

  1. Open file context menu and click "Make tar gz"

Script properties
The following properties can be inserted in the header of the script:

name - the name of the menu item
term - run the script in a terminal window

Property format: #[prop name]: [value]

Additional features
If you press the Shift key, the script called for each selected file. Otherwise, the script transmitted the names of all selected files as arguments.

Script examples
Duplicate selected files:

!/bin/sh

name: Duplicate

for n in $@
do
cp $n "1_$n"
done

Create file list:

!/bin/sh

name: File list

term: true

echo "Enter file name:"
read list

for n in $@
do
echo "$n" >> $list.txt
done

Move files to trash

!/bin/sh

name: Move to trash

for n in $@
do
mv $n ~/.local/share/Trash/
done

Please tell me which folder to put the script examples in the repository, so they can be used by other people?

TODO

  • custom icons in popup menu
  • support folders as submenu

@turboscholz
Copy link
Contributor

turboscholz commented Jul 10, 2016

Hey, this is a cool feature, too. For the moment you can put the scripts into "gcmd-scripts" in the top directory, I would say.

@puux
Copy link
Contributor Author

puux commented Jul 10, 2016

Added :)

@turboscholz
Copy link
Contributor

I added the samples. Very nice. :) We could/should add a section in the documentation also for giving the user a hint about the new features. Maybe also on the homepage, where we can link to the sample scripts in the repository.

@puux
Copy link
Contributor Author

puux commented Jul 12, 2016

I can help with the Russian documentation , where can I do it ? For the English version, we can take the first post and supplement it .

@puux puux closed this Jul 12, 2016
@turboscholz
Copy link
Contributor

Sure, I'll adapt it and it will be translated later on by the Gnome translation team. Don't worry.

The documentation is located in doc/C/gnome-commander.xml and it's translation is located in the po-files in po/. At Gnome the translation is done by language teams at https://l10n.gnome.org/. There exists also a team for the Russian language which you might contact, they can definitely show you how to start translating. Indeed, you are so good at programming, I would suggest to don't waste your time too much in translating ;) I never worked as a translator, so I don't know which tools to use best, but on the gcmd homepage there is also a short introduction: http://gcmd.github.io/dev.html#trnsl.

@puux
Copy link
Contributor Author

puux commented Jul 14, 2016

Thanks for the information and valuable advice . I certainly also prefer to engage in the development , rather than the translation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants