From 85d7efb47f46eb372606b13528b075ba34552629 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 27 Sep 2026 17:54:47 +0500 Subject: [PATCH 01/10] #954 WIP: Allow custom WM_CLASS instance via --name --- doc/command-line-options.md | 7 ++++--- src/netxs/desktopio/x11.hpp | 3 ++- src/vtm.cpp | 21 +++++++++++++++------ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/doc/command-line-options.md b/doc/command-line-options.md index f98c5930b7..8f97aafc73 100644 --- a/doc/command-line-options.md +++ b/doc/command-line-options.md @@ -25,11 +25,12 @@ Option | Description `-i`, `--install` | Perform system-wide installation. Allow Desktop Server to run in user context in Session 0 on Windows.
Placing Desktop Server in Session 0 allows console applications to run independently of the user's GUI login session. Note: This prevents GUI applications from running from the vtm desktop environment. See "Session 0 Isolation" on the Web for details.
Elevated privileges required. `-u`, `--uninstall` | Perform system-wide deinstallation.
Elevated privileges required. `-0`, `--session0` | Use Session 0 to run Desktop Server in background. For Windows only. +`-name`, `--name `| Specify a custom WM_CLASS instance name. For X11/Xwayland only. `-a`, `--mouse [mode]` | Set/reset persistent access to mouse devices for all users on Linux platform (excluding Android).
Run `sudo vtm --mouse 0` to reset access.
Elevated privileges required. `-q`, `--quiet` | Disable logging. -`-x`, `--script ` | Specifies script commands to be run by the desktop when ready. -`-c`, `--config ` | Specifies a settings file to load or plain xml-data to merge. -`-p`, `--pin ` | Specifies the desktop id it will be pinned to. +`-x`, `--script ` | Specify script commands to be run by the desktop when ready. +`-c`, `--config ` | Specify a settings file to load or plain xml-data to merge. +`-p`, `--pin ` | Specify the desktop id it will be pinned to. `-s`, `--server` | Run Desktop Server. `-d`, `--daemon` | Run Desktop Server in background. `-m`, `--monitor` | Run Log Monitor. diff --git a/src/netxs/desktopio/x11.hpp b/src/netxs/desktopio/x11.hpp index 3886fb57fe..e2fe27a99e 100644 --- a/src/netxs/desktopio/x11.hpp +++ b/src/netxs/desktopio/x11.hpp @@ -6,6 +6,7 @@ namespace netxs::x11 { static constexpr auto recv_packet_size = 32; + static auto wm_inst_name = "vtm"s; //todo unify (app::vtm::id) using fd_t = os::fd_t; @@ -2496,7 +2497,7 @@ namespace netxs::x11 .window_id = new_window_id }); if (override_redirect == 0) // Wm master layer only. { - auto wm_class_data = "vtm\0vtm\0"sv; // "instance_name\0class_name\0". Bind to the taskbar icon in .desktop-file: StartupWMClass=vtm. + auto wm_class_data = x11::wm_inst_name +"\0vtm\0"s; // "instance_name\0class_name\0". Bind to the taskbar icon in .desktop-file: StartupWMClass=vtm. sendrq({ .window_id = new_window_id, .property = atom_wm_class, .type = atom_string, diff --git a/src/vtm.cpp b/src/vtm.cpp index 6b72bc5858..1aba617924 100644 --- a/src/vtm.cpp +++ b/src/vtm.cpp @@ -142,6 +142,12 @@ int main(int argc, char* argv[]) return ok; } #endif + #if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) + else if (getopt.match("-name", "--name")) + { + x11::wm_inst_name = xml::take_or(getopt.next(), ""s); + } + #endif else if (getopt.match("-?", "-h", "--help")) { os::dtvt::initialize(); @@ -173,21 +179,24 @@ int main(int argc, char* argv[]) "\n -t, --tui Force TUI mode." "\n -g, --gui Force GUI mode." "\n -i, --install Perform system-wide installation." - #if defined(_WIN32) - " Allow Desktop Server to run in Session 0." - #endif + #if defined(_WIN32) + " Allow Desktop Server to run in Session 0." + #endif "\n -u, --uninstall Perform system-wide deinstallation." #if defined(_WIN32) "\n -0, --session0 Use Session 0 to run Desktop Server in background." #endif + #if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) + "\n -name, --name Specify a custom WM_CLASS instance name." + #endif #if defined(__linux__) && !defined(__ANDROID__) "\n -a, --mouse [mode] Set/reset persistent access to mouse devices for all users." "\n Run 'sudo vtm --mouse 0' to reset access." #endif "\n -q, --quiet Disable logging." - "\n -x, --script Specifies script commands." - "\n -c, --config Specifies a settings file to load or plain xml-data to overlay." - "\n -p, --pin Specifies the desktop id it will be pinned to." + "\n -x, --script Specify script commands." + "\n -c, --config Specify a settings file to load or plain xml-data to overlay." + "\n -p, --pin Specify the desktop id it will be pinned to." "\n -s, --server Run Desktop Server." "\n -d, --daemon Run Desktop Server in background." "\n -m, --monitor Run Log Monitor." From 4d7da483910af3393e008462b902e6158520111e Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 27 Sep 2026 18:10:25 +0500 Subject: [PATCH 02/10] Revise help message wording --- doc/build.md | 4 ++-- doc/command-line-options.md | 22 +++++++++++----------- src/vtm.cpp | 24 ++++++++++++------------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/build.md b/doc/build.md index f31b759c21..00a69799fd 100644 --- a/doc/build.md +++ b/doc/build.md @@ -64,7 +64,7 @@ To reset permanent access, use the command: sudo vtm --mouse 0 ``` -#### Deinstallation +#### Uninstallation ```bash # Reset permanent access for pointing devices if it was set @@ -99,7 +99,7 @@ If you prefer to perform a system-wide installation to the default path `/usr/lo ```bash sudo ./vtm --install ``` -- Deinstallation: +- Uninstallation: ```bash sudo vtm --uninstall ``` diff --git a/doc/command-line-options.md b/doc/command-line-options.md index 8f97aafc73..b06bf64940 100644 --- a/doc/command-line-options.md +++ b/doc/command-line-options.md @@ -23,22 +23,22 @@ Option | Description `-t`, `--tui` | Force TUI mode. `-g`, `--gui` | Force GUI mode. `-i`, `--install` | Perform system-wide installation. Allow Desktop Server to run in user context in Session 0 on Windows.
Placing Desktop Server in Session 0 allows console applications to run independently of the user's GUI login session. Note: This prevents GUI applications from running from the vtm desktop environment. See "Session 0 Isolation" on the Web for details.
Elevated privileges required. -`-u`, `--uninstall` | Perform system-wide deinstallation.
Elevated privileges required. +`-u`, `--uninstall` | Perform system-wide uninstallation.
Elevated privileges required. `-0`, `--session0` | Use Session 0 to run Desktop Server in background. For Windows only. `-name`, `--name `| Specify a custom WM_CLASS instance name. For X11/Xwayland only. `-a`, `--mouse [mode]` | Set/reset persistent access to mouse devices for all users on Linux platform (excluding Android).
Run `sudo vtm --mouse 0` to reset access.
Elevated privileges required. `-q`, `--quiet` | Disable logging. `-x`, `--script ` | Specify script commands to be run by the desktop when ready. `-c`, `--config ` | Specify a settings file to load or plain xml-data to merge. -`-p`, `--pin ` | Specify the desktop id it will be pinned to. +`-p`, `--pin ` | Specify the desktop id to pin to. `-s`, `--server` | Run Desktop Server. `-d`, `--daemon` | Run Desktop Server in background. `-m`, `--monitor` | Run Log Monitor. -`-r`, `--`, `--run` | Run desktop applet standalone. -`` | Desktop applet to run. -`` | Desktop applet arguments. -`--env ` | Set environment variable. -`--cwd ` | Set current working directory. +`-r`, `--`, `--run` | Run a desktop applet standalone. +`` | Desktop applet type to run. +`` | Arguments for the desktop applet. +`--env ` | Set the environment variable. +`--cwd ` | Set the current working directory. `--fonts [v[erbose]]` | Print available fonts (with horizontal scrolling). #### Inline configuration @@ -70,12 +70,12 @@ To reset permanent access, use the command: Applet | Type | Arguments ---------------------------|------|------------------------------------------ -Teletype Console (default) | vtty | CUI application with arguments to run -Terminal Console | term | CUI application with arguments to run -DirectVT Gateway | dtvt | DirectVT-aware application to run +Teletype Console (default) | vtty | CUI application to run, along with its arguments +Terminal Console | term | CUI application to run, along with its arguments +DirectVT Gateway | dtvt | DirectVT-capable application to run DirectVT Gateway with TTY | dtty | CUI application to run, forwarding DirectVT I/O -The following commands have a short form: +The following commands support short forms: - `vtm -r vtty ` can be shortened to `vtm `. - `vtm -r dtty ssh ` can be shortened to `vtm ssh `. diff --git a/src/vtm.cpp b/src/vtm.cpp index 1aba617924..268ae2219f 100644 --- a/src/vtm.cpp +++ b/src/vtm.cpp @@ -182,7 +182,7 @@ int main(int argc, char* argv[]) #if defined(_WIN32) " Allow Desktop Server to run in Session 0." #endif - "\n -u, --uninstall Perform system-wide deinstallation." + "\n -u, --uninstall Perform system-wide uninstallation." #if defined(_WIN32) "\n -0, --session0 Use Session 0 to run Desktop Server in background." #endif @@ -196,25 +196,25 @@ int main(int argc, char* argv[]) "\n -q, --quiet Disable logging." "\n -x, --script Specify script commands." "\n -c, --config Specify a settings file to load or plain xml-data to overlay." - "\n -p, --pin Specify the desktop id it will be pinned to." + "\n -p, --pin Specify the desktop id to pin to." "\n -s, --server Run Desktop Server." "\n -d, --daemon Run Desktop Server in background." "\n -m, --monitor Run Log Monitor." - "\n -r, --, --run Run desktop applet standalone." - "\n Desktop applet to run." - "\n Desktop applet arguments." - "\n --env Set environment variable." - "\n --cwd Set current working directory." + "\n -r, --, --run Run a desktop applet standalone." + "\n Desktop applet type to run." + "\n Arguments for the desktop applet." + "\n --env Set the environment variable." + "\n --cwd Set the current working directory." "\n --fonts [v[erbose]] Print available fonts (with horizontal scrolling)." "\n" "\n Desktop applet │ Type │ Arguments" "\n ───────────────────────────┼──────┼─────────────────────────────────────────────────" - "\n Teletype Console (default) │ vtty │ CUI application with arguments to run." - "\n Terminal Console │ term │ CUI application with arguments to run." - "\n DirectVT Gateway │ dtvt │ DirectVT-aware application to run." + "\n Teletype Console (default) │ vtty │ CUI application to run, along with its arguments." + "\n Terminal Console │ term │ CUI application to run, along with its arguments." + "\n DirectVT Gateway │ dtvt │ DirectVT-capable application to run." "\n DirectVT Gateway with TTY │ dtty │ CUI application to run, forwarding DirectVT I/O." "\n" - "\n The following commands have a short form:" + "\n The following commands support short forms:" "\n" "\n 'vtm -r vtty ' can be shortened to 'vtm '." "\n 'vtm -r dtty ssh ' can be shortened to 'vtm ssh '." @@ -223,7 +223,7 @@ int main(int argc, char* argv[]) "\n as well as in the $VTM_CONFIG environment variable:" "\n" "\n vtm -c \"\" -r term" - "\n or (using compact syntax)" + "\n or using the compact syntax:" "\n vtm -c \"\" -r term" "\n"); return 0; From dc81ee9c3b6ee41e64ede6a60f082771990b3dca Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 27 Sep 2026 18:18:24 +0500 Subject: [PATCH 03/10] Revise help message wording --- doc/command-line-options.md | 12 ++++++------ src/vtm.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/command-line-options.md b/doc/command-line-options.md index b06bf64940..93206c62c4 100644 --- a/doc/command-line-options.md +++ b/doc/command-line-options.md @@ -24,31 +24,31 @@ Option | Description `-g`, `--gui` | Force GUI mode. `-i`, `--install` | Perform system-wide installation. Allow Desktop Server to run in user context in Session 0 on Windows.
Placing Desktop Server in Session 0 allows console applications to run independently of the user's GUI login session. Note: This prevents GUI applications from running from the vtm desktop environment. See "Session 0 Isolation" on the Web for details.
Elevated privileges required. `-u`, `--uninstall` | Perform system-wide uninstallation.
Elevated privileges required. -`-0`, `--session0` | Use Session 0 to run Desktop Server in background. For Windows only. +`-0`, `--session0` | Use Session 0 to run Desktop Server in the background. For Windows only. `-name`, `--name `| Specify a custom WM_CLASS instance name. For X11/Xwayland only. `-a`, `--mouse [mode]` | Set/reset persistent access to mouse devices for all users on Linux platform (excluding Android).
Run `sudo vtm --mouse 0` to reset access.
Elevated privileges required. `-q`, `--quiet` | Disable logging. `-x`, `--script ` | Specify script commands to be run by the desktop when ready. -`-c`, `--config ` | Specify a settings file to load or plain xml-data to merge. +`-c`, `--config ` | Specify a settings file to load or plain XML data to merge. `-p`, `--pin ` | Specify the desktop id to pin to. `-s`, `--server` | Run Desktop Server. -`-d`, `--daemon` | Run Desktop Server in background. +`-d`, `--daemon` | Run Desktop Server in the background. `-m`, `--monitor` | Run Log Monitor. `-r`, `--`, `--run` | Run a desktop applet standalone. `` | Desktop applet type to run. `` | Arguments for the desktop applet. -`--env ` | Set the environment variable. +`--env ` | Set an environment variable. `--cwd ` | Set the current working directory. `--fonts [v[erbose]]` | Print available fonts (with horizontal scrolling). #### Inline configuration -The plain xml-data could be specified in place of `` in `--config ` option: +The plain XML data could be specified in place of `` in `--config ` option: - `command-line`: ```cmd vtm -c "" -r term ``` - or (using compact syntax) + or using the compact syntax: - `command-line`: ```cmd vtm -c "" -r term diff --git a/src/vtm.cpp b/src/vtm.cpp index 268ae2219f..75cab3571d 100644 --- a/src/vtm.cpp +++ b/src/vtm.cpp @@ -184,7 +184,7 @@ int main(int argc, char* argv[]) #endif "\n -u, --uninstall Perform system-wide uninstallation." #if defined(_WIN32) - "\n -0, --session0 Use Session 0 to run Desktop Server in background." + "\n -0, --session0 Use Session 0 to run Desktop Server in the background." #endif #if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) "\n -name, --name Specify a custom WM_CLASS instance name." @@ -195,15 +195,15 @@ int main(int argc, char* argv[]) #endif "\n -q, --quiet Disable logging." "\n -x, --script Specify script commands." - "\n -c, --config Specify a settings file to load or plain xml-data to overlay." + "\n -c, --config Specify a settings file to load or plain XML data to overlay." "\n -p, --pin Specify the desktop id to pin to." "\n -s, --server Run Desktop Server." - "\n -d, --daemon Run Desktop Server in background." + "\n -d, --daemon Run Desktop Server in the background." "\n -m, --monitor Run Log Monitor." "\n -r, --, --run Run a desktop applet standalone." "\n Desktop applet type to run." "\n Arguments for the desktop applet." - "\n --env Set the environment variable." + "\n --env Set an environment variable." "\n --cwd Set the current working directory." "\n --fonts [v[erbose]] Print available fonts (with horizontal scrolling)." "\n" @@ -219,7 +219,7 @@ int main(int argc, char* argv[]) "\n 'vtm -r vtty ' can be shortened to 'vtm '." "\n 'vtm -r dtty ssh ' can be shortened to 'vtm ssh '." "\n" - "\n Plain xml-data can be specified in place of in the '--config ' option," + "\n Plain XML data can be specified in place of in the '--config ' option," "\n as well as in the $VTM_CONFIG environment variable:" "\n" "\n vtm -c \"\" -r term" From 909c797aada987d6d92c93059abf6744654a857c Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 27 Sep 2026 18:22:37 +0500 Subject: [PATCH 04/10] Revise help message wording --- doc/command-line-options.md | 6 +++--- src/vtm.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/command-line-options.md b/doc/command-line-options.md index 93206c62c4..86b781149d 100644 --- a/doc/command-line-options.md +++ b/doc/command-line-options.md @@ -13,7 +13,7 @@ vtm -i | -u | -a [mode] | -v | -?