Skip to content

Commit

Permalink
directvt#86 WIP: Replace RunApplication with RunScript (breaking chan…
Browse files Browse the repository at this point in the history
…ges); Fix typo in TileRunApplication/toin
  • Loading branch information
o-sdn-o committed Dec 21, 2024
1 parent 332ad1d commit 8b1e8ad
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 41 deletions.
4 changes: 2 additions & 2 deletions doc/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ Tiling Window Manager is a window container that organizes the workspace into mu
<menu item*>
<autohide=menu/autohide/>
<slim=menu/slim/>
<item action=TileRunApplicatoin label=" + ">
<item action=TileRunApplication label=" + ">
<tooltip>
" Launch application instances in active empty slots. \n"
" The app to run can be set by RightClick on the taskbar. "
Expand All @@ -467,7 +467,7 @@ Tiling Window Manager is a window container that organizes the workspace into mu
<key="Ctrl+PageDown" action=TileFocusNext /> <!-- Focus the next pane or the split grip. -->
<key="" action=TileFocusPrevPane /> <!-- Focus the previous pane. -->
<key="" action=TileFocusNextPane /> <!-- Focus the next pane. -->
<key="Alt+Shift+N" action=TileRunApplicatoin /> <!-- Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar. -->
<key="Alt+Shift+N" action=TileRunApplication /> <!-- Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar. -->
<key="Alt+Shift+A" action=TileSelectAllPanes /> <!-- Select all panes. -->
<key="Alt+Shift+'|'" action=TileSplitHorizontally /> <!-- Split active panes horizontally. -->
<key="Alt+Shift+Minus" action=TileSplitVertically /> <!-- Split active panes vertically. -->
Expand Down
25 changes: 12 additions & 13 deletions doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ Action | Arguments (`data=`)
`ToggleDebugOverlay` | | TUI matrix | Toggle debug overlay.
`FocusNextWindow` | `on` \| `off` | Desktop | Switch focus to the next desktop window. The data parameter specifies the direction of focus switching: prev ("off"), next ("on").
`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.
Expand Down Expand Up @@ -849,7 +848,7 @@ Notes
<menu item*>
<autohide=menu/autohide/>
<slim=menu/slim/>
<item action=TileRunApplicatoin label=" + ">
<item action=TileRunApplication label=" + ">
<tooltip>
" Launch application instances in active empty slots. \n"
" The app to run can be set by RightClick on the taskbar. "
Expand Down Expand Up @@ -904,16 +903,16 @@ Notes
<key="Space-Backspace | Backspace-Space" action=ToggleDebugOverlay/> <!-- Toggle debug overlay. -->
</tui>
<desktop key*> <!-- Desktop layer key bindings. -->
<key="Ctrl+PageUp"> <action=FocusNextWindow data=0/></key> <!-- Switch focus to the previous desktop window. -->
<key="Ctrl+PageDown"><action=FocusNextWindow data=1/></key> <!-- Switch focus to the next desktop window. -->
<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 window flag. -->
<key="" action=CloseWindow/> <!-- Close window. -->
<key="" action=MinimizeWindow/> <!-- Minimize window. -->
<key="Esc+F11" action=MaximizeWindow/> <!-- Maximize window. -->
<key="Esc+F12" action=FullscreenWindow/> <!-- Maximize window to full screen. -->
<key="Ctrl+PageUp"> <action=FocusNextWindow data=0/></key> <!-- Switch focus to the previous desktop window. -->
<key="Ctrl+PageDown"><action=FocusNextWindow data=1/></key> <!-- Switch focus to the next desktop window. -->
<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=RunScript data="vtm.run()"/></key> <!-- Run default application. -->
<key="" action=AlwaysOnTopWindow/> <!-- Toggle AlwaysOnTop window flag. -->
<key="" action=CloseWindow/> <!-- Close window. -->
<key="" action=MinimizeWindow/> <!-- Minimize window. -->
<key="Esc+F11" action=MaximizeWindow/> <!-- Maximize window. -->
<key="Esc+F12" action=FullscreenWindow/> <!-- Maximize window to full screen. -->
<key="Esc+F1"> <action=RunScript data="vtm.run(title='Info-page' hidden=true label=Info type=info)"/></key> <!-- Run Info-page. -->

<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. -->
Expand All @@ -936,7 +935,7 @@ Notes
<key="Ctrl+PageDown" action=TileFocusNext /> <!-- Focus the next pane or the split grip. -->
<key="" action=TileFocusPrevPane /> <!-- Focus the previous pane. -->
<key="" action=TileFocusNextPane /> <!-- Focus the next pane. -->
<key="Alt+Shift+N" action=TileRunApplicatoin /> <!-- Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar. -->
<key="Alt+Shift+N" action=TileRunApplication /> <!-- Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar. -->
<key="Alt+Shift+A" action=TileSelectAllPanes /> <!-- Select all panes. -->
<key="Alt+Shift+'|'" action=TileSplitHorizontally /> <!-- Split active panes horizontally. -->
<key="Alt+Shift+Minus" action=TileSplitVertically /> <!-- Split active panes vertically. -->
Expand Down
6 changes: 3 additions & 3 deletions src/netxs/apps/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace netxs::app::tile
X(TileFocusNextPane ) \
X(TileFocusPrevGrip ) \
X(TileFocusNextGrip ) \
X(TileRunApplicatoin ) \
X(TileRunApplication ) \
X(TileSelectAllPanes ) \
X(TileSplitHorizontally ) \
X(TileSplitVertically ) \
Expand Down Expand Up @@ -908,7 +908,7 @@ namespace netxs::app::tile
keybd.proc(action::TileFocusNextPane , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::focus::nextpane, gear); });
keybd.proc(action::TileFocusPrevGrip , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::focus::prevgrip, gear); });
keybd.proc(action::TileFocusNextGrip , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::focus::nextgrip, gear); });
keybd.proc(action::TileRunApplicatoin , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::create, gear); });
keybd.proc(action::TileRunApplication , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::create, gear); });
keybd.proc(action::TileSelectAllPanes , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::select, gear); });
keybd.proc(action::TileSplitHorizontally , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::split::hz, gear); });
keybd.proc(action::TileSplitVertically , [&](hids& gear){ boss.bell::signal(tier::preview, app::tile::events::ui::split::vt, gear); });
Expand Down Expand Up @@ -1359,7 +1359,7 @@ namespace netxs::app::tile
{ tile::action::TileFocusNextPane , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::focus::nextpane); }},
{ tile::action::TileFocusPrevGrip , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::focus::prevgrip); }},
{ tile::action::TileFocusNextGrip , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::focus::nextgrip); }},
{ tile::action::TileRunApplicatoin , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::create ); }},
{ tile::action::TileRunApplication , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::create ); }},
{ tile::action::TileSelectAllPanes , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::select ); }},
{ tile::action::TileSplitHorizontally , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::split::hz ); }},
{ tile::action::TileSplitVertically , [](auto& boss, auto& /*item*/){ on_left_click(boss, app::tile::events::ui::split::vt ); }},
Expand Down
35 changes: 24 additions & 11 deletions src/vtm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@ namespace netxs::app::vtm
local = faux;
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("FocusNextWindow", [&](hids& gear){ base::riseup(tier::preview, e2::form::proceed::action::nextwindow , gear); });
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); });
Expand Down Expand Up @@ -1706,24 +1705,38 @@ namespace netxs::app::vtm
}
auto vtm_run(eccc& script, qiew args)
{
auto appconf = xml::settings{ "<item " + text{ args } + " />" };
appconf.cd("item");
auto itemptr = appconf.homelist.front();
auto appspec = desk::spec{ .hidden = true,
.winform = shared::win::state::normal,
.type = app::vtty::id,
.gearid = script.hid };
auto menuid = itemptr->take(attr::id, ""s);
if (dbase.menu.contains(menuid))
utf::trim(args);
if (!args) // Get default app spec.
{
auto& appbase = dbase.menu[menuid];
if (appbase.fixed) hall::loadspec(appspec, appbase, *itemptr, menuid);
else hall::loadspec(appspec, appspec, *itemptr, menuid);
if (auto gear_ptr = bell::getref<hids>(appspec.gearid))
{
auto menuid = gear_ptr->owner.bell::signal(tier::request, e2::data::changed);
appspec = dbase.menu[menuid];
appspec.fixed = faux;
appspec.menuid = menuid;
}
}
else
{
if (menuid.empty()) menuid = "vtm.run(" + text{ args } + ")";
hall::loadspec(appspec, appspec, *itemptr, menuid);
auto appconf = xml::settings{ "<item " + text{ args } + " />" };
appconf.cd("item");
auto itemptr = appconf.homelist.front();
auto menuid = itemptr->take(attr::id, ""s);
if (dbase.menu.contains(menuid))
{
auto& appbase = dbase.menu[menuid];
if (appbase.fixed) hall::loadspec(appspec, appbase, *itemptr, menuid);
else hall::loadspec(appspec, appspec, *itemptr, menuid);
}
else
{
if (menuid.empty()) menuid = "vtm.run(" + text{ args } + ")";
hall::loadspec(appspec, appspec, *itemptr, menuid);
}
}
appspec.appcfg.env += script.env;
if (appspec.appcfg.cwd.empty()) appspec.appcfg.cwd = script.cwd;
Expand Down
24 changes: 12 additions & 12 deletions src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ R"==(
<menu item*>
<autohide=menu/autohide/>
<slim=menu/slim/>
<item action=TileRunApplicatoin label=" + ">
<item action=TileRunApplication label=" + ">
<tooltip>
" Launch application instances in active empty slots. \n"
" The app to run can be set by RightClick on the taskbar. "
Expand Down Expand Up @@ -449,16 +449,16 @@ R"==(
<key="Space-Backspace | Backspace-Space" action=ToggleDebugOverlay/> <!-- Toggle debug overlay. -->
</tui>
<desktop key*> <!-- Desktop layer key bindings. -->
<key="Ctrl+PageUp"> <action=FocusNextWindow data=0/></key> <!-- Switch focus to the previous desktop window. -->
<key="Ctrl+PageDown"><action=FocusNextWindow data=1/></key> <!-- Switch focus to the next desktop window. -->
<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 window flag. -->
<key="" action=CloseWindow/> <!-- Close window. -->
<key="" action=MinimizeWindow/> <!-- Minimize window. -->
<key="Esc+F11" action=MaximizeWindow/> <!-- Maximize window. -->
<key="Esc+F12" action=FullscreenWindow/> <!-- Maximize window to full screen. -->
<key="Ctrl+PageUp"> <action=FocusNextWindow data=0/></key> <!-- Switch focus to the previous desktop window. -->
<key="Ctrl+PageDown"><action=FocusNextWindow data=1/></key> <!-- Switch focus to the next desktop window. -->
<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=RunScript data="vtm.run()"/></key> <!-- Run default application. -->
<key="" action=AlwaysOnTopWindow/> <!-- Toggle AlwaysOnTop window flag. -->
<key="" action=CloseWindow/> <!-- Close window. -->
<key="" action=MinimizeWindow/> <!-- Minimize window. -->
<key="Esc+F11" action=MaximizeWindow/> <!-- Maximize window. -->
<key="Esc+F12" action=FullscreenWindow/> <!-- Maximize window to full screen. -->
<key="Esc+F1"> <action=RunScript data="vtm.run(title='Info-page' hidden=true label=Info type=info)"/></key> <!-- Run Info-page. -->

<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. -->
Expand All @@ -482,7 +482,7 @@ R"==(
<key="Ctrl+PageDown" action=TileFocusNext /> <!-- Focus the next pane or the split grip. -->
<key="" action=TileFocusPrevPane /> <!-- Focus the previous pane. -->
<key="" action=TileFocusNextPane /> <!-- Focus the next pane. -->
<key="Alt+Shift+N" action=TileRunApplicatoin /> <!-- Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar. -->
<key="Alt+Shift+N" action=TileRunApplication /> <!-- Launch application instances in active empty slots. The app to run can be set by RightClick on the taskbar. -->
<key="Alt+Shift+A" action=TileSelectAllPanes /> <!-- Select all panes. -->
<key="Alt+Shift+'|'" action=TileSplitHorizontally /> <!-- Split active panes horizontally. -->
<key="Alt+Shift+Minus" action=TileSplitVertically /> <!-- Split active panes vertically. -->
Expand Down

0 comments on commit 8b1e8ad

Please sign in to comment.