diff options
author | Guido Günther <agx@sigxcpu.org> | 2018-02-23 11:51:30 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-02-25 16:53:36 +0100 |
commit | 9864f1c1361c196b33f524d917d7b5e5e10b0959 (patch) | |
tree | 81597f36a57d328442ad41833232a3f5f87962f0 /rootston | |
parent | e2ea1ebe48db25f7372bbab21bc66cde5934895b (diff) |
rootston: wire up window alpha keybinding
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/desktop.c | 9 | ||||
-rw-r--r-- | rootston/keyboard.c | 5 | ||||
-rw-r--r-- | rootston/rootston.ini.example | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index 9d5cd2fa..ee0172e4 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -278,6 +278,15 @@ void view_rotate(struct roots_view *view, float rotation) { view_damage_whole(view); } +void view_cycle_alpha(struct roots_view *view) { + view->alpha -= 0.05; + /* Don't go completely transparent */ + if (view->alpha < 0.1) { + view->alpha = 1.0; + } + view_damage_whole(view); +} + void view_close(struct roots_view *view) { if (view->close) { view->close(view); diff --git a/rootston/keyboard.c b/rootston/keyboard.c index 6ec90c31..b5dac51c 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -106,6 +106,11 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard, } } else if (strcmp(command, "next_window") == 0) { roots_seat_cycle_focus(seat); + } else if (strcmp(command, "alpha") == 0) { + struct roots_view *focus = roots_seat_get_focus(seat); + if (focus != NULL) { + view_cycle_alpha(focus); + } } else if (strncmp(exec_prefix, command, strlen(exec_prefix)) == 0) { const char *shell_cmd = command + strlen(exec_prefix); pid_t pid = fork(); diff --git a/rootston/rootston.ini.example b/rootston/rootston.ini.example index a6619767..6f29a35d 100644 --- a/rootston/rootston.ini.example +++ b/rootston/rootston.ini.example @@ -42,8 +42,10 @@ meta-key = Logo # - "exec" to execute a shell command # - "close" to close the current view # - "next_window" to cycle through windows +# - "alpha" to cycle a window's alpha channel [bindings] Logo+Shift+e = exit Logo+q = close Logo+m = maximize Alt+Tab = next_window +Ctrl+Shift+a = alpha |