Skip to content

Commit 1d84f7c

Browse files
authored
Merge pull request #693 from o-sdn-o/gui-bridge
Implement keyboard access for Tiling Window Manager
2 parents d5d41bb + ea388b8 commit 1d84f7c

24 files changed

+1709
-1047
lines changed

doc/apps.md

+194-96
Large diffs are not rendered by default.

doc/settings.md

+126-72
Large diffs are not rendered by default.

doc/user-interface.md

+21
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,27 @@
242242
</tbody>
243243
</table>
244244

245+
## Tiling Window Manager
246+
247+
<table>
248+
<thead>
249+
<tr><th>Hotkey ¹</th> <th>Default action</th></tr>
250+
</thead>
251+
<tbody>
252+
<tr><th>Ctrl+PageUp</th> <td>Focus the previous pane or splitting grip.</td></tr>
253+
<tr><th>Ctrl+PageDown</th> <td>Focus the next pane or splitting grip.</td></tr>
254+
<tr><th>Alt+Shift+N</th> <td>Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar.</td></tr>
255+
<tr><th>Alt+Shift+A</th> <td>Select all panes.</td></tr>
256+
<tr><th>Alt+Shift+'|'</th> <td>Split active panes horizontally.</td></tr>
257+
<tr><th>Alt+Shift+Minus</th> <td>Split active panes vertically.</td></tr>
258+
<tr><th>Alt+Shift+R</th> <td>Change split orientation.</td></tr>
259+
<tr><th>Alt+Shift+S</th> <td>Swap two or more panes.</td></tr>
260+
<tr><th>Alt+Shift+E</th> <td>Equalize split ratio.</td></tr>
261+
<tr><th>Alt+Shift+F2</th> <td>Set tiling window manager title using clipboard data.</td></tr>
262+
<tr><th>Alt+Shift+W</th> <td>Close active application.</td></tr>
263+
</tbody>
264+
</table>
265+
245266
---
246267

247268
¹ — Key bindings can be customized using settings.

doc/vt-input-mode.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Note: By enabling `vt-input-mode`, all current terminal modes are automatically
7878
```
7979
- Mouse
8080
```
81-
ESC _ event=mouse ; id=0 ; kbmods=<KeyMods> ; coord=<X>,<Y> ; buttons=<ButtonState> ; wheel=<DeltaY>,<DeltaX> ESC \
81+
ESC _ event=mouse ; id=0 ; kbmods=<KeyMods> ; coord=<X>,<Y> ; buttons=<ButtonState> ; wheel=<DeltaY>[,<DeltaX>] ESC \
8282
```
8383
- Focus
8484
```
@@ -351,16 +351,16 @@ Key ID | Name | Generic Name | Scan Code | Notes
351351
### Mouse
352352

353353
```
354-
ESC _ event=mouse ; id=0 ; kbmods=<KeyMods> ; coord=<X>,<Y> ; buttons=<ButtonState> ; wheel=<DeltaY>,<DeltaX> ESC \
354+
ESC _ event=mouse ; id=0 ; kbmods=<KeyMods> ; coord=<X>,<Y> ; buttons=<ButtonState> ; wheel=<DeltaY>[,<DeltaX>] ESC \
355355
```
356356

357-
Attribute | Description
358-
--------------------------|------------
359-
`id=0` | Seat id.
360-
`kbmods=<KeyMods>` | Keyboard modifiers (see Keyboard event).
361-
`coord=<X>,<Y>` | Pixel-wise coordinates of the mouse pointer. Each coordinate is represented in the form of a floating point value of the sum of the integer coordinate of the cell in the terminal window grid and the relative offset within the cell in the range `[0.0f, 1.0f)`.
362-
`buttons=<ButtonState>` | Mouse button state.
363-
`wheel=<DeltaY>,<DeltaX>` | Vertical and horizontal wheel high-resolution delta represented as floating point value.
357+
Attribute | Description
358+
----------------------------|------------
359+
`id=0` | Seat id.
360+
`kbmods=<KeyMods>` | Keyboard modifiers (see Keyboard event).
361+
`coord=<X>,<Y>` | Pixel-wise coordinates of the mouse pointer. Each coordinate is represented in the form of a floating point value of the sum of the integer coordinate of the cell in the terminal window grid and the relative offset within the cell in the range `[0.0f, 1.0f)`.
362+
`buttons=<ButtonState>` | Mouse button state.
363+
`wheel=<DeltaY>[,<DeltaX>]` | Vertical and horizontal high-resolution wheel delta integer value.
364364

365365
In response to the activation of `mouse` tracking, the application receives a vt-sequence containing current mouse state:
366366
```

src/netxs/apps.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,10 @@ namespace netxs::app::shared
389389
->limits(dot_11)
390390
->plugin<pro::focus>();
391391
auto term_cake = ui::cake::ctor()
392+
->plugin<pro::focus>()
392393
->active(window_clr);
393394
auto dtvt = ui::dtvt::ctor()
394-
->plugin<pro::focus>(pro::focus::mode::relay, faux/*default: don't cut_scope*/, faux/*no default focus*/)
395+
->plugin<pro::focus>(pro::focus::mode::relay, faux/*no default focus*/)
395396
->limits(dot_11);
396397
auto scrl = term_cake->attach(ui::rail::ctor());
397398
auto defclr = config.take("/config/terminal/colors/default", cell{}.fgc(whitelt).bgc(blackdk));
@@ -466,8 +467,10 @@ namespace netxs::app::shared
466467
{
467468
if (!!started == order)
468469
{
470+
auto prev_ptr = boss.back();
469471
boss.roll();
470-
boss.bell::signal(tier::request, hids::events::focus::hop, { .item = boss.back() });
472+
auto next_ptr = boss.back();
473+
pro::focus::hop(prev_ptr, next_ptr);
471474
boss.back()->base::riseup(tier::preview, e2::form::prop::ui::footer);
472475
boss.back()->reflow();
473476
boss.back()->deface();

src/netxs/apps/desk.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ namespace netxs::app::desk
598598
owner_id = parent.id;
599599
};
600600
auto oneshot = ptr::shared(hook{});
601-
parent.LISTEN(tier::release, hids::events::focus::any, seed, *oneshot, (oneshot, usrcfg))
601+
parent.LISTEN(tier::release, hids::events::focus::set::any, seed, *oneshot, (oneshot, usrcfg))
602602
{
603603
usrcfg.win = {};
604604
usrcfg.hid = seed.gear_id;

src/netxs/apps/term.hpp

+3-51
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ namespace netxs::app::terminal
9696
{
9797
static constexpr auto cwdsync = "/config/terminal/cwdsync";
9898
static constexpr auto borders = "/config/terminal/border";
99-
static constexpr auto menuitems = "/config/terminal/menu/item";
10099
}
101100

102101
using events = netxs::events::userland::terminal;
@@ -196,19 +195,11 @@ namespace netxs::app::terminal
196195
//auto highlight_color = skin::color(tone::highlight);
197196
//auto c3 = highlight_color;
198197

199-
auto menudata = config.list(attr::menuitems);
200-
201-
static auto type_options = std::unordered_map<text, si32>
202-
{{ "Splitter", menu::type::Splitter },
203-
{ "Command", menu::type::Command },
204-
{ "Option", menu::type::Option },
205-
{ "Repeat", menu::type::Repeat }};
206-
207198
using term = ui::term;
208199
using preview = terminal::events::preview;
209200
using release = terminal::events::release;
210201

211-
static const auto proc_map = std::unordered_map<text, std::function<void(ui::item&, menu::item&)>, qiew::hash, qiew::equal>
202+
static const auto proc_map = menu::action_map_t
212203
{
213204
{ term::action::Noop, [](ui::item& /*boss*/, menu::item& /*item*/){ } },
214205
{ term::action::ExclusiveKeyboardMode, [](ui::item& boss, menu::item& item)
@@ -529,47 +520,8 @@ namespace netxs::app::terminal
529520
}},
530521
};
531522

532-
auto list = menu::list{};
533-
auto defs = menu::item::look{};
534-
for (auto data_ptr : menudata)
535-
{
536-
auto item = menu::item{};
537-
auto& data = *data_ptr;
538-
auto action = data.take(menu::attr::action, ""s);
539-
item.type = data.take(menu::attr::type, menu::type::Command, type_options);
540-
defs.tooltip = data.take(menu::attr::tooltip, ""s);
541-
defs.data = data.take(menu::attr::data, ""s);
542-
item.alive = !action.empty() && item.type != menu::type::Splitter;
543-
for (auto label : data.list(menu::attr::label))
544-
{
545-
item.views.push_back(
546-
{
547-
.label = label->take_value(),
548-
.tooltip = label->take(menu::attr::tooltip, defs.tooltip),
549-
.data = label->take(menu::attr::data, defs.data),
550-
});
551-
}
552-
if (item.views.empty()) continue; // Menu item without label.
553-
auto setup = [action](ui::item& boss, menu::item& item)
554-
{
555-
if (item.type == menu::type::Option)
556-
{
557-
boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear)
558-
{
559-
item.taken = (item.taken + 1) % item.views.size();
560-
};
561-
}
562-
auto iter = proc_map.find(action);
563-
if (iter != proc_map.end())
564-
{
565-
auto& initproc = iter->second;
566-
initproc(boss, item);
567-
}
568-
};
569-
list.push_back({ item, setup });
570-
}
571523
config.cd("/config/terminal", "/config/defapp");
572-
return menu::create(config, list);
524+
return menu::load(config, proc_map);
573525
}
574526
}
575527

@@ -853,7 +805,7 @@ namespace netxs::app::terminal
853805
{
854806
if (cwd_sync)
855807
{
856-
boss.expire(tier::preview, true);
808+
boss.bell::expire(tier::preview, true);
857809
cwd_path = path;
858810
}
859811
};

0 commit comments

Comments
 (0)