Skip to content
This repository was archived by the owner on Jul 17, 2025. It is now read-only.

Commit 4be3e3a

Browse files
committed
slider
1 parent 38ce8ab commit 4be3e3a

File tree

1 file changed

+121
-92
lines changed

1 file changed

+121
-92
lines changed

data/doc/4.widgets/1.slide.md

Lines changed: 121 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,53 @@
11
# Slide
22

3-
A slider, with `on_change` property which will be executing a shell command when value changes.
4-
5-
You can use `Slider` as status bar with `update_with_interval_ms` to update the progress on a regular interval.
6-
73
_Example:_
84

95
```json
106
{
117
"edge": "top",
8+
"monitor": "HDMI-A-1",
9+
"position": "left",
10+
"layer": "overlay",
11+
"margins": {
12+
"left": "12.5%"
13+
},
14+
"widget": {
15+
"type": "slider",
16+
"thickness": 40,
17+
"border_width": 6,
18+
"length": "12.5%",
19+
"fg_color": "#BD93F9",
20+
"redraw_only_on_internal_update": true,
21+
"preset": {
22+
"type": "microphone"
23+
}
24+
}
25+
}
26+
```
27+
28+
```json
29+
{
30+
"edge": "top",
31+
"position": "left",
32+
"monitor": "HDMI-A-1",
33+
"layer": "overlay",
34+
"preview_size": "100%",
1235
"widget": {
36+
"thickness": 50,
37+
"length": "25%",
1338
"type": "slide",
14-
"thickness": 20,
15-
"length": 400,
16-
"transition_duration": 100,
17-
"frame_rate": 120,
18-
"bg_color": "#0D47A1",
19-
"fg_color": "#29B6F6",
20-
"text_color": "#fff",
21-
"border_color": "#000",
22-
"on_change": "notify-send {progress}"
39+
"border_width": 9,
40+
"preset": {
41+
"type": "custom",
42+
"interval_update": [100, "seq 0 .01 1 | shuf | head -n1"],
43+
"on_change": "notify-send {float:0, 100}",
44+
"event_map": {
45+
"1": "notify-send 1",
46+
"2": "notify-send 2",
47+
"3": "notify-send 3"
48+
"4": "notify-send 4"
49+
}
50+
}
2351
}
2452
}
2553
```
@@ -46,70 +74,15 @@ Support relative value.
4674

4775
_Type: `int | string`_
4876

49-
## `frame_rate`
77+
## `border_width`
5078

51-
Frame rate per second, won't hurt if over screen refresh rate.
79+
_Type: `int`_
5280

53-
_Type: `int`_
54-
_Default: `60`_
81+
## `redraw_only_on_internal_update`
5582

56-
## `transition_duration`
57-
58-
Time cost of showing the widget from the edge.
59-
Millisecond.
60-
61-
_Type: `int`_
62-
_Default: `100`_
83+
Saves resources, recommend to turn on for speaker and microphone.
6384

64-
## `extra_trigger_size`
65-
66-
Extra mouse event input region of the widget, if `0` then the widget won't be shown by mouse hover.
67-
68-
_Type: `int | string`_
69-
_Default: `5`_
70-
71-
## `event_map`
72-
73-
Array of tuples. each tuple contains `mouse key ID` and `shell command`:
74-
`[<mouse_key_id>, <shell_command>]`
75-
76-
This event map does not support `long press`/`doule press`/`hover event`... only support single click.
77-
78-
Default mouse keys:
79-
80-
- `1` - Left button
81-
- `2` - Middle button
82-
- `3` - Right button
83-
- ...others you need to test on your self by passing `--mouse-debug`: `way-edges daemon --mouse-debug`
84-
85-
_Type: `[[int, string]...]`_
86-
_Default: `[]`_
87-
88-
## `on_change`
89-
90-
Command to execute, replace '{progress}' with the progress from 0-1.
91-
Example: `notify-send {progress}`
92-
93-
_Type: `null | string`_
94-
_Default: `null`_
95-
96-
## `draggable`
97-
98-
Is progress in slide changeable by mouse left click drag.
99-
100-
_Type: `bool`_
101-
_Default: `true`_
102-
103-
## `update_with_interval_ms`
104-
105-
Array of tuples. each tuple contains `millisecond` and `shell command`:
106-
`[<millisecond>, <shell_command>]`
107-
Example: `[1000, \"echo 0.2333\"]`
108-
109-
For `shell command`, the returned value must be a number within `[0, 1]`.
110-
111-
_Type: `[[int, string]...]`_
112-
_Default: `[]`_
85+
_Type: `bool`_
11386

11487
## `bg_color`
11588

@@ -153,37 +126,93 @@ For full info, check [RGBA](https://gtk-rs.org/gtk4-rs/stable/latest/docs/src/gd
153126
_Type: `string`_
154127
_Default: `#000000`_
155128

156-
## `preview_size`
129+
## `obtuse_angle`
130+
131+
The 2 obtuse angle in trapezoid, set it within `[90, 180)`, when `90`, you'll get a square.
132+
133+
_Type: `int`_
134+
_Default: `120`_
157135

158-
How much area should the widget reveal when hidden
136+
## `radius`
137+
138+
Radius of the rounded corners for 2 obtuse angle in trapezoid.
159139

160140
_Type: `int`_
161-
_Default: `3`_
141+
_Default: `20`_
162142

163-
## `progress_direction`
143+
## `preset`
164144

165-
Progress bar: `Forward/Backward`
145+
### Speaker | Microphone
166146

167-
_Type: `string`_
168-
_Default: `Forward`_
147+
PulseAudio Sink and Source.
169148

170-
## `is_text_position_start`
149+
#### `type*`
171150

172-
Which side percentage info at, start or end of the widget
151+
`speaker | microphone`
173152

174-
_Type: `bool`_
175-
_Default: `true`_
153+
#### `mute_color`
176154

177-
## `obtuse_angle`
155+
`string`
178156

179-
The 2 obtuse angle in trapezoid, set it within `[90, 180)`, when `90`, you'll get a square.
157+
default black
180158

181-
_Type: `int`_
182-
_Default: `120`_
159+
#### `device`
183160

184-
## `radius`
161+
`string | null`
185162

186-
Radius of the rounded corners for 2 obtuse angle in trapezoid.
163+
`null` means default device
187164

188-
_Type: `int`_
189-
_Default: `20`_
165+
### Backlight
166+
167+
Monitor brightness
168+
169+
#### `type*`
170+
171+
`backlight`
172+
173+
#### `device`
174+
175+
`string | null`
176+
177+
`null` means the first one we can find
178+
179+
### Custom
180+
181+
#### `type*`
182+
183+
`custom`
184+
185+
## `interval_update`
186+
187+
Array of tuples. each tuple contains `millisecond` and `shell command`:
188+
`[<millisecond>, <shell_command>]`
189+
Example: `[1000, \"echo 0.2333\"]`
190+
191+
For `shell command`, the returned value must be a number within `[0, 1]`.
192+
193+
_Type: `[[int, string]...]`_
194+
_Default: `[]`_
195+
196+
## `on_change`
197+
198+
Command to execute when progress changed.
199+
200+
Template support.
201+
202+
Example: `notify-send {progress}`
203+
204+
_Type: `null | string`_
205+
_Default: `null`_
206+
207+
## `event_map`
208+
209+
`mouse_key_ID : shell_command`
210+
211+
Default mouse keys:
212+
213+
- `1` - Left button
214+
- `2` - Middle button
215+
- `3` - Right button
216+
217+
_Type: `object`_
218+
_Default: `{}`_

0 commit comments

Comments
 (0)