--- a/plugins/tile/tile-plugin.cpp +++ b/plugins/tile/tile-plugin.cpp @@ -51,6 +51,7 @@ { private: wf::view_matcher_t tile_by_default{"simple-tile/tile_by_default"}; + wf::option_wrapper_t float_on_top{"simple-tile/float_on_top"}; wf::option_wrapper_t keep_fullscreen_on_adjacent{"simple-tile/keep_fullscreen_on_adjacent"}; wf::option_wrapper_t button_move{"simple-tile/button_move"}; wf::option_wrapper_t button_resize{"simple-tile/button_resize"}; @@ -267,11 +268,28 @@ { detach_view(view); wf::get_core().default_wm->tile_request(view, 0); + if (float_on_top && !view->has_data("wm-actions-above")) + { + wf::wm_actions_set_above_state_signal ev{view, true}; + output->emit(&ev); + // wm-actions may be disabled; only claim a successful change. + if (view->has_data("wm-actions-above")) + { + view->store_data(std::make_unique(), + "simple-tile-floating-above"); + } + } } else { attach_view(view); } }); + }; + + wf::signal::connection_t on_above_changed = + [=] (wf::wm_actions_above_changed_signal *ev) + { + ev->view->erase_data("simple-tile-floating-above"); }; wf::activator_callback on_toggle_maximized = [=] (auto) @@ -406,6 +424,7 @@ this->output = wo; input_grab = std::make_unique("simple-tile", output, nullptr, this, nullptr); output->connect(&on_view_mapped); + output->connect(&on_above_changed); output->connect(&on_tile_request); output->connect(&on_fullscreen_request); output->connect(&on_view_change_workspace); @@ -446,6 +465,11 @@ void fini() override { + for (auto view : wf::get_core().get_all_views()) + { + clear_auto_floating_above(view); + } + preview_manager.reset(); fini_output_tracking(); for (auto wset : workspace_set_t::get_all()) @@ -477,6 +501,7 @@ wf::signal::connection_t on_view_unmapped = [=] (wf::view_unmapped_signal *ev) { + clear_auto_floating_above(ev->view); auto toplevel = toplevel_cast(ev->view); if (!toplevel) { --- a/plugins/tile/tile-wset.hpp +++ b/plugins/tile/tile-wset.hpp @@ -1,6 +1,8 @@ #pragma once #include "tree.hpp" +#include "../wm-actions/wm-actions-signals.hpp" +#include #include "tree-controller.hpp" #include "wayfire/view-helpers.hpp" #include "wayfire/txn/transaction-manager.hpp" @@ -28,6 +30,29 @@ namespace wf { +// Only undo the above state that Simple Tile itself added. Manual changes +// through wm-actions relinquish this ownership. +inline void clear_auto_floating_above(wayfire_view view) +{ + if (!view->has_data("simple-tile-floating-above")) + { + return; + } + + view->erase_data("simple-tile-floating-above"); + if (view->has_data("wm-actions-above")) + { + if (auto output = view->get_output()) + { + wf::wm_actions_set_above_state_signal ev{view, false}; + output->emit(&ev); + } else + { + view->erase_data("wm-actions-above"); + } + } +} + /** * When a view is moved from one output to the other, we want to keep its tiled * status. To achieve this, we do the following: @@ -251,6 +276,7 @@ std::unique_ptr setup_view_tiling(wayfire_toplevel_view view, wf::point_t vp) { + clear_auto_floating_above(view); view->set_allowed_actions(VIEW_ALLOW_WS_CHANGE); auto node = view->get_root_node(); wf::scene::readd_front(tiled_sublayer[vp.x][vp.y], node); --- a/metadata/simple-tile.xml +++ b/metadata/simple-tile.xml @@ -13,6 +13,11 @@ <_short>Keep fullscreen on adjacent <_long>Specifies whether to keep fullscreen state when changing the focus. If **true**, the next focused window will also get fullscreen. If **false**, leaves fullscreen. true + +