aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/desktop/idle_inhibit_v1.h
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-03-24 21:21:24 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-03-24 19:26:12 -0600
commitd9de5b87583ccf8b633980ebbdec67227bbe7db4 (patch)
tree4084a568e8b28e2e37142b8a293e00f619d48e17 /include/sway/desktop/idle_inhibit_v1.h
parentFix #3924 (diff)
downloadsway-d9de5b87583ccf8b633980ebbdec67227bbe7db4.tar.gz
sway-d9de5b87583ccf8b633980ebbdec67227bbe7db4.tar.zst
sway-d9de5b87583ccf8b633980ebbdec67227bbe7db4.zip
Implement inhibit_idle command
This implements the following command to set/unset a user idle inhibitor for a view: `inhibit_idle focus|fullscreen|open|none|visible` The modes are as follows: - focus: inhibited when the view is focused by any seat - fullscreen: inhibited when the view is fullscreen (or a descendant of a fullscreen container) and is visible on any output - open: inhibited until the view is closed or the inhibitor is unset or changed - none: unsets any user set idle inhibitors for the view - visible: inhibited when the view is visible on any output This should have no effect on idle inhibitors set by the applications themselves and those should still work as intended. Since this operates on the view in the handler context, it is possible to set it on the currently focused view, on any existing view with criteria, or for any future view with for_window.
Diffstat (limited to 'include/sway/desktop/idle_inhibit_v1.h')
-rw-r--r--include/sway/desktop/idle_inhibit_v1.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h
index e5ed8a3d..4d4e59b0 100644
--- a/include/sway/desktop/idle_inhibit_v1.h
+++ b/include/sway/desktop/idle_inhibit_v1.h
@@ -4,6 +4,14 @@
4#include <wlr/types/wlr_idle.h> 4#include <wlr/types/wlr_idle.h>
5#include "sway/server.h" 5#include "sway/server.h"
6 6
7enum sway_idle_inhibit_mode {
8 INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible)
9 INHIBIT_IDLE_FOCUS, // User set inhibitor when focused
10 INHIBIT_IDLE_FULLSCREEN, // User set inhibitor when fullscreen + visible
11 INHIBIT_IDLE_OPEN, // User set inhibitor while open
12 INHIBIT_IDLE_VISIBLE // User set inhibitor when visible
13};
14
7struct sway_idle_inhibit_manager_v1 { 15struct sway_idle_inhibit_manager_v1 {
8 struct wlr_idle_inhibit_manager_v1 *wlr_manager; 16 struct wlr_idle_inhibit_manager_v1 *wlr_manager;
9 struct wl_listener new_idle_inhibitor_v1; 17 struct wl_listener new_idle_inhibitor_v1;
@@ -15,14 +23,24 @@ struct sway_idle_inhibit_manager_v1 {
15struct sway_idle_inhibitor_v1 { 23struct sway_idle_inhibitor_v1 {
16 struct sway_idle_inhibit_manager_v1 *manager; 24 struct sway_idle_inhibit_manager_v1 *manager;
17 struct sway_view *view; 25 struct sway_view *view;
26 enum sway_idle_inhibit_mode mode;
18 27
19 struct wl_list link; 28 struct wl_list link;
20 struct wl_listener destroy; 29 struct wl_listener destroy;
21}; 30};
22 31
23void idle_inhibit_v1_check_active( 32void sway_idle_inhibit_v1_check_active(
24 struct sway_idle_inhibit_manager_v1 *manager); 33 struct sway_idle_inhibit_manager_v1 *manager);
25 34
35void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
36 enum sway_idle_inhibit_mode mode);
37
38struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_user_inhibitor_for_view(
39 struct sway_view *view);
40
41void sway_idle_inhibit_v1_user_inhibitor_destroy(
42 struct sway_idle_inhibitor_v1 *inhibitor);
43
26struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create( 44struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create(
27 struct wl_display *wl_display, struct wlr_idle *idle); 45 struct wl_display *wl_display, struct wlr_idle *idle);
28#endif 46#endif