Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-02-18 22:08:28

ArON
Member
Registered: 2018-11-06
Posts: 9

Thunar Custom Action question (using opencc)

Hi,

Could someone please help me with a Thunar custom action?

The program is opencc, which converts between Traditional and Simplified Chinese text.

Here's its usage:

$ opencc --help
...
Usage: 

   opencc  [--noflush <bool>] [-i <file>] [-o <file>] [-c <file>] [--]
           [--version] [-h]

Options: 

   --noflush <bool>
     Disable flush for every line

   -i <file>,  --input <file>
     Read original text from <file>.

   -o <file>,  --output <file>
     Write converted text to <file>.

   -c <file>,  --config <file>
     Configuration file

   --,  --ignore_rest
     Ignores the rest of the labeled arguments following this flag.

   --version
     Displays version information and exits.

   -h,  --help
     Displays usage information and exits.

In bash, if I use the following cmdline, I can successfully convert:

opencc -i ~/1.txt -o ~/1.txt -c t2s

"t2s" is short for "/usr/share/opencc/t2s.json", so "-c /usr/share/opencc/t2s.json" has the same effect.

But if I add the following to Thunar custom action, it won't convert:

opencc -i %F -o %F -c t2s

or

opencc -i %F -o %F -c /usr/share/opencc/t2s.json

Appearance Conditions:
File Pattern: *.txt
Contains: text files

I couldn't figure out the right way to put in Thunar custom action, could some please teach me how?

Thanks!

Last edited by ArON (2021-02-18 22:13:51)

Offline

#2 2021-02-18 23:07:53

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 7,415

Re: Thunar Custom Action question (using opencc)

That command works, in that it changes the file for me. (a diff confirms that this file changes). What exactly do you mean by "doesn't work"?

What version of thunar are you running?

Also, are there any error messages in your ~/.xsession-errors file when run the action?

Offline

Board footer

Powered by FluxBB