spacemacs菜单启发的gtk模块
spacemenu的Python项目详细描述
空间菜单
说明
space menu是一个python模块,灵感来自spacemacs“空间菜单”。 设计用作i3wm的laucher
依赖关系
GTK-3.0
安装
pip install spacemenu
用法
窗口
类窗口表示菜单窗口本身
fromspacemenuimportWindowwindow=Window(root,options)
参数
根目录->;在以下架构中包含所需显示信息的字典:
{
"label": 'title of the window',
"branches": [
{
"label": "label for the first branch",
"branches": [],
"leaves": []
}
],
"leaves": [
{ "label": "label for leaf 1", "command": "shell command to be executed""}
]
}
因此,一个分支可以包含其他分支或叶,每个叶执行一个命令。
选项->;选项可以是听写的,也可以是选项对象
{
"margin": 10,
"column_spacing": 1,
"row_spacing": 1,
"max_columns": 5,
"row_height": 35,
"margin_left": 0,
"margin_right": 0,
"margin_bottom": 0,
"font": "italic bold 12px Georgia, serif",
"background_color": "#ffffff"
"button_background_color": "#ffffff"
"button_text_color": "#000000"
"branch_background_color": "#ffffff",
"branch_text_color": "#ffffff",
"branch_text_shortcut_color": "#ff0000",
"branch_text_separator_color": "#00ff00",
"branch_text_label_color": "#0000ff",
"leaf_background_color": "#ffffff",
"leaf_text_color": "#000000",
"leaf_text_shortcut_color": "#ff0000",
"leaf_text_separator_color': "#00ff00",
"leaf_text_label_color": "#0000ff"
}
注意:任何未定义的值都将设置为Gtk主题默认值
方法
draw()->;绘制窗口
选项
外部形状
- margin_left:设置左外边距(像素)
- margin_right:设置右外部边距(以像素为单位)
- margin_bottom:设置外底边距(以像素为单位)
内部形状
- 内部边距:窗口的内部边距
- 列间距:每列之间的间距
- 行间距:每行之间的间距
- Max列:显示
的最大列数
- 行高:每行按钮的高度
- 字体:标签使用的字体
颜色
- 背景色:窗口背景的颜色(rrggbb)
- 按钮背景颜色:按钮背景的颜色(rrggbb)
- 按钮文本颜色:按钮文本的颜色(rrggbb)
待办事项
- 允许外部定义的快捷方式
许可证
GPL-3.0-或更高版本