在Thunar运行脚本之前询问
Nautilus或PCManFM可以选择在执行文件之前询问您。
我可以在Thunar有那个吗?
我发布这个是为了提供答案。
基于此答案中提供的Zenity脚本,
看到你安装了zenity
sudo apt-get install zenity
使用以下内容创建名为editorrun.sh
的可执行文件:
#!/bin/bash zenity --question --text="What to do with the executable file '$1'?" \ --ok-label=Run \ --cancel-label=Edit case $? in 0)bash -c "$1" ;; 1)gedit $1 ;; esac
使其可执行,然后将其添加到应用程序列表中
gedit ~/.local/share/applications/edit-or-run.desktop
有这个内容:
[Desktop Entry] Type=Application Name=Edit-or-run Icon=gedit Categories=Utility; MimeType=application/x-sh;application/x-executable; Exec=bash -c 'path/to/the/script/editorrun.sh %f'
在Exec=bash -c 'path/to/the/script/editorrun.sh %f'
添加脚本Exec=bash -c 'path/to/the/script/editorrun.sh %f'
。 然后,制作该可执行文件。
然后,通过选择此类文件,将此desktop
文件设置为可执行文件的默认应用程序,转到“ Proprieties – General – Open with ”并选择Edit-or-run 。
之后,当您单击可执行文件时,会出现一个对话框
(一个小故障:此时您无法关闭对话框:使用关闭窗口按钮, Esc或Alt + F4等同于脚本中的--cancel-label
选项,并将在文本编辑器中打开该文件。)