124 lines
4.8 KiB
XML
124 lines
4.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
||
<actions>
|
||
<action>
|
||
<icon>utilities-terminal</icon>
|
||
<name>Open Terminal Here</name>
|
||
<submenu></submenu>
|
||
<unique-id>1763109685799433-1</unique-id>
|
||
<command>kitty -e fish</command>
|
||
<description>Example for a custom action</description>
|
||
<range></range>
|
||
<patterns>*</patterns>
|
||
<startup-notify/>
|
||
<directories/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>多媒体信息</name>
|
||
<submenu></submenu>
|
||
<unique-id>1769424941490550-1</unique-id>
|
||
<command>kitty --class "media_info" -e media-info %f </command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<audio-files/>
|
||
<video-files/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>粘贴为链接</name>
|
||
<submenu></submenu>
|
||
<unique-id>1769427857102992-1</unique-id>
|
||
<command>sh -c 'wl-paste -t text/uri-list | python3 -c "
|
||
import sys, os, urllib.parse
|
||
dest_dir = sys.argv[1]
|
||
|
||
# 逐行读取剪贴板里的文件
|
||
for line in sys.stdin:
|
||
# 1. 清理路径:解码URL并去掉 file:// 前缀
|
||
src = urllib.parse.unquote(line.strip()).replace(\"file://\", \"\")
|
||
|
||
# 2. 基础检查
|
||
if not src or not os.path.exists(src): continue
|
||
|
||
# 3. 计算目标文件名
|
||
filename = os.path.basename(src)
|
||
target = os.path.join(dest_dir, filename)
|
||
|
||
# 4. 重名检测循环:如果有同名文件,变成 \"文件名 (1).后缀\"
|
||
root, ext = os.path.splitext(filename)
|
||
counter = 1
|
||
while os.path.exists(target):
|
||
target = os.path.join(dest_dir, f\"{root} ({counter}){ext}\")
|
||
counter += 1
|
||
|
||
# 5. 创建链接
|
||
try: os.symlink(src, target)
|
||
except: pass
|
||
" %f'</command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<directories/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>粘贴剪贴板图片</name>
|
||
<submenu></submenu>
|
||
<unique-id>1769429285959977-2</unique-id>
|
||
<command>bash -c 'd="%f";[ -d "$d" ]||d="$(dirname "$d")";cd "$d"||exit;n="img_$(date -Iseconds|cut -d+ -f1|tr T _|tr : -)";t=$(wl-paste -l);if echo "$t"|grep -q "^image/";then wl-paste -t image/png>"$n.png";elif echo "$t"|grep -q "text/uri-list";then u=$(wl-paste -t text/uri-list|head -n1);if [[ "$u" == file://* ]];then p="${u#file://}";f=$(python3 -c "import sys,urllib.parse;print(urllib.parse.unquote(sys.argv[1]))" "$p");[ -f "$f" ]&&cp "$f" "$n.${f##*.}";fi;fi'</command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<directories/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>视频转gif</name>
|
||
<submenu></submenu>
|
||
<unique-id>1769514623477685-1</unique-id>
|
||
<command>kitty --class="floating-term" -e video2gif %F</command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<video-files/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>图片转png</name>
|
||
<submenu></submenu>
|
||
<unique-id>1769516013413116-2</unique-id>
|
||
<command>bash -c 'exec 1>>/tmp/img_err.log 2>&1; /usr/bin/notify-send "图片转换" "正在后台处理 $# 张图片..."; for f in "$@"; do /usr/bin/magick -background none "$f" -delete 1--1 "$(echo "$f" | sed "s/\.[^.]*$//").png"; done; /usr/bin/notify-send "图片转换" "处理完成"' -- %F</command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<image-files/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>压缩视频大小</name>
|
||
<submenu></submenu>
|
||
<unique-id>1770021157399945-1</unique-id>
|
||
<command>kitty --class floating-term bash -c 'f="$1"; out="$(echo "$f" | sed "s/\.[^.]*$//")_compressed.mp4"; echo "正在处理: $f"; if ffmpeg -i "$f" -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -crf 26 -preset slow -c:a aac -b:a 128k -pix_fmt yuv420p "$out"; then echo -e "\n✅ 压缩完成!文件已保存为: $out"; else echo -e "\n❌ 压缩失败,请查看上方报错信息。"; fi; read -n 1 -s -r -p "按任意键退出..."' -- %f</command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<video-files/>
|
||
</action>
|
||
<action>
|
||
<icon></icon>
|
||
<name>快速查看</name>
|
||
<submenu></submenu>
|
||
<unique-id>1770297188807065-1</unique-id>
|
||
<command>kitty --class="floating-term" -e bash -c "~/.local/bin/preview \"\$1\"; read -n 1 -s -r" -- %f</command>
|
||
<description></description>
|
||
<range>*</range>
|
||
<patterns>*</patterns>
|
||
<directories/>
|
||
<audio-files/>
|
||
<image-files/>
|
||
<text-files/>
|
||
<video-files/>
|
||
</action>
|
||
</actions>
|