diff --git a/src/netxs/apps.hpp b/src/netxs/apps.hpp index 282993b736..680234c4fd 100644 --- a/src/netxs/apps.hpp +++ b/src/netxs/apps.hpp @@ -182,23 +182,7 @@ namespace netxs::app::shared boss.RISEUP(tier::preview, e2::form::prop::zorder, zpos::backmost); parent.LISTEN(tier::release, hids::events::mouse::button::click::right, gear) { - boss.RISEUP(tier::request, e2::form::prop::ui::header, old_title, ()); - gear.owner.RISEUP(tier::request, hids::events::clipbrd, gear); - auto& data = gear.board::cargo; - - if (utf::is_plain(data.utf8)) // Reset aligning to the center if text is plain. - { - auto align = ansi::jet(bias::center); - boss.RISEUP(tier::preview, e2::form::prop::ui::header, align); - } - // Copy clipboard data to title. - boss.RISEUP(tier::preview, e2::form::prop::ui::header, title, (data.utf8)); - gear.dismiss(); - - if (old_title.size()) // Copy old title to clipboard. - { - gear.set_clipboard(dot_00, old_title, mime::ansitext); - } + app::shared::set_title(boss, gear, bias::center); }; }; }); diff --git a/src/netxs/apps/tile.hpp b/src/netxs/apps/tile.hpp index df121e072f..4753479392 100644 --- a/src/netxs/apps/tile.hpp +++ b/src/netxs/apps/tile.hpp @@ -928,6 +928,14 @@ namespace netxs::app::tile gear.dismiss(true); }; }}, + { menu::item{ menu::item::type::Command, true, 0, std::vector{{ .label = "\"…\"", .notes = " Set tiling manager window title using clipboard data ", .brush = p3 }}}, + [](auto& boss, auto& item) + { + boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear) + { + app::shared::set_title(boss, gear); + }; + }}, { menu::item{ menu::item::type::Command, true, 0, std::vector{{ .label = " × ", .notes = " Close active app or remove pane if there is no running app ", .brush = p1 }}}, [](auto& boss, auto& item) { diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp index a392f7fcd9..71555152e4 100644 --- a/src/netxs/desktopio/application.hpp +++ b/src/netxs/desktopio/application.hpp @@ -102,6 +102,24 @@ namespace netxs::app::shared auto vt = scroll_bars->attach(slot::_2, ui::grip::ctor(master)); return scroll_bars; }; + const auto set_title = [](base& boss, input::hids& gear, bias alignment = bias::left) + { + boss.RISEUP(tier::request, e2::form::prop::ui::header, old_title, ()); + gear.owner.RISEUP(tier::request, hids::events::clipbrd, gear); + auto& data = gear.board::cargo; + if (utf::is_plain(data.utf8) || alignment != bias::left) // Reset aligning to the center if text is plain. + { + auto align = ansi::jet(alignment); + boss.RISEUP(tier::preview, e2::form::prop::ui::header, align); + } + // Copy clipboard data to title. + boss.RISEUP(tier::preview, e2::form::prop::ui::header, title, (data.utf8)); + gear.dismiss(true); + if (old_title.size()) // Copy old title to clipboard. + { + gear.set_clipboard(dot_00, old_title, mime::ansitext); + } + }; using builder_t = std::function;