Skip to content

Commit

Permalink
directvt#86 Implement WarpWindow desktop action
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Dec 19, 2024
1 parent 2fe4c1a commit f11f93d
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
31 changes: 31 additions & 0 deletions doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,37 @@ Notes
<key="Shift+F7" action=Disconnect/> <!-- Disconnect from the desktop. -->
<key="F10" preview action=TryToQuit/> <!-- Shut down the desktop server if no applications are running. -->
<key="Alt+Shift+N" action=RunApplication/> <!-- Run default application. -->
<key="" action=AlwaysOnTopWindow/><!-- Toggle AlwaysOnTop flag on all focused windows. -->
<key="" action=CloseWindow/> <!-- Close all focused desktop windows. -->
<key="" action=MinimizeWindow/> <!-- Minimize all focused desktop windows. -->
<key="" action=MaximizeWindow/> <!-- Maximize all focused desktop windows. -->
<key="" action=FullscreenWindow/> <!-- Fullscreen the first focused desktop window. -->

<key=""><action=WarpWindow data="0,0,0,0"/></key> <!-- Warp desktop window. The data parameter specifies four deltas for the left, right, top and bottom window sides. -->
<key="Esc+LeftArrow"> <action=WarpWindow data=" 1,-1, 0, 0"/></key> <!-- Move window to the left. -->
<key="Esc+RightArrow"> <action=WarpWindow data="-1, 1, 0, 0"/></key> <!-- Move window to the right. -->
<key="Esc+UpArrow"> <action=WarpWindow data=" 0, 0, 1,-1"/></key> <!-- Move window up. -->
<key="Esc+DownArrow"> <action=WarpWindow data=" 0, 0,-1, 1"/></key> <!-- Move window down. -->

<key="Esc+LeftArrow+UpArrow"> <action=WarpWindow data=" 0, 0, 0,-1"/></key> <!-- Move the bottom window side up. -->
<key="Esc+LeftArrow+DownArrow"> <action=WarpWindow data=" 0, 0, 0, 1"/></key> <!-- Move the bottom window side down. -->
<key="Esc+RightArrow+UpArrow"> <action=WarpWindow data=" 0, 0, 1, 0"/></key> <!-- Move the top window side up. -->
<key="Esc+RightArrow+DownArrow"> <action=WarpWindow data=" 0, 0,-1, 0"/></key> <!-- Move the top window side down. -->

<key="Esc+UpArrow+LeftArrow"> <action=WarpWindow data=" 1, 0, 0, 0"/></key> <!-- Move the left window side to the left. -->
<key="Esc+UpArrow+RightArrow"> <action=WarpWindow data="-1, 0, 0, 0"/></key> <!-- Move the left window side to the right. -->
<key="Esc+DownArrow+RightArrow"> <action=WarpWindow data=" 0, 1, 0, 0"/></key> <!-- Move the right window side to the right. -->
<key="Esc+DownArrow+LeftArrow"> <action=WarpWindow data=" 0,-1, 0, 0"/></key> <!-- Move the right window side to the left. -->

<key="Ctrl+LeftArrow+DownArrow | Ctrl+DownArrow+LeftArrow"> <action=WarpWindow data=" 1, 0, 0, 1"/></key> <!-- Move the left bottom corner to outside. -->
<key="Ctrl+RightArrow+DownArrow | Ctrl+DownArrow+RightArrow"><action=WarpWindow data=" 0, 1, 0, 1"/></key> <!-- Move the right bottom corner to outside. -->
<key="Ctrl+LeftArrow+UpArrow | Ctrl+UpArrow+LeftArrow"> <action=WarpWindow data=" 1, 0, 1, 0"/></key> <!-- Move the left bottom corner to outside. -->
<key="Ctrl+RightArrow+UpArrow | Ctrl+UpArrow+RightArrow"> <action=WarpWindow data=" 0, 1, 1, 0"/></key> <!-- Move the right bottom corner to outside. -->

<key="Alt+LeftArrow+DownArrow | Alt+DownArrow+LeftArrow"> <action=WarpWindow data=" 0,-1,-1, 0"/></key> <!-- Move the left bottom corner to inside. -->
<key="Alt+RightArrow+DownArrow | Alt+DownArrow+RightArrow"> <action=WarpWindow data="-1, 0,-1, 0"/></key> <!-- Move the right bottom corner to inside. -->
<key="Alt+LeftArrow+UpArrow | Alt+UpArrow+LeftArrow"> <action=WarpWindow data=" 0,-1, 0,-1"/></key> <!-- Move the left bottom corner to inside. -->
<key="Alt+RightArrow+UpArrow | Alt+UpArrow+RightArrow"> <action=WarpWindow data="-1, 0, 0,-1"/></key> <!-- Move the right bottom corner to inside. -->
</desktop>
<tile key*>
<key="Ctrl+PageUp" action=TileFocusPrev /> <!-- Focus the previous pane or the split grip. -->
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/controls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ namespace netxs::ui
{
auto head = chord_qiew_list.begin();
auto tail = chord_qiew_list.end();
if (auto first_chord_list = _get_chord_list(*head++))
if (auto first_chord_list = _get_chord_list(utf::trim(*head++)))
{
auto chords = first_chord_list.value();
while (head != tail)
Expand Down
20 changes: 17 additions & 3 deletions src/vtm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1867,9 +1867,23 @@ namespace netxs::app::vtm
}
void warp_focused_windows(hids& gear)
{
auto warp_delta = gear.get_args_or(dent{});
log("warp_focused_windows");
gear.set_handled();
auto warp = gear.get_args_or(dent{});
auto focused_window_list = std::vector<sptr>{};
items.foreach(gear, [&](auto window_ptr)
{
focused_window_list.push_back(window_ptr);
gear.set_handled();
});
if (focused_window_list.size())
{
bell::enqueue(this->This(), [warp, focused_window_list](auto& /*boss*/) // Keep the focus tree intact while processing key events.
{
for (auto w : focused_window_list)
{
w->bell::signal(tier::preview, e2::form::layout::swarp, warp);
}
});
}
}

public:
Expand Down
27 changes: 26 additions & 1 deletion src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,32 @@ R"==(
<key="" action=MinimizeWindow/> <!-- Minimize all focused desktop windows. -->
<key="" action=MaximizeWindow/> <!-- Maximize all focused desktop windows. -->
<key="" action=FullscreenWindow/> <!-- Fullscreen the first focused desktop window. -->
<key=""><action=WarpWindow data="0,0;0,0"/></key> <!-- Warp desktop window. The data parameter specifies two 2D deltas of the upper-left and lower-right corners of the window. -->

<key=""><action=WarpWindow data="0,0,0,0"/></key> <!-- Warp desktop window. The data parameter specifies four deltas for the left, right, top and bottom window sides. -->
<key="Esc+LeftArrow"> <action=WarpWindow data=" 1,-1, 0, 0"/></key> <!-- Move window to the left. -->
<key="Esc+RightArrow"> <action=WarpWindow data="-1, 1, 0, 0"/></key> <!-- Move window to the right. -->
<key="Esc+UpArrow"> <action=WarpWindow data=" 0, 0, 1,-1"/></key> <!-- Move window up. -->
<key="Esc+DownArrow"> <action=WarpWindow data=" 0, 0,-1, 1"/></key> <!-- Move window down. -->

<key="Esc+LeftArrow+UpArrow"> <action=WarpWindow data=" 0, 0, 0,-1"/></key> <!-- Move the bottom window side up. -->
<key="Esc+LeftArrow+DownArrow"> <action=WarpWindow data=" 0, 0, 0, 1"/></key> <!-- Move the bottom window side down. -->
<key="Esc+RightArrow+UpArrow"> <action=WarpWindow data=" 0, 0, 1, 0"/></key> <!-- Move the top window side up. -->
<key="Esc+RightArrow+DownArrow"> <action=WarpWindow data=" 0, 0,-1, 0"/></key> <!-- Move the top window side down. -->

<key="Esc+UpArrow+LeftArrow"> <action=WarpWindow data=" 1, 0, 0, 0"/></key> <!-- Move the left window side to the left. -->
<key="Esc+UpArrow+RightArrow"> <action=WarpWindow data="-1, 0, 0, 0"/></key> <!-- Move the left window side to the right. -->
<key="Esc+DownArrow+RightArrow"> <action=WarpWindow data=" 0, 1, 0, 0"/></key> <!-- Move the right window side to the right. -->
<key="Esc+DownArrow+LeftArrow"> <action=WarpWindow data=" 0,-1, 0, 0"/></key> <!-- Move the right window side to the left. -->

<key="Ctrl+LeftArrow+DownArrow | Ctrl+DownArrow+LeftArrow"> <action=WarpWindow data=" 1, 0, 0, 1"/></key> <!-- Move the left bottom corner to outside. -->
<key="Ctrl+RightArrow+DownArrow | Ctrl+DownArrow+RightArrow"><action=WarpWindow data=" 0, 1, 0, 1"/></key> <!-- Move the right bottom corner to outside. -->
<key="Ctrl+LeftArrow+UpArrow | Ctrl+UpArrow+LeftArrow"> <action=WarpWindow data=" 1, 0, 1, 0"/></key> <!-- Move the left bottom corner to outside. -->
<key="Ctrl+RightArrow+UpArrow | Ctrl+UpArrow+RightArrow"> <action=WarpWindow data=" 0, 1, 1, 0"/></key> <!-- Move the right bottom corner to outside. -->

<key="Alt+LeftArrow+DownArrow | Alt+DownArrow+LeftArrow"> <action=WarpWindow data=" 0,-1,-1, 0"/></key> <!-- Move the left bottom corner to inside. -->
<key="Alt+RightArrow+DownArrow | Alt+DownArrow+RightArrow"> <action=WarpWindow data="-1, 0,-1, 0"/></key> <!-- Move the right bottom corner to inside. -->
<key="Alt+LeftArrow+UpArrow | Alt+UpArrow+LeftArrow"> <action=WarpWindow data=" 0,-1, 0,-1"/></key> <!-- Move the left bottom corner to inside. -->
<key="Alt+RightArrow+UpArrow | Alt+UpArrow+RightArrow"> <action=WarpWindow data="-1, 0, 0,-1"/></key> <!-- Move the right bottom corner to inside. -->
</desktop>
<tile key*>
<key="Ctrl+PageUp" action=TileFocusPrev /> <!-- Focus the previous pane or the split grip. -->
Expand Down

0 comments on commit f11f93d

Please sign in to comment.