Commit Graph

15 Commits

Author SHA1 Message Date
Johannes Altmanninger
746e0d032f rc windowing: allow to configure windowing system and window placement in new/terminal commands
Today I can control "terminal" and "new" by changing the terminal
alias but I always need to choose a concrete implementation, like
"tmux-terminal-horizontal", even when there is otherwise no need to
mention tmux in my config.

Allow to configure windowing system and window placement independently
by introducing dedicated options.

This allows to create mappings that work in any windowing system like

	map global user c   %{:with-option windowing_placement window new<ret>}
	map global user '"' %{:with-option windowing_placement vertical new<ret>}
	map global user '%' %{:with-option windowing_placement horizontal new<ret>}

For windowing systems that don't support all placements, you can wrap
the above in try/catch to fall back on the "window" variant which is
defined for all windowing systems.

When using multiple (nested) windowing systems, you might want to
add mappings like

	map global user t %{:with-option windowing_module tmux new<ret>}
	map global user T %{:with-option windowing_module wayland new<ret>}

---

This changes the default "terminal" alias for some modules. In
particular, instead of delegating to

    iterm-terminal-vertical
    screen-terminal-vertical
    tmux-terminal-horizontal
    wezterm-terminal-vertical

it will now by default delegate to the respective "-window" variant.
We could maintain backwards compatiblity here by setting the
"windowing_placement" option accordingly, but the new behavior seems
more logical?

Also, this removes the "terminal-tab" alias which was only defined
by the kitty module.

We could try to keep the alias approach and implement a "with-alias"
command, however that approach can only capture both dimensions
(windowing system and placement) if we add tons of commands
like "terminal-horizontal" (with implied windowing system) and
"tmux-terminal" (with implied placement).

Side thought: we could also get rid of the "focus" alias and instead
define

    define-command focus %{
        "%opt{windowing_module}-focus"
    }

Closes #3943, #4425
2023-11-13 22:54:49 +01:00
Hampus Fröjdholm
7c54de2334 Match against kitty window id directly when using kitty @ launch
When launch matches using `id` kitty tries to match against tab id
before matching windows. When there are multiple tabs it's likely to
match a tab before matching a window.

Use `window_id` directly to avoid any possiblity of matching tabs.

This is only needed for `kitty @ launch` for other commands there is
no specific `window_id` field.
2023-05-07 17:06:09 +02:00
Johannes Altmanninger
3e9ca0e5c3 rc windowing: use menu behavior for focus
We can complete every possible client argument.
2022-07-21 16:48:44 +02:00
Maxime Coste
7061001728 Add a complete-command command to configure command completion
This makes it possible to change command completion in hooks and
paves the way to more flexibility in how custom commands can be
completed
2022-03-06 10:13:14 +11:00
basbebe
8d5d0d7d90
use kitty launch command, make commands consistent
`new-window` is a legacy command (see https://github.com/kovidgoyal/kitty/issues/2708).
`KITTY_WINDOW_ID` should be set for any kitty window anyways.
2021-03-11 10:36:30 +01:00
Maxime Coste
bdee3abd88 Match on kitty window id when available
This ensures new window are created in the same os window as the
current client instead of the default one.

Closes #4009
2021-03-01 08:47:09 +11:00
Hideaki Kawai
52222a52e4 Support KITTY_LISTEN_ON on kitty-terminal-tab and kitty-focus 2021-01-22 09:19:35 +09:00
Hideaki Kawai
38b914162a
Update rc/windowing/kitty.kak
Co-authored-by: Screwtapello <thristian@gmail.com>
2021-01-22 08:41:41 +09:00
Hideaki Kawai
0917191118 Respect KITTY_LISTEN_ON when launching terminal 2021-01-21 18:58:48 +09:00
SolitudeSF
91914a8501
Fix syntax errors. 2020-07-06 14:55:54 +03:00
Simon Fowler
b875a1802c Implement smarter detection of windowing environments.
This patch centralises the loading of windowing environments, in order
to ensure that by default only a single module is loaded, rather than
the current code which can load multiple potentially incompatible
modules; and in order to provide the user with more control over the
loading of windowing modules.

The patch introduces a new str-list option `windowing_modules` which
defines an ordered list of windowing modules to attempt to load. Modules
are loaded in the order specified in the list until a module loads
without error, at which point the process finishes.

When loaded each windowing module tests the environment to determine
whether it should load (e.g. the tmux module tests to see if it's being
run within a tmux session), and if it determines that it should then it
completes its loading without error. If it doesn't detect an appropriate
environment then it returns an error, and the module loading logic tries
the next module.

The user can override the default `windowing_modules` list to specify
their preferred modules (i.e. they can put kitty ahead of tmux if that's
their preference, or they can leave out the x11 modules alltogether). In
addition, if the `windowing_modules` option is an empty list this
bypasses the environment detection logic completely, and allows the
modules to be loaded manually - this allows a user to replace the
windowing module loading logic with their own manual set up.
2020-07-05 22:48:31 +10:00
Jason Felice
d287251326 Split modules and allow kitty-send-text to take a parameter 2020-04-27 11:58:39 -04:00
Justin Frank
aa6d19bee6 Added modules to extra files 2019-04-08 17:05:55 -07:00
Alex Leferry 2
c7218940cb Make kitty honoring the current working directory
Fixes #2819
2019-03-28 14:29:54 +01:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00