kranewm

An ICCCM & EWMH compliant X11 reparenting, dynamic window manager, written in C++
git clone git clone git://git.deurzen.net/kranewm.git
Log | Files | Refs | LICENSE

commit a6ad28e33ecf37f90e651bf153e946c2eb405086
parent 4873a7d743aaf93212c0aa2d403ce47a3c756aa3
Author: deurzen <m.deurzen@tum.de>
Date:   Sat,  4 Sep 2021 07:21:34 +0200

adds do_focus spawn rule

Diffstat:
Msrc/core/model.cc | 24+++++++++++++++++++-----
Msrc/core/rules.hh | 4+++-
2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/core/model.cc b/src/core/model.cc @@ -1650,6 +1650,9 @@ Model::retrieve_rules(Client_ptr client) const continue; } + if (*iter == '@') + rules.do_focus = !invert; + if (*iter == 'f') rules.do_float = !invert; @@ -1882,12 +1885,11 @@ Model::manage(const Window window, const bool ignore, const bool may_map) get_workspace(client->workspace)->add_client(client); - if (client->workspace == mp_workspace->index() - && !m_move_buffer.is_occupied() - && !m_resize_buffer.is_occupied() - ) { + if (client->workspace == mp_workspace->index()) { apply_layout(mp_workspace); - focus_client(client); + + if (!rules.do_focus) + focus_client(client); } if (Util::contains(states, WindowState::DemandsAttention)) @@ -1906,6 +1908,18 @@ Model::manage(const Window window, const bool ignore, const bool may_map) if (producer && producer->producing) consume_client(producer, client); + + if (rules.do_focus) { + if (*rules.do_focus) { + stop_moving(); + stop_resizing(); + focus_client(client); + } else if (mp_focus) { + Client_ptr prev_focus = mp_focus; + focus_client(client); + focus_client(prev_focus); + } + } } void diff --git a/src/core/rules.hh b/src/core/rules.hh @@ -8,7 +8,8 @@ struct Rules { Rules() - : do_float(std::nullopt), + : do_focus(std::nullopt), + do_float(std::nullopt), do_center(std::nullopt), do_fullscreen(std::nullopt), to_partition(std::nullopt), @@ -18,6 +19,7 @@ struct Rules ~Rules() = default; + std::optional<bool> do_focus; std::optional<bool> do_float; std::optional<bool> do_center; std::optional<bool> do_fullscreen;