From 434390779964151a25c822409718478922f82cfb Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:30:14 +0500 Subject: [PATCH 1/4] #86 WIP: Revise desktop key bindings --- doc/apps.md | 7 ------- doc/settings.md | 37 +++++++++++-------------------------- doc/user-interface.md | 34 ++++++++++++---------------------- src/vtm.xml | 36 +++++++++++------------------------- 4 files changed, 34 insertions(+), 80 deletions(-) diff --git a/doc/apps.md b/doc/apps.md index c2ef6e9246..a8108a54a2 100644 --- a/doc/apps.md +++ b/doc/apps.md @@ -462,13 +462,6 @@ Tiling Window Manager is a window container that organizes the workspace into mu - - - - - - - diff --git a/doc/settings.md b/doc/settings.md index ada7d21a19..f9f7043f0e 100644 --- a/doc/settings.md +++ b/doc/settings.md @@ -903,38 +903,23 @@ Notes - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/doc/user-interface.md b/doc/user-interface.md index a9901633c1..171b454c4e 100644 --- a/doc/user-interface.md +++ b/doc/user-interface.md @@ -154,28 +154,18 @@ Horizontal scrolling - Esc+F11 Maximize all focused desktop windows - Esc+F12 Fullscreen the first focused desktop window - Esc+LeftArrow Move window to the left - Esc+RightArrow Move window to the right - Esc+UpArrow Move window up - Esc+DownArrow Move window down - Esc+LeftArrow+UpArrow Move bottom side of window up - Esc+LeftArrow+DownArrow Move bottom side of window down - Esc+RightArrow+UpArrow Move top side of window up - Esc+RightArrow+DownArrow Move top side of window down - Esc+UpArrow+LeftArrow Move left side of window to left - Esc+UpArrow+RightArrow Move left side of window to right - Esc+DownArrow+RightArrow Move right side of window to right - Esc+DownArrow+LeftArrow Move right side of window to left - Ctrl+LeftArrow+DownArrow
Ctrl+DownArrow+LeftArrow Move the bottom left corner of the window outward - Ctrl+RightArrow+DownArrow
Ctrl+DownArrow+RightArrowMove the bottom right corner outside - Ctrl+LeftArrow+UpArrow
Ctrl+UpArrow+LeftArrow Move the top left corner of the window outward - Ctrl+RightArrow+UpArrow
Ctrl+UpArrow+RightArrow Move the top right corner of the window outward - Alt+LeftArrow+DownArrow
Alt+DownArrow+LeftArrow Move the top left corner of the window inward - Alt+RightArrow+DownArrow
Alt+DownArrow+RightArrow Move the top right corner of the window inward - Alt+LeftArrow+UpArrow
Alt+UpArrow+LeftArrow Move the bottom left corner of the window inward - Alt+RightArrow+UpArrow
Alt+UpArrow+RightArrow Move the bottom right corner of the window inward + Esc+F11 Maximize window + Esc+F12 Maximize window to full screen + Esc+'=' | Esc+'+' Increase window size + Esc+'-' Reduce window size + Esc+LeftArrow Move window to the left + Esc+RightArrow Move window to the right + Esc+UpArrow Move window up + Esc+DownArrow Move window down + Esc+LeftArrow+UpArrow | Esc+UpArrow+LeftArrow Move window to the top-left + Esc+LeftArrow+DownArrow | Esc+DownArrow+LeftArrow Move window to the bottom-left + Esc+RightArrow+UpArrow | Esc+UpArrow+RightArrow Move window to the top-right + Esc+RightArrow+DownArrow | Esc+DownArrow+RightArrowMove window to the bottom-right diff --git a/src/vtm.xml b/src/vtm.xml index 35ff751e4c..35afeb6a13 100644 --- a/src/vtm.xml +++ b/src/vtm.xml @@ -454,37 +454,23 @@ R"==( - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + From 2ba82d0ceb2e1d48deec74510b78f4f6b9a7cc48 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:02:22 +0500 Subject: [PATCH 2/4] #86 WIP: Implement RunScript desktop action --- doc/settings.md | 8 ++++++++ doc/user-interface.md | 1 + src/netxs/desktopio/baseui.hpp | 1 + src/vtm.hpp | 20 ++++++++++++++++++++ src/vtm.xml | 1 + 5 files changed, 31 insertions(+) diff --git a/doc/settings.md b/doc/settings.md index f9f7043f0e..6d11306009 100644 --- a/doc/settings.md +++ b/doc/settings.md @@ -394,6 +394,13 @@ Action | Arguments (`data=`) `FocusNextWindow` | | Desktop | Switch focus to the previous desktop window. `Disconnect` | | Desktop | Disconnect from the desktop. `RunApplication` | _`Taskbar item id`_ | Desktop | Run application. Run the default application if no arguments are specified. +`RunScript` | _`Script body`_ | Desktop | Run script. +`AlwaysOnTopWindow` | `on` \| `off` | Desktop | Toggle AlwaysOnTop window flag. +`CloseWindow` | | Desktop | Close window. +`MinimizeWindow` | | Desktop | Minimize window. +`MaximizeWindow` | | Desktop | Maximize window. +`FullscreenWindow` | | Desktop | Maximize window to full screen. +`WarpWindow` | _`IntL, IntR, IntT, IntB`_ | Desktop | Warp desktop window. The data parameter specifies four deltas for the left, right, top and bottom window sides. `TryToQuit` | | Desktop | Shut down the desktop server if no applications are running. `ExclusiveKeyboardMode` | `on` \| `off` | Application | Toggle exclusive keyboard mode. `TerminalFindNext` | | Application | Highlight next match of selected text fragment. Clipboard content is used if no active selection. @@ -908,6 +915,7 @@ Notes + diff --git a/doc/user-interface.md b/doc/user-interface.md index 171b454c4e..db29710637 100644 --- a/doc/user-interface.md +++ b/doc/user-interface.md @@ -154,6 +154,7 @@ Horizontal scrolling + Esc+F1 Open Info-page Esc+F11 Maximize window Esc+F12 Maximize window to full screen Esc+'=' | Esc+'+' Increase window size diff --git a/src/netxs/desktopio/baseui.hpp b/src/netxs/desktopio/baseui.hpp index ddb3edc7bb..199e96ca6c 100644 --- a/src/netxs/desktopio/baseui.hpp +++ b/src/netxs/desktopio/baseui.hpp @@ -316,6 +316,7 @@ namespace netxs::events::userland }; SUBSET_XS( action ) { + EVENT_XS( runscript , input::hids ), EVENT_XS( alwaysontop, input::hids ), EVENT_XS( warp , input::hids ), EVENT_XS( close , input::hids ), diff --git a/src/vtm.hpp b/src/vtm.hpp index 4cd0ba50bd..5200de3eb7 100644 --- a/src/vtm.hpp +++ b/src/vtm.hpp @@ -754,6 +754,7 @@ namespace netxs::app::vtm keybd.proc("Disconnect", [&](hids& gear){ disconnect(gear); }); keybd.proc("TryToQuit", [&](hids& gear){ try_quit(gear); }); keybd.proc("RunApplication", [&](hids& gear){ create_app(gear); gear.set_handled(); }); + keybd.proc("RunScript", [&](hids& gear){ base::riseup(tier::preview, e2::form::proceed::action::runscript , gear); }); keybd.proc("AlwaysOnTopWindow", [&](hids& gear){ base::riseup(tier::preview, e2::form::proceed::action::alwaysontop, gear); }); keybd.proc("WarpWindow", [&](hids& gear){ base::riseup(tier::preview, e2::form::proceed::action::warp , gear); }); keybd.proc("CloseWindow", [&](hids& gear){ base::riseup(tier::preview, e2::form::proceed::action::close , gear); }); @@ -1793,6 +1794,21 @@ namespace netxs::app::vtm bell::signal(tier::general, e2::shutdown, utf::concat(prompt::repl, "Server shutdown")); return "ok"s; } + void run_script(hids& gear) + { + if (gear.args_ptr) + { + auto& args = *gear.args_ptr; + for (auto cmd : args) + { + bell::enqueue(this->This(), [cmd, gear_id = gear.id](auto& boss) // Keep the focus tree intact while processing key events. + { + boss.bell::signal(tier::release, scripting::events::invoke, { .cmd = cmd, .hid = gear_id }); + }); + } + gear.set_handled(); + } + } void always_on_top_focused_windows(hids& gear) { if (gear.args_ptr) @@ -2269,6 +2285,10 @@ namespace netxs::app::vtm } }; + LISTEN(tier::preview, e2::form::proceed::action::runscript, gear) + { + run_script(gear); + }; LISTEN(tier::preview, e2::form::proceed::action::alwaysontop, gear) { always_on_top_focused_windows(gear); diff --git a/src/vtm.xml b/src/vtm.xml index 35afeb6a13..8270ce8935 100644 --- a/src/vtm.xml +++ b/src/vtm.xml @@ -459,6 +459,7 @@ R"==( + From 5e92a572ceca7b20fead3fde67f3dbdb208fd916 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:32:13 +0500 Subject: [PATCH 3/4] Try to fix floating point exceptions --- src/netxs/desktopio/controls.hpp | 2 +- src/netxs/desktopio/logger.hpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/netxs/desktopio/controls.hpp b/src/netxs/desktopio/controls.hpp index 42c0aa82ae..b9904fc9ef 100644 --- a/src/netxs/desktopio/controls.hpp +++ b/src/netxs/desktopio/controls.hpp @@ -435,7 +435,7 @@ namespace netxs::ui { auto& c = iter++->bgc(); auto x0 = (x - area.size.x / 2) / (area.size.x - 4 - 2 * 1.6f); - auto dr = std::sqrt(x0 * x0 + y0); + auto dr = std::sqrt(std::abs(x0 * x0 + y0)); if (dr > 1) c.chan.a = 0; else { diff --git a/src/netxs/desktopio/logger.hpp b/src/netxs/desktopio/logger.hpp index 39e3e40830..3931eab4cb 100644 --- a/src/netxs/desktopio/logger.hpp +++ b/src/netxs/desktopio/logger.hpp @@ -117,10 +117,7 @@ namespace netxs state.block.clear(); } }; -} -namespace -{ template void log(netxs::view format, Args&&... args) { From 2e55d949e3350ae106442a3d39406dfb0ab6271b Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:34:06 +0500 Subject: [PATCH 4/4] v0.9.99.59 --- src/netxs/desktopio/application.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp index 95e4ff2fbd..20a59bcc2d 100644 --- a/src/netxs/desktopio/application.hpp +++ b/src/netxs/desktopio/application.hpp @@ -24,7 +24,7 @@ namespace netxs::app namespace netxs::app::shared { - static const auto version = "v0.9.99.58"; + static const auto version = "v0.9.99.59"; static const auto repository = "https://github.com/directvt/vtm"; static const auto usr_config = "~/.config/vtm/settings.xml"s; static const auto sys_config = "/etc/vtm/settings.xml"s;