Skip to content

Commit

Permalink
Merge pull request #688 from o-sdn-o/gui-bridge
Browse files Browse the repository at this point in the history
Implement RunApplication action
  • Loading branch information
o-sdn-o authored Nov 24, 2024
2 parents 77a368b + 8e5ac5a commit c5a38c5
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 64 deletions.
11 changes: 7 additions & 4 deletions doc/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,19 @@ Value | Arguments (`data=`) | Description
-----------------------------|-------------------------------|------------
Noop | | Ignore all events for the specified key combination. No further processing.
DropAutoRepeat | | Ignore `Key Repeat` events for the specified key combination. This binding should be specified before the main action for the key combination.
SwitchHotkeyScheme | _Scheme name_ | Switch the hotkey scheme to the specified one.
SwitchHotkeyScheme | _`Scheme name`_ | Switch the hotkey scheme to the specified one.
TerminalCwdSync | | Current working directory sync toggle. The command to send for synchronization is configurable via the `<config><term cwdsync=" cd $P\n"/></config>` setting's option. Where `$P` is a variable containing current path received via OSC 9;9 notification. <br>To enable OSC9;9 shell notifications:<br>- Windows Command Prompt:<br> `setx PROMPT $e]9;9;$P$e\$P$G`<br>- PowerShell:<br> `function prompt{ $e=[char]27; "$e]9;9;$(Convert-Path $pwd)$e\PS $pwd$('>' * ($nestedPromptLevel + 1)) " }`<br>- Bash:<br> `export PS1='\[\033]9;9;\w\033\\\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '`
TerminalWrapMode | `on` \| `off` | Set terminal scrollback lines wrapping mode. Applied to the active selection if it is.
TerminalAlignMode | `left` \| `right` \| `center` | Set terminal scrollback lines aligning mode. Applied to the active selection if it is.
TerminalFindNext | | Highlight next match of selected text fragment. Clipboard content is used if no active selection.
TerminalFindPrev | | Highlight previous match of selected text fragment. Clipboard content is used if no active selection.
TerminalOutput | _Text string_ | Direct output the string to the terminal scrollback.
TerminalSendKey | _Text string_ | Simulating keypresses using the specified string.
TerminalOutput | _`Text string`_ | Direct output the string to the terminal scrollback.
TerminalSendKey | _`Text string`_ | Simulating keypresses using the specified string.
TerminalQuit | | Terminate runnning console apps and close terminal.
TerminalRestart | | Terminate runnning console apps and restart current session.
TerminalFullscreen | | Toggle fullscreen mode.
TerminalMaximize | | Toggle between maximized and normal window size.
TerminalMinimize | | Minimize window.
TerminalUndo | | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last input.
TerminalRedo | | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last Undo command.
TerminalClipboardCopy | | Сopy selection to clipboard.
Expand All @@ -124,7 +125,7 @@ TerminalClipboardWipe | | Reset clipboard.
TerminalClipboardFormat | `none` \| `text` \| `ansi` \|<br>`rich` \| `html` \| `protected` | Set terminal text selection copy format.
TerminalSelectionRect | `on` \| `off` | Set linear(off) or rectangular(on) selection form using boolean value.
TerminalSelectionCancel | | Deselect a selection.
TerminalSelectionOneShot | `none` \| `text` \| `ansi` \|<br>`rich` \| `html` \| `protected` | One-shot toggle to copy text while mouse tracking is active. Keep selection if `Ctrl` key is pressed..
TerminalSelectionOneShot | `none` \| `text` \| `ansi` \|<br>`rich` \| `html` \| `protected` | One-shot toggle to copy text while mouse tracking is active. Keep selection if `Ctrl` key is pressed.
TerminalViewportCopy | | Сopy viewport to clipboard.
TerminalScrollViewportByPage | _`IntX, IntY`_ | Scroll viewport by _`IntX, IntY`_ pages.
TerminalScrollViewportByCell | _`IntX, IntY`_ | Scroll viewport by _`IntX, IntY`_ cells.
Expand Down Expand Up @@ -268,6 +269,7 @@ Hotkey | Description
<item label="Quit" type="Command" action=TerminalQuit/>
<item label="Fullscreen" type="Command" action=TerminalFullscreen/>
<item label="Maximize" type="Command" action=TerminalMaximize/>
<item label="Minimize" type="Command" action=TerminalMinimize/>
<item label="Noop" type="Command" action=Noop/>

<item label="Sync" tooltip=" CWD sync is off " type="Option" action=TerminalCwdSync data="off">
Expand Down Expand Up @@ -341,6 +343,7 @@ Hotkey | Description
<key="" action=TerminalWrapMode/> <!-- Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is. The argument is boolean. -->
<key="" action=TerminalFullscreen/> <!-- Toggle fullscreen mode. -->
<key="" action=TerminalMaximize/> <!-- Toggle between maximized and normal window size. -->
<key="" action=TerminalMinimize/> <!-- Minimize window. -->
<key="" action=TerminalStdioLog/> <!-- Toggle stdin/stdout logging. -->
<key="" action=TerminalQuit/> <!-- Terminate runnning console apps and close terminal. -->
<key="" action=TerminalRestart/> <!-- Terminate runnning console apps and restart current session. -->
Expand Down
12 changes: 8 additions & 4 deletions doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,11 @@ Action | Arguments (`data=`)
`RollFontsBackward` | | Native GUI window | Roll font list backward.
`RollFontsForward` | | Native GUI window | Roll font list forward.
`ToggleDebugOverlay` | | TUI matrix | Toggle debug overlay.
`SwitchHotkeyScheme` | _Scheme name_ | TUI matrix,<br>Window menu | Switch the hotkey scheme to the specified one.
`SwitchHotkeyScheme` | _`Scheme name`_ | TUI matrix,<br>Window menu | Switch the hotkey scheme to the specified one.
`FocusPrevWindow` | | Desktop | Switch focus to the next desktop window.
`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.
`TryToQuit` | | Desktop | Shut down the desktop server if no applications are running.
`TerminalFindNext` | | Application | Highlight next match of selected text fragment. Clipboard content is used if no active selection.
`TerminalFindPrev` | | Application | Highlight previous match of selected text fragment. Clipboard content is used if no active selection.
Expand All @@ -407,19 +408,20 @@ Action | Arguments (`data=`)
`TerminalClipboardPaste` | | Application | Paste from clipboard.
`TerminalClipboardWipe` | | Application | Reset clipboard.
`TerminalClipboardFormat` | `none` \| `text` \| `ansi` \|<br>`rich` \| `html` \| `protected` | Application | Switch terminal text selection copy format.
`TerminalOutput` | _Text string_ | Application | Direct output the string to the terminal scrollback.
`TerminalSendKey` | _Text string_ | Application | Simulating keypresses using the specified string.
`TerminalOutput` | _`Text string`_ | Application | Direct output the string to the terminal scrollback.
`TerminalSendKey` | _`Text string`_ | Application | Simulating key presses using the specified string.
`TerminalUndo` | | Application | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last input.
`TerminalRedo` | | Application | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last Undo command.
`TerminalCwdSync` | | Application | Toggle the current working directory sync mode.
`TerminalWrapMode` | `on` \| `off` | Application | Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is.
`TerminalAlignMode` | `left` \| `right` \| `center` | Application | Set terminal scrollback lines aligning mode. Applied to the active selection if it is.
`TerminalFullscreen` | | Application | Toggle fullscreen mode.
`TerminalMaximize` | | Application | Toggle between maximized and normal window size.
`TerminalMinimize` | | Application | Minimize window.
`TerminalStdioLog` | `on` \| `off` | Application | Toggle stdin/stdout logging to the specified state, or just toggle to another state if no arguments are specified.
`TerminalSelectionRect` | `on` \| `off` | Application | Toggle between linear and rectangular selection form.
`TerminalSelectionCancel` | | Application | Deselect a selection.
`TerminalSelectionOneShot` | `text` \| `ansi` \|<br>`rich` \| `html` \| `protected` | Application | One-shot toggle to copy text while mouse tracking is active. Keep selection if `Ctrl` key is pressed..
`TerminalSelectionOneShot` | `text` \| `ansi` \|<br>`rich` \| `html` \| `protected` | Application | One-shot toggle to copy text while mouse tracking is active. Keep selection if `Ctrl` key is pressed.
`TerminalRestart` | | Application | Terminate runnning console apps and restart current session.
`TerminalQuit` | | Application | Terminate runnning console apps and close terminal.

Expand Down Expand Up @@ -867,6 +869,7 @@ Notes
<key="Ctrl+PageDown" action=FocusNextWindow/> <!-- Switch focus to the previous desktop window. -->
<key="Shift+F7" action=Disconnect/> <!-- Disconnect from the desktop. -->
<key="F10" action=TryToQuit/> <!-- Shut down the desktop server if no applications are running. -->
<key="Alt+Shift+N" action=RunApplication/> <!-- Run default application. -->
</desktop>
<term key*> <!-- Application specific layer key bindings. -->
<key="Alt+RightArrow" action=TerminalFindNext/> <!-- Highlight next match of selected text fragment. Clipboard content is used if no active selection. -->
Expand Down Expand Up @@ -904,6 +907,7 @@ Notes
<key="" action=TerminalAlignMode/> <!-- Toggle terminal scrollback lines aligning mode. Applied to the active selection if it is. -->
<key="" action=TerminalFullscreen/> <!-- Toggle fullscreen mode. -->
<key="" action=TerminalMaximize/> <!-- Toggle between maximized and normal window size. -->
<key="" action=TerminalMinimize/> <!-- Minimize window. -->
<key="" action=TerminalStdioLog/> <!-- Toggle stdin/stdout logging. -->
<key="" action=TerminalRestart/> <!-- Terminate runnning console apps and restart current session. -->
<key="" action=TerminalQuit/> <!-- Terminate runnning console apps and close terminal. -->
Expand Down
6 changes: 5 additions & 1 deletion doc/user-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
</thead>
<tbody>
<tr>
<th>Ctrl-Alt ¹</th>
<th>Ctrl-Alt ¹ (Alt+Shift+B on non-Windows platforms)</th>
<td colspan="9">Toggle alternate keyboard mode</td>
</tr>
<tr>
<th>Alt+Shift+N ¹</th>
<td colspan="9">Run app</td>
</tr>
<tr>
<th>F10 ¹</th>
<td colspan="9">Disconnect all users and shutdown if there are no apps running</td>
Expand Down
3 changes: 1 addition & 2 deletions src/netxs/apps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ namespace netxs::app::shared
auto window_clr = skin::color(tone::window_clr);
auto window = ui::veer::ctor()
->limits(dot_11)
->plugin<pro::focus>(pro::focus::mode::active); // Required for standalone mode.
->plugin<pro::focus>();
auto term = ui::cake::ctor()
->active(window_clr);
auto dtvt = ui::dtvt::ctor();
Expand Down Expand Up @@ -775,7 +775,6 @@ namespace netxs::app::shared
app::shared::initialize info_builder{ app::info::id, build_info };
//todo UD
app::shared::initialize noui_builder{ "noui", build_vtty };
app::shared::initialize xlvt_builder{ "xlvt", build_dtty };
app::shared::initialize shell_builder{ "shell", build_vtty };
app::shared::initialize ansivt_builder{ "ansivt", build_vtty };
app::shared::initialize headless_builder{ "headless", build_vtty };
Expand Down
9 changes: 1 addition & 8 deletions src/netxs/apps/desk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ namespace netxs::app::desk
};
boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear, -, (inst_id, group_focus = faux))
{
static auto offset = dot_00; // static: Share initial offset between all instances.
if (gear.meta(hids::anyCtrl | hids::anyAlt | hids::anyShift | hids::anyWin)) // Not supported with any modifier but Ctrl.
{
if (gear.meta(hids::anyCtrl)) // Toggle group focus.
Expand All @@ -332,13 +331,7 @@ namespace netxs::app::desk
return;
}
boss.bell::signal(tier::anycast, events::ui::selected, inst_id);
auto viewport = gear.owner.bell::signal(tier::request, e2::form::prop::viewport);
offset = (offset + dot_21 * 2) % std::max(dot_11, viewport.size * 7 / 32);
gear.slot.coor = viewport.coor + offset + viewport.size * 1 / 32 + dot_11;
gear.slot.size = viewport.size * 3 / 4;
gear.slot_forced = faux;
boss.base::riseup(tier::request, e2::form::proceed::createby, gear);
gear.dismiss(true);
gear.owner.bell::signal(tier::preview, e2::form::proceed::createby, gear);
};
});
auto head = head_fork->attach(slot::_1, ui::item::ctor(obj_desc)
Expand Down
8 changes: 8 additions & 0 deletions src/netxs/apps/term.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ namespace netxs::app::terminal
X(TerminalCwdSync ) /* */ \
X(TerminalFullscreen ) /* */ \
X(TerminalMaximize ) /* */ \
X(TerminalMinimize ) /* */ \
X(TerminalRestart ) /* */ \
X(TerminalSendKey ) /* */ \
X(TerminalWrapMode ) /* */ \
Expand Down Expand Up @@ -375,6 +376,13 @@ namespace netxs::app::terminal
boss.base::riseup(tier::preview, e2::form::size::enlarge::maximize, gear);
});
}
static void TerminalMinimize(ui::item& boss, menu::item& item)
{
_submit<true>(boss, item, [](auto& boss, auto& /*item*/, auto& gear)
{
boss.base::riseup(tier::release, e2::form::size::minimize, gear);
});
}
static void TerminalRestart(ui::item& boss, menu::item& item)
{
_submit<true>(boss, item, [](auto& boss, auto& /*item*/, auto& /*gear*/)
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace netxs::app

namespace netxs::app::shared
{
static const auto version = "v0.9.99.50";
static const auto version = "v0.9.99.51";
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;
Expand Down
15 changes: 0 additions & 15 deletions src/netxs/desktopio/controls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,6 @@ namespace netxs::ui
auto lock = src_ptr->bell::sync();
if (auto parent = src_ptr->parent())
{
parent->base::riseup(tier::request, hids::events::focus::hop, { .what = src_ptr, .item = dst_ptr });
auto gear_id_list = pro::focus::off(src_ptr);
pro::focus::set(dst_ptr, gear_id_list, solo::off);
}
Expand Down Expand Up @@ -1494,20 +1493,6 @@ namespace netxs::ui
auto& route = iter->second;
notify_set_focus(route, seed);
};
// pro::focus: Replace next hop object "seed.what" with "seed.item".
boss.LISTEN(tier::request, hids::events::focus::hop, seed, memo)
{
for (auto& [gear_id, route] : gears)
{
for (auto& next_wptr : route.next)
{
if (next_wptr.lock() == seed.what)
{
next_wptr = seed.item;
}
}
}
};
// all tier::previews going to outside (upstream)
// all tier::releases going to inside (downstream)
// pro::focus: Subscribe on focus offers. Build a focus tree.
Expand Down
Loading

0 comments on commit c5a38c5

Please sign in to comment.