github directvt/vtm v2025.10.18

latest releases: v2026.01.16, v2026.01.13, v2026.01.11...
3 months ago

GitHub all current

Changes

  • Make the emulation of tmux-like prefix keys more consistent.

    Keyboard hacking

    It is possible to emulate the tmux-like keyboard prefix approach by using a global variable in the Lua-scripting runtime space. As an example, the following configuration adds the keyboard shortcut Ctrl+B as a toggle for an additional keyboard mode (coupled with a user-defined boolean variable named kbmodifier) that allows windows to be moved directly using the arrow keys:

    • ~/.config/vtm/settings.xml:
      <config>
          <events>
              <desktop>
                  <script="kbmodifier = not kbmodifier; log('kbmodifier=', kbmodifier);" on="Ctrl+B"/> <!-- Emulate tmux-like prefix key. The expression `log('kbmodifier=', kbmodifier);` is for debugging purposes only (the output is visible in the `Log Monitor`). -->
              </desktop>
              <applet> <!-- Key bindings for the application window. -->
                  <KeyFilter="if (not kbmodifier and vtm.gear.Bypass()) then return; end; "/> <!-- `KeyFilter` macro. Do nothing if `kbmodifier` is false. Calling vtm.gear.Bypass() always returns true. -->
                  <script=KeyFilter | MoveAppletLeft         prerun=KeyFilter on="LeftArrow"                                  /> <!-- The ` | ` operator concatenates script fragments/macros. If for some reason the keyboard event is not processed by anyone, it will then return and fire on this object, so the KeyFilter is also reused at the beginning of the `script="..."`. -->
                  <script=KeyFilter | MoveAppletRight        prerun=KeyFilter on="RightArrow"                                 /> <!-- The `prerun` attribute contains a Lua script that will be executed during pre-polling to filter out key events. -->
                  <script=KeyFilter | MoveAppletUp           prerun=KeyFilter on="UpArrow"                                    /> <!-- When kbmodifier is true, you can move windows using the arrow keys. -->
                  <script=KeyFilter | MoveAppletDown         prerun=KeyFilter on="DownArrow"                                  /> <!-- Macros like `MoveApplet...` are defined in the default configuration. You can list them with `vtm -l`. -->
                  <script=KeyFilter | MoveAppletTopLeft      prerun=KeyFilter on="LeftArrow+UpArrow    | UpArrow+LeftArrow"   /> <!-- Simultaneous key presses should also be processed if supported. -->
                  <script=KeyFilter | MoveAppletBottomLeft   prerun=KeyFilter on="LeftArrow+DownArrow  | DownArrow+LeftArrow" /> <!-- It is convenient to specify multiple keyboard shortcuts in one definition separated by `|`. -->
                  <script=KeyFilter | MoveAppletTopRight     prerun=KeyFilter on="RightArrow+UpArrow   | UpArrow+RightArrow"  />
                  <script=KeyFilter | MoveAppletBottomRight  prerun=KeyFilter on="RightArrow+DownArrow | DownArrow+RightArrow"/>
                  <script=KeyFilter | IncreaseAppletWidth    prerun=KeyFilter on="Ctrl+RightArrow"                            />
                  <script=KeyFilter | DecreaseAppletWidth    prerun=KeyFilter on="Ctrl+LeftArrow"                             />
                  <script=KeyFilter | IncreaseAppletHeight   prerun=KeyFilter on="Ctrl+DownArrow"                             />
                  <script=KeyFilter | DecreaseAppletHeight   prerun=KeyFilter on="Ctrl+UpArrow"                               />
                  <script=KeyFilter | FocusPrevWindow        prerun=KeyFilter on="PageUp"                                     />
                  <script=KeyFilter | FocusNextWindow        prerun=KeyFilter on="PageDown"                                   />
              </applet>
          </events>
      </config>

Don't miss a new vtm release

NewReleases is sending notifications on new releases.