我正在尝试将 Nemo 脚本移植到 Dolphin 操作中。
该脚本显示所选文件或文件夹的幻灯片,但是当我从 Dolphin 调用操作时,它会为每个选定的文件调用脚本,而不是一次。
这是我的桌面入口代码:
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin,inode/directory,image/*
ExcludeServiceTypes=kdedevice/*
Encoding=UTF-8
Actions=slideshow;shuffled_slideshow
SingleMainWindow=true
[Desktop Action slideshow]
Name=Slideshow
Icon=image
Exec=/home/user/.local/share/nemo/scripts/slideshow.sh
[Desktop Action shuffled_slideshow]
Name=Shuffled Slideshow
Icon=image
Exec=/home/user/.local/share/nemo/scripts/shuffled_slideshow.sh
答案1
我在这里找到了解决方案:https://askubuntu.com/questions/1112497/kde-service-menus-get-list-of-selected-files
我只需在 Exec 末尾添加一个“%F”参数
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin,inode/directory,image/*
ExcludeServiceTypes=kdedevice/*
Encoding=UTF-8
Actions=slideshow;shuffled_slideshow
SingleMainWindow=true
[Desktop Action slideshow]
Name=Slideshow
Icon=image
Exec=/home/user/.local/share/nemo/scripts/slideshow.sh %F
[Desktop Action shuffled_slideshow]
Name=Shuffled Slideshow
Icon=image
Exec=/home/user/.local/share/nemo/scripts/shuffled_slideshow.sh %F