Xfce Forum

Sub domains
 

You are not logged in.

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

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

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
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

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?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 523.31 KiB (Peak: 530.96 KiB) ]