Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
468 views
in Technique[技术] by (71.8m points)

linux mint - Nemo right-click action for filenames with special characters

How can I open files whose name contains sharps / hashes # from the Cinnamon Nemo right-click context menu?

A Nemo action e.g. /usr/share/nemo/actions/unzap.nemo_action which contains the line Exec=unzap "%F" will open most files, but fail to escape filenames which contain a #.

question from:https://stackoverflow.com/questions/65862110/nemo-right-click-action-for-filenames-with-special-characters

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use Exec=<open.py "unzap" %F> instead of Exec=unzap "%F" in the unzap.nemo_action.

The unescape the backslashes in open.py as follows:

#! /usr/bin/python3 -OOt

import sys
import subprocess

command = sys.argv[1]
filename = sys.argv[2].replace(" "," ")

subprocess.run([command, filename])

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...