-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathscroll.lua
More file actions
598 lines (534 loc) · 14.8 KB
/
scroll.lua
File metadata and controls
598 lines (534 loc) · 14.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
---@meta
---
---
local scroll = {}
---
--- Add message to the DEBUG log of scroll
---
--- @param message string
---
--- @return integer
function scroll.log(message) end
---
--- Sets key = value in the script's state.
--- This value will be preserved between script runs
---
--- @param state userdata
--- @param key string
--- @param value any
---
--- @return integer
function scroll.state_set_value(state, key, value) end
---
--- Returns the value stored at key in the script's state.
---
--- @param state userdata
--- @param key string
---
--- @return any
function scroll.state_get_value(state, key) end
---
--- Encodes and sends 'data' (a Lua table as complex as needed) as a json
--- object through the IPC interface, generating a new LUA event with 'id'
--- (string)
---
--- @param id string
--- @param data table
---
--- @return integer
function scroll.ipc_send(id, data) end
---
--- Execute a scroll command with container or workspace as its context.
--- If the first paramenter is nil, use the default context, usually the
--- focused container or workspace.
---
--- Returns all the results/errors in an array.
---
--- @param context userdata|nil
--- @param command string
---
--- @return string[]
function scroll.command(context, command) end
---
--- Returns the focused view pointer or nil if none.
---
--- @return userdata|nil
function scroll.focused_view() end
---
--- Returns the focused container pointer or nil if none.
---
--- @return userdata|nil
function scroll.focused_container() end
---
--- Returns the focused workspace pointer or nil if none.
---
--- @return userdata|nil
function scroll.focused_workspace() end
---
--- Returns the current urgent view pointer or nil if none.
---
--- @return userdata|nil
function scroll.urgent_view() end
---
--- Returns true if view is mapped (exists), otherwise returns false
---
--- @param view userdata
---
--- @return boolean
function scroll.view_mapped(view) end
---
--- Returns a pointer to the container associated to view, or nil if none.
---
--- @param view userdata
---
--- @return userdata|nil
function scroll.view_get_container(view) end
---
--- Returns the app_id string for view, or nil if any error happens
---
--- @param view userdata
---
--- @return string|nil
function scroll.view_get_app_id(view) end
---
--- Returns the title string for view, or nil if any error happens
---
--- @param view userdata
---
--- @return string|nil
function scroll.view_get_title(view) end
---
--- Returns the pid number for view, or nil if any error happens
---
--- @param view userdata
---
--- @return integer|nil
function scroll.view_get_pid(view) end
---
--- Returns the view whose pid is the parent of the application running
--- in view, or nil if it has no parent view.
---
--- @param view userdata
---
--- @return userdata|nil
function scroll.view_get_parent_view(view) end
---
--- If the view has the urgent attribute set, return true, otherwise false.
---
--- @param view userdata
---
--- @return boolean
function scroll.view_get_urgent(view) end
---
--- Sets the view urgent attribute
---
--- @param view userdata
--- @param urgent boolean
---
--- @return integer
function scroll.view_set_urgent(view, urgent) end
---
--- Returns `xdg_shell` if the application running in view is a Wayland
--- application. If it is an X windows application, returns `xwayland`.
---
--- @param view userdata
---
--- @return string|nil
function scroll.view_get_shell(view) end
---
--- Returns the tag string property for view, or nil if any error happens.
---
--- @param view userdata
---
--- @return string|nil
function scroll.view_get_tag(view) end
---
--- Close/kill view
---
--- @param view userdata
---
--- @return number
function scroll.view_close(view) end
---
--- Sets the focus on container.
---
--- @param container userdata
---
--- @return integer
function scroll.container_set_focus(container) end
---
--- Returns the container's parent workspace pointer, or nil if none.
---
--- @param container userdata
---
--- @return userdata|nil
function scroll.container_get_workspace(container) end
---
--- Returns an array with all the marks associated to container.
---
--- @param container userdata
---
--- @return string[]
function scroll.container_get_marks(container) end
---
--- Returns true if the container is floating, false if it is tiled.
---
--- @param container userdata
---
--- @return boolean
function scroll.container_get_floating(container) end
---
--- Returns the numerical value for the container's opacity.
---
--- @param container userdata
---
--- @return number
function scroll.container_get_opacity(container) end
---
--- Returns true if the container is sticky, otherwise false.
---
--- @param container userdata
---
--- @return boolean
function scroll.container_get_sticky(container) end
---
--- Returns true if the container is in the scratchpad, otherwise false.
---
--- @param container userdata
---
--- @return boolean
function scroll.container_get_scratchpad(container) end
---
--- Returns the value for the container's width fraction.
--- This value is used to compute the width of the container.
---
--- @param container userdata
---
--- @return number
function scroll.container_get_width_fraction(container) end
---
--- Returns the value for the container's height fraction.
--- This value is used to compute the height of the container.
---
--- @param container userdata
---
--- @return number
function scroll.container_get_height_fraction(container) end
---
--- Returns a floating point value with the container's width in pixels.
---
--- @param container userdata
---
--- @return number
function scroll.container_get_width(container) end
---
--- Returns a floating point value with the container's height in pixels.
---
--- @param container userdata
---
--- @return number
function scroll.container_get_height(container) end
---
--- Returns a string with the fullscreen state for container.
--- Values can be `none`, `workspace` (covers only its workspace extents)
--- or `global` (covers all outputs).
---
--- @param container userdata
---
--- @return string
function scroll.container_get_fullscreen_mode(container) end
---
--- Returns a string with the fullscreen_application state for container.
--- Values can be `disabled` or `enabled`.
--- See the `fullscreen application` command for details.
---
--- @param container userdata
---
--- @return string
function scroll.container_get_fullscreen_app_mode(container) end
---
--- Returns a string with the fullscreen_view state for container.
--- Values can be `disabled` or `enabled`.
--- This is the internal state of the container. A container
--- can be displayed in full screen mode because an application requested it,
--- but this state can still be "disabled", so the compositor knows the
--- container should become non-full screen when the request ends.
---
--- @param container userdata
---
--- @return string
function scroll.container_get_fullscreen_view_mode(container) end
---
--- Returns a string with the fullscreen_layout state for container.
--- Values can be `disabled` or `enabled`.
--- See the `fullscreen layout` command for details.
---
--- @param container userdata
---
--- @return string
function scroll.container_get_fullscreen_layout_mode(container) end
---
--- Returns a string with the pin mode for container.
--- Values can be `none`, `beginning` or `end`.
--- See the pin command for details.
---
--- @param container userdata
---
--- @return string
function scroll.container_get_pin_mode(container) end
---
--- Returns the container parent of container or nil if it is a top
--- level container.
---
--- @param container userdata
---
--- @return userdata|nil
function scroll.container_get_parent(container) end
---
--- Returns an array with all the children containers of container, if any.
--- Only top level containers have children. Only bottom level containers
--- have views.
---
--- @params container userdata
---
--- @return userdata[]
function scroll.container_get_children(container) end
---
--- Returns an array with all the views inside container.
--- If a top level container, it will return the views of all its children,
--- if a bottom level container, its only view.
---
--- @param container userdata
---
--- @return userdata[]
function scroll.container_get_views(container) end
---
--- Returns an integer value with the unique container id, or nil if error.
---
--- @param container userdata
---
--- @return integer|nil
function scroll.container_get_id(container) end
---
--- Sets the focus on the last active container of workspace.
---
--- @param workspace userdata
---
--- @return integer
function scroll.workspace_set_focus(workspace) end
---
--- Returns a string with the name of the workspace, or nil if error.
---
--- @param workspace userdata
---
--- @return string|nil
function scroll.workspace_get_name(workspace) end
---
--- Returns an array with all the tiling containers inside the workspace.
---
--- @param workspace userdata
---
--- @return userdata[]
function scroll.workspace_get_tiling(workspace) end
---
--- Returns an array with all the floating containers inside the workspace.
---
--- @param workspace userdata
---
--- @return userdata[]
function scroll.workspace_get_floating(workspace) end
---
--- Returns a table with all the current mode modifiers for workspace.
--- The keys and values of that table are:
---
--- mode: "horizontal"|"vertical"|"none"
--- insert: "before"|"after"|"beginning"|"end"
--- reorder: "auto"|"lazy"
--- focus: true|false
--- center_horizontal: true|false
--- center_vertical: true|false
---
--- @param workspace userdata
---
--- @return table
function scroll.workspace_get_mode(workspace) end
---
--- Sets the mode modifiers for workspace.
--- The modifiers table can override any number of modifiers.
--- The keys and values that table can include are at most:
---
--- mode: "horizontal"|"vertical"
--- insert: "before"|"after"|"beginning"|"end"
--- reorder: "auto"|"lazy"
--- focus: true|false
--- center_horizontal: true|false
--- center_vertical: true|false
---
--- @param workspace userdata
--- @param modifiers table
---
--- @return integer
function scroll.workspace_set_mode(workspace, modifiers) end
---
--- Returns the layout type, `horizontal` or `vertical`.
---
--- @param workspace userdata
---
--- @return string|nil
function scroll.workspace_get_layout_type(workspace) end
---
--- Sets the workspace's layout type to layout_type,
--- which can be `horizontal` or `vertical`.
---
--- @param workspace userdata
--- @param layout_type string
---
--- @return integer
function scroll.workspace_set_layout_type(workspace, layout_type) end
---
--- Returns an integer number with the workspace's width in pixels.
---
--- @param workspace userdata
---
--- @return integer|nil
function scroll.workspace_get_width(workspace) end
---
--- Returns an integer number with the workspace's height in pixels.
---
--- @param workspace userdata
---
--- @return integer|nil
function scroll.workspace_get_height(workspace) end
---
--- Returns the workspace's pinned container pointer, or nil if none.
---
--- @param workspace userdata
---
--- @return userdata|nil
function scroll.workspace_get_pin(workspace) end
---
--- Returns a table with the split state for workspace.
--- The keys and values of that table are:
---
--- split: "none"|"top"|"bottom"|"left"|"right"
--- fraction: number
--- gap: integer
--- sibling: the sibling workspace's pointer
---
--- @param workspace userdata
---
--- @return table
function scroll.workspace_get_split(workspace) end
---
--- Returns the workspace's output pointer, or nil if none.
---
--- @param workspace userdata
---
--- @return userdata|nil
function scroll.workspace_get_output(workspace) end
---
--- Returns true if the output (display) is enabled, or false otherwise.
---
--- @param output userdata
---
--- @return boolean
function scroll.output_get_enabled(output) end
---
--- Returns the name of the output's interface. For example 'DP-3'.
---
--- @param output userdata
---
--- @return string|nil
function scroll.output_get_name(output) end
---
--- Returns the workspace currently active on output.
---
--- @param output userdata
---
--- @return userdata|nil
function scroll.output_get_active_workspace(output) end
---
--- Returns an array with all the existing workspaces assigned to output.
---
--- @praam output userdata
---
--- @return userdata[]
function scroll.output_get_workspaces(output) end
---
--- Returns an array with all the outputs (displays).
---
--- @return userdata[]
function scroll.root_get_outputs() end
---
--- Returns an array with all the containers in the scratchpad.
---
--- @return userdata[]
function scroll.scratchpad_get_containers() end
---
--- Shows container if it is in the scratchpad.
---
--- @param container userdata
---
--- @return integer
function scroll.scratchpad_show(container) end
---
--- Hide container if it is in the scratchpad.
---
--- @param container userdata
---
--- @return integer
function scroll.scratchpad_hide(container) end
---
--- Sets a cb_func callback function for event, passing cb_data data to
--- it.
---
--- event can be:
---
--- view events: cb_func is a Lua function with two parameters, view
--- (the view triggering the event) and data, the cb_data value passed when
--- creating the callback.
---
--- "view_map": application's window creation.
--- "view_unmap": right before an application's window destruction.
--- "view_urgent": a window gets the urgent attribute set.
--- "view_focus": a window gets focus.
--- "view_float" a window becomes floating or goes back to tiled.
---
--- workspace events: cb_func is Lua function with two parameters, workspace
--- (the workspace triggering the event) and data , the cb_data value passed
--- when creating the callback.
---
--- "workspace_create": called when a workspace is created.
--- "workspace_focus": called when focusing a workspace.
---
--- ipc events:
---
--- "ipc_view": called every time an IPC event for a window happens. cb_func
--- is Lua function with three parameters: view (the view triggering the event),
--- change (a string with the event name), and data, the cb_data value
--- passed when creating the callback.
--- "ipc_workspace": called every time an IPC event for a workspace happens.
--- cb_func is Lua function with four parameters: old_ws (the old workspace),
--- new_ws (the new workspace), change (a string with the event name), and
--- data, the cb_data value passed when creating the callback.
---
--- cb_data can be any Lua variable, including a table with multiple values.
---
--- This function returns an id you need to store if you want to be able to
--- remove the callback later.
---
--- @param event string
--- @param cb_func function
--- @param cb_data any
---
--- @return lightuserdata|nil
function scroll.add_callback(event, cb_func, cb_data) end
---
--- Removes a callback set earlier using add_callback.
--- id is the unique identifier returned by add_callback.
---
--- @param id lightuserdata
---
--- @return integer
function scroll.remove_callback(id) end
return scroll