[Share Experiences] dde-file-manager中像Windows一样右键空白区域打开VsCode
Tofloor
poster avatar
🇨🇳🇨🇳🇨🇳
deepin
2024-11-30 16:09
Author

在/usr/share/applications/context-menus中新建vscode.conf

内容如下

[Menu Entry]
Actions=Zero
Version=1.0

[Menu Action Zero]
Exec=code %p
Name=VsCode
X-DFM-MenuTypes=BlankSpace
PosNum=2
Separator=Top

image.png

源码中的说明:

// 支持的文件组合方式
enum ComboType {
    kBlankSpace = 1,   //空白区域
    kSingleFile = 1 << 1,   //单个文件
    kSingleDir = 1 << 2,   //单个文件夹
    kMultiFiles = 1 << 3,   //多个文件
    kMultiDirs = 1 << 4,   //多个文件夹
    kFileAndDir = 1 << 5,   //文件和文件夹,必须都包含。焦点优化后废弃,当做kMultiDirs|kMultiFiles
    kAllFile = kSingleFile | kMultiFiles,
    kAllDir = kSingleDir | kMultiDirs,
    kAllCombo = kc | kAllFile | kAllDir | kFileAndDir
};
Q_DECLARE_FLAGS(ComboTypes, DCustomActionDefines::ComboType);
Q_DECLARE_OPERATORS_FOR_FLAGS(ComboTypes);

// 支持菜单层级
enum MenuHierarchy {
    kOne = 1,
    kTwo,
    kThree
};

// 动态参数
enum ActionArg {
    kNoneArg = -1,
    kDirName = 0,   //%d 当前文件夹名称
    kDirPath,   //%p 当前文件夹路径
    kBaseName,   //%b 文件名,不含路径和扩展名
    kFileName,   //%a 文件全名,包含扩展名,不含路径
    kFilePath,   //%f 文件路径
    kFilePaths,   //%F 多个文件路径
    kUrlPath,   //%u 使用url表示的文件路径
    kUrlPaths,   //%U 多个url
};

Reply Favorite View the author
All Replies
(´◓Д◔`)
deepin
2024-11-30 16:21
#1

很实用,感谢分享

Reply View the author
Oli
deepin
2024-12-01 07:32
#2

like

Reply View the author
小鱼贝壳
deepin
2024-12-01 07:44
#3

like like

Reply View the author
忘记、过去
deepin
2024-12-01 17:20
#4

好东西,🇰🇷 了

Reply View the author
小小怪冲啊!
deepin
2024-12-02 07:04
#5

like

Reply View the author
放屁大王
deepin
2024-12-08 06:50
#6

like

Reply View the author
ggbond
deepin
2024-12-09 04:06
#7

like

Reply View the author