Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
【深度文管扩展菜单】 - 入门
Apps Section
858
views ·
1
replies ·
To
floor
Go
海天鹰
deepin
2018-10-31 20:29
Author
本帖最后由 sonichy 于 2018-11-9 10:03 编辑
https://bbs.deepin.org/post/170338
桌面菜单换壁纸,效果很不错,丢了一大堆命令,又没讲清楚。我来消化一下。
如何在深度文管(桌面已经属于文管的一部分)增加右键菜单。
1.~/.config/deepin/dde-file-manager/menuextensions目录(如果没有 menuextensions 目录就新建这个目录),新建 next_wallpaper.json,内容如下:
[
{
"MenuType": "EmptyArea",
"Icon": "",
"Text[zh_CN]": "下一张壁纸",
"Exec": "/media/sonichy/job/HY/Linux/shell/next_wallpaper.sh"
}
]
Copy the Code
桌面点击右键,菜单已经有了。
2.在上面那个自定义的路径新建 next_wallpaper.sh,内容如下:
#!/bin/bash
# 储存图片地址
conunt=0
for imageFile in `ls /media/sonichy/fun/pic/desk/*.jpg`; do
fileList[conunt]=$imageFile
conunt=`expr $conunt + 1`
done
# 随机获取图片地址并设置为壁纸
index=$(($RANDOM%${#fileList[@]}))
randomFile=${fileList[$index]}
gsettings set com.deepin.wrap.gnome.desktop.background picture-uri $randomFile
Copy the Code
这样就可以实现和Win7一样的桌面右键换壁纸了。
已知问题:桌面和文管都有这个菜单,实际文管不需要这个菜单。
学会了这功能,我们就能用右键菜单搞事情了!
然后我又做了一张我期待很久的预览图(移动到、复制到,海天鹰文管早就实现的功能)
发现,多个菜单只能写在一个json里,那还要目录干什么?
还有【
MenuType:
SingleFile, MultiFiles, SingleDir, MultiDirs, MultiFileDirs, EmptyArea, UnknowMenuExtension】,只能选一个,我需要【一个、多个、文件、目录】这几种。
[
{
"MenuType": "EmptyArea",
"Icon": "",
"Text[zh_CN]": "下一张壁纸",
"Exec": "next_wallpaper"
},
{
"MenuType": "SingleFile",
"Icon": "",
"Text[zh_CN]": "移动到",
"Exec": "moveto"
},
{
"MenuType": "SingleFile",
"Icon": "",
"Text[zh_CN]": "复制到",
"Exec": "copyto"
}
]
Copy the Code
这里好像有更多的功能:
https://github.com/linuxdeepin/d ... erfaces/dfmglobal.h
Reply
Like 0
Favorite
View the author
All Replies
兆兆嘟嘟嘟
Moderator
2024-08-07 23:21
#1
感谢分享。
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Update driver for my computer
Popular Events
More
https://bbs.deepin.org/post/170338
桌面菜单换壁纸,效果很不错,丢了一大堆命令,又没讲清楚。我来消化一下。
如何在深度文管(桌面已经属于文管的一部分)增加右键菜单。
1.~/.config/deepin/dde-file-manager/menuextensions目录(如果没有 menuextensions 目录就新建这个目录),新建 next_wallpaper.json,内容如下:
2.在上面那个自定义的路径新建 next_wallpaper.sh,内容如下:
已知问题:桌面和文管都有这个菜单,实际文管不需要这个菜单。
学会了这功能,我们就能用右键菜单搞事情了!
然后我又做了一张我期待很久的预览图(移动到、复制到,海天鹰文管早就实现的功能)