Skip to content

Commit c3ecc0d

Browse files
committed
feat(komorebi): add control widget for Komorebi application
- Introduced a new Komorebi Control widget to manage application states (start, stop, reload). - Added configuration options for AutoHotKey and WHKD integration. - Updated documentation and sidebar links to reflect the new widget.
1 parent 9004938 commit c3ecc0d

File tree

7 files changed

+628
-2
lines changed

7 files changed

+628
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ https://github.com/user-attachments/assets/aab8d8e8-248f-46a1-919c-9b0601236ac1
109109
- **[WiFi](https://github.com/amnweb/yasb/wiki/(Widget)-WiFi)**: Shows the current WiFi status.
110110
- **[WHKD](https://github.com/amnweb/yasb/wiki/(Widget)-Whkd)**: Shows the current hotkey.
111111
- **[Windows-Desktops](https://github.com/amnweb/yasb/wiki/(Widget)-Windows-Desktops)**: Windows desktops switcher.
112-
- **[Komorebi Workspaces](https://github.com/amnweb/yasb/wiki/(Widget)-Komorebi-Workspaces)**: Komorebi workspaces widget.
112+
- **[Komorebi Control](https://github.com/amnweb/yasb/wiki/(Widget)-Komorebi-Control)**: Komorebi control widget.
113113
- **[Komorebi Layout](https://github.com/amnweb/yasb/wiki/(Widget)-Komorebi-Layout)**: Shows the current layout of Komorebi.
114+
- **[Komorebi Workspaces](https://github.com/amnweb/yasb/wiki/(Widget)-Komorebi-Workspaces)**: Komorebi workspaces widget.
114115

115116

116117
## 🏆 Contributors

docs/_Sidebar.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- [WiFi](./(Widget)-WiFi)
3939
- [WHKD](./(Widget)-Whkd)
4040
- [Windows-Desktops](./(Widget)-Windows-Desktops)
41-
- [Komorebi Workspaces](./(Widget)-Komorebi-Workspaces)
41+
- [Komorebi Control](./(Widget)-Komorebi-Control)
4242
- [Komorebi Layout](./(Widget)-Komorebi-Layout)
43+
- [Komorebi Workspaces](./(Widget)-Komorebi-Workspaces)
4344
- [Writing Widget](./Writing-Widget)
Loading
+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Komorebi Control Widget
2+
*This widget provides a control interface for Komorebi, allowing users to start, stop, and reload the application. It also includes options for running AutoHotKey and WHKD, as well as displaying the Komorebi version.*
3+
4+
| Option | Type | Default | Description |
5+
|-------------------|---------|-------------------------------------------------------------------------|-----------------------------------------------------------------------------|
6+
| `label` | string | `"\udb80\uddd9"` | Icon or text label. |
7+
| `icons` | dict | `'{'start': "\uead3",'stop': "\uead7",'reload': "\uead2",}'` | Button icons. |
8+
| `run_ahk` | boolean | `false` | Whether to run AutoHotKey. |
9+
| `run_whkd` | boolean | `false` | Whether to run WHKD. |
10+
| `show_version` | boolean | `false` | Whether to show the komorebi version. |
11+
| `komorebi_menu` | dict | `{'blur': True, 'round_corners': True, 'round_corners_type': 'normal','border_color': 'System', 'alignment': 'right', 'direction': 'down', 'offset_top': 6, 'offset_left': 0}` | Settings for the Komorebi menu. |
12+
| `callbacks` | dict | `{'on_left': 'toggle_menu', 'on_middle': 'do_nothing', 'on_right': 'do_nothing'}` | Callbacks for mouse events. |
13+
| `container_padding` | dict | `{'top': 0, 'left': 0, 'bottom': 0, 'right': 0}` | Explicitly set padding inside widget container. |
14+
| `animation` | dict | `{'enabled': True, 'type': 'fadeInOut', 'duration': 200}` | Animation settings for the widget. |
15+
16+
## Example Configuration
17+
18+
```yaml
19+
komorebi_control:
20+
type: "komorebi.control.KomorebiControlWidget"
21+
options:
22+
label: "<span>\udb80\uddd9</span>"
23+
icons:
24+
start: "\uead3"
25+
stop: "\uead7"
26+
reload: "\uead2"
27+
run_ahk: false
28+
run_whkd: true
29+
show_version: true
30+
komorebi_menu:
31+
blur: True
32+
round_corners: True
33+
round_corners_type: 'normal'
34+
border_color: 'System'
35+
alignment: 'left'
36+
direction: 'down'
37+
offset_top: 6
38+
offset_left: 0
39+
```
40+
41+
## Description of Options
42+
43+
- **label:** Icon or text label.
44+
- **icons:** Button icons.
45+
- **start:** Icon for the start button.
46+
- **stop:** Icon for the stop button.
47+
- **reload:** Icon for the reload button.
48+
- **run_ahk:** Whether to run AutoHotKey.
49+
- **run_whkd:** Whether to run WHKD.
50+
- **show_version:** Whether to show the komorebi version.
51+
- **komorebi_menu:** Settings for the Komorebi menu.
52+
- **blur:** Whether to enable blur effect.
53+
- **round_corners:** Whether to round corners.
54+
- **round_corners_type:** Type of rounding (normal, small, large).
55+
- **border_color:** Border color (System, Custom).
56+
- **alignment:** Alignment of the menu (left, right, top, bottom).
57+
- **direction:** Direction of the menu (up, down, left, right).
58+
- **offset_top:** Top offset for the menu.
59+
- **offset_left:** Left offset for the menu.
60+
- **callbacks:** Callbacks for mouse events.
61+
- **container_padding:** Explicitly set padding inside widget container.
62+
- **animation:** Animation settings for the widget.
63+
- **enabled:** Whether to enable animation.
64+
- **type:** Type of animation (fadeInOut, slideIn, etc.).
65+
- **duration:** Duration of the animation in milliseconds.
66+
67+
## Widget Style
68+
```css
69+
.komorebi-control-widget {}
70+
.komorebi-control-widget .widget-container {}
71+
.komorebi-control-widget .widget-container .label {}
72+
.komorebi-control-widget .widget-container .icon {}
73+
/* Komorebi Menu */
74+
.komorebi-control-menu {}
75+
.komorebi-control-menu .button {}
76+
.komorebi-control-menu .button:hover {}
77+
.komorebi-control-menu .button.start {}
78+
.komorebi-control-menu .button.stop {}
79+
.komorebi-control-menu .button.reload {}
80+
.komorebi-control-menu .button.active {}
81+
.komorebi-control-menu .button:disabled {}
82+
.komorebi-control-menu .footer {}
83+
.komorebi-control-menu .footer .text {}
84+
```
85+
86+
## Example Style
87+
```css
88+
.komorebi-control-widget .label {
89+
font-size: 14px;
90+
color: #cdd6f4;
91+
font-weight: 600;
92+
}
93+
.komorebi-control-menu {
94+
background-color: rgba(17, 17, 27, 0.2);
95+
}
96+
.komorebi-control-menu .button {
97+
color: rgba(162, 177, 199, 0.4);
98+
padding: 8px 16px;
99+
font-size: 32px;
100+
border-radius: 8px;
101+
background-color: rgba(255, 255, 255, 0.04);
102+
}
103+
.komorebi-control-menu .button.active {
104+
color: rgb(228, 228, 228);
105+
background-color: rgba(255, 255, 255, 0.04);
106+
}
107+
.komorebi-control-menu .button:disabled,
108+
.komorebi-control-menu .button.active:disabled {
109+
background-color: rgba(255, 255, 255, 0.01);
110+
color: rgba(255, 255, 255, 0.2);
111+
}
112+
.komorebi-control-menu .footer .text {
113+
font-size: 12px;
114+
color: #6c7086;
115+
}
116+
```
117+
118+
## Preview
119+
![Komorebi Control Widget](assets/768254j6-dx9t65f3-gm2v-3045-u5l8eabcfd19.png)

src/build.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'core.widgets.yasb.home',
3636
'core.widgets.yasb.cava',
3737
'core.widgets.yasb.systray',
38+
'core.widgets.komorebi.control',
3839
'core.widgets.komorebi.active_layout',
3940
'core.widgets.komorebi.workspaces',
4041
'core.widgets.glazewm.tiling_direction',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
DEFAULTS = {
2+
'label': "\udb80\uddd9",
3+
'icons': {
4+
'start': "\uead3",
5+
'stop': "\uead7",
6+
'reload': "\uead2",
7+
},
8+
'run_ahk': False,
9+
'run_whkd': False,
10+
'show_version': True,
11+
'komorebi_menu': {
12+
'blur': True,
13+
'round_corners': True,
14+
'round_corners_type': 'normal',
15+
'border_color': 'System',
16+
'alignment': 'right',
17+
'direction': 'down',
18+
'offset_top': 6,
19+
'offset_left': 0,
20+
},
21+
'animation': {
22+
'enabled': True,
23+
'type': 'fadeInOut',
24+
'duration': 200
25+
},
26+
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
27+
'callbacks': {
28+
'on_left': 'toggle_menu',
29+
'on_middle': 'do_nothing',
30+
'on_right': 'do_nothing'
31+
}
32+
}
33+
34+
VALIDATION_SCHEMA = {
35+
'label': {
36+
'type': 'string',
37+
'default': DEFAULTS['label']
38+
},
39+
'icons': {
40+
'type': 'dict',
41+
'required': False,
42+
'schema': {
43+
'start': {
44+
'type': 'string',
45+
'default': DEFAULTS['icons']['start']
46+
},
47+
'stop': {
48+
'type': 'string',
49+
'default': DEFAULTS['icons']['stop']
50+
},
51+
'reload': {
52+
'type': 'string',
53+
'default': DEFAULTS['icons']['reload']
54+
}
55+
},
56+
'default': DEFAULTS['icons']
57+
},
58+
'run_ahk': {
59+
'type': 'boolean',
60+
'default': DEFAULTS['run_ahk']
61+
},
62+
'run_whkd': {
63+
'type': 'boolean',
64+
'default': DEFAULTS['run_whkd']
65+
},
66+
'show_version': {
67+
'type': 'boolean',
68+
'default': DEFAULTS['show_version']
69+
},
70+
'komorebi_menu': {
71+
'type': 'dict',
72+
'required': False,
73+
'schema': {
74+
'blur': {
75+
'type': 'boolean',
76+
'default': DEFAULTS['komorebi_menu']['blur']
77+
},
78+
'round_corners': {
79+
'type': 'boolean',
80+
'default': DEFAULTS['komorebi_menu']['round_corners']
81+
},
82+
'round_corners_type': {
83+
'type': 'string',
84+
'default': DEFAULTS['komorebi_menu']['round_corners_type'],
85+
'allowed': ['normal', 'small']
86+
},
87+
'border_color': {
88+
'type': 'string',
89+
'default': DEFAULTS['komorebi_menu']['border_color']
90+
},
91+
'alignment': {
92+
'type': 'string',
93+
'default': DEFAULTS['komorebi_menu']['alignment']
94+
},
95+
'direction': {
96+
'type': 'string',
97+
'default': DEFAULTS['komorebi_menu']['direction']
98+
},
99+
'offset_top': {
100+
'type': 'integer',
101+
'default': DEFAULTS['komorebi_menu']['offset_top']
102+
},
103+
'offset_left': {
104+
'type': 'integer',
105+
'default': DEFAULTS['komorebi_menu']['offset_left']
106+
}
107+
},
108+
'default': DEFAULTS['komorebi_menu']
109+
},
110+
'animation': {
111+
'type': 'dict',
112+
'required': False,
113+
'schema': {
114+
'enabled': {
115+
'type': 'boolean',
116+
'default': DEFAULTS['animation']['enabled']
117+
},
118+
'type': {
119+
'type': 'string',
120+
'default': DEFAULTS['animation']['type']
121+
},
122+
'duration': {
123+
'type': 'integer',
124+
'default': DEFAULTS['animation']['duration']
125+
}
126+
},
127+
'default': DEFAULTS['animation']
128+
},
129+
'container_padding': {
130+
'type': 'dict',
131+
'default': DEFAULTS['container_padding'],
132+
'required': False
133+
},
134+
'callbacks': {
135+
'type': 'dict',
136+
'schema': {
137+
'on_left': {
138+
'type': 'string',
139+
'default': DEFAULTS['callbacks']['on_left'],
140+
},
141+
'on_middle': {
142+
'type': 'string',
143+
'default': DEFAULTS['callbacks']['on_middle'],
144+
},
145+
'on_right': {
146+
'type': 'string',
147+
'default': DEFAULTS['callbacks']['on_right'],
148+
}
149+
},
150+
'default': DEFAULTS['callbacks']
151+
}
152+
}

0 commit comments

Comments
 (0)