From 54a341e5816f9ed55a415b03ce4a7809898dd081 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 3 Sep 2022 13:37:06 +0200 Subject: [PATCH] config/kitty: update config template and add general.conf --- .config/kitty/general.conf | 6 ++ .config/kitty/kitty.conf | 174 +++++++++++++++++++++++---------- .config/kitty/local.conf | 1 + .config/kitty/pager.conf | 4 +- .config/kitty/scrollback_pager | 2 +- 5 files changed, 134 insertions(+), 53 deletions(-) create mode 100644 .config/kitty/general.conf create mode 120000 .config/kitty/local.conf mode change 100644 => 100755 .config/kitty/scrollback_pager diff --git a/.config/kitty/general.conf b/.config/kitty/general.conf new file mode 100644 index 0000000..6e7dde9 --- /dev/null +++ b/.config/kitty/general.conf @@ -0,0 +1,6 @@ +map ctrl+c copy_or_interrupt + +window_alert_on_bell yes + +include pager.conf +include local.conf diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 07a3c22..8162337 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -47,25 +47,6 @@ #: support, because it will force kitty to always treat the text as #: LTR, which FriBidi expects for terminals. -# adjust_line_height 0 -# adjust_column_width 0 - -#: Change the size of each character cell kitty renders. You can use -#: either numbers, which are interpreted as pixels or percentages -#: (number followed by %), which are interpreted as percentages of the -#: unmodified values. You can use negative pixels or percentages less -#: than 100% to reduce sizes (but this might cause rendering -#: artifacts). - -# adjust_baseline 0 - -#: Adjust the vertical alignment of text (the height in the cell at -#: which text is positioned). You can use either numbers, which are -#: interpreted as pixels or percentages (number followed by %), which -#: are interpreted as the percentage of the line height. A positive -#: value moves the baseline up, and a negative value moves them down. -#: The underline and strikethrough positions are adjusted accordingly. - # symbol_map #: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols @@ -171,6 +152,31 @@ #: font_features UnifontMedium +isol -medi -fina -init +# modify_font + +#: Modify font characteristics such as the position or thickness of +#: the underline and strikethrough. The modifications can have the +#: suffix px for pixels or % for percentage of original value. No +#: suffix means use pts. For example:: + +#: modify_font underline_position -2 +#: modify_font underline_thickness 150% +#: modify_font strikethrough_position 2px + +#: Additionally, you can modify the size of the cell in which each +#: font glyph is rendered and the baseline at which the glyph is +#: placed in the cell. For example:: + +#: modify_font cell_width 80% +#: modify_font cell_height -2px +#: modify_font baseline 3 + +#: Note that modifying the baseline will automatically adjust the +#: underline and strikethrough positions by the same amount. +#: Increasing the baseline raises glyphs inside the cell and +#: decreasing it lowers them. Decreasing the cell size might cause +#: rendering artifacts, so use with care. + # box_drawing_scale 0.001, 1, 1.5, 2 #: The sizes of the lines used for the box drawing Unicode characters. @@ -285,7 +291,7 @@ # wheel_scroll_min_lines 1 #: The minimum number of lines scrolled by the mouse wheel. The scroll -#: multiplier only takes effect after it +#: multiplier wheel_scroll_multiplier only takes effect after it #: reaches this number. Note that this is only used for low precision #: scrolling devices like wheel mice that scroll by very small amounts #: when using the wheel. With a negative number, the minimum number of @@ -863,7 +869,7 @@ #: tab_bar.py in the kitty config directory. For examples of how to #: write such a function, see the functions named draw_tab_with_* in #: kitty's source code: kitty/tab_bar.py. See also -#: this discussion https://github.com/kovidgoyal/kitty/discussions/4447 +#: this discussion #: for examples from kitty users. #: hidden #: The tab bar is hidden. If you use this, you might want to create a mapping @@ -921,11 +927,26 @@ #: title with optional symbols for bell and activity. If you wish to #: include the tab-index as well, use something like: {index}:{title}. #: Useful if you have shortcuts mapped for goto_tab N. If you prefer -#: to see the index as a superscript, use {sup.index}. In addition you -#: can use {layout_name} for the current layout name, {num_windows} -#: for the number of windows in the tab and {num_window_groups} for -#: the number of window groups (not counting overlay windows) in the -#: tab. Note that formatting is done by Python's string formatting +#: to see the index as a superscript, use {sup.index}. All data +#: available is: + +#: title +#: The current tab title. +#: index +#: The tab index useable with goto_tab N goto_tab shortcuts. +#: layout_name +#: The current layout name. +#: num_windows +#: The number of windows in the tab. +#: num_window_groups +#: The number of window groups (not counting overlay windows) in the tab. +#: tab.active_wd +#: The working directory of the currently active window in the tab (expensive, +#: requires syscall). +#: max_title_length +#: The maximum title length available. + +#: Note that formatting is done by Python's string formatting #: machinery, so you can use, for instance, {layout_name[:2].upper()} #: to show only the first two letters of the layout name, upper-cased. #: If you want to style the text, you can use styling directives, for @@ -1144,35 +1165,83 @@ #: background processes still using the terminal can fail silently #: because their stdout/stderr/stdin no longer work. +# remote_control_password + +#: Allow other programs to control kitty using passwords. This option +#: can be specified multiple times to add multiple passwords. If no +#: passwords are present kitty will ask the user for permission if a +#: program tries to use remote control with a password. A password can +#: also *optionally* be associated with a set of allowed remote +#: control actions. For example:: + +#: remote_control_password "my passphrase" get-colors set-colors focus-window focus-tab + +#: Only the specified actions will be allowed when using this +#: password. Glob patterns can be used too, for example:: + +#: remote_control_password "my passphrase" set-tab-* resize-* + +#: To get a list of available actions, run:: + +#: kitty @ --help + +#: A set of actions to be allowed when no password is sent can be +#: specified by using an empty password, for example:: + +#: remote_control_password "" *-colors + +#: Finally, the path to a python module can be specified that provides +#: a function is_cmd_allowed that is used to check every remote +#: control command. See rc_custom_auth +#: +#: for details. For example:: + +#: remote_control_password "my passphrase" my_rc_command_checker.py + +#: Relative paths are resolved from the kitty configuration directory. + # allow_remote_control no #: Allow other programs to control kitty. If you turn this on, other #: programs can control all aspects of kitty, including sending text #: to kitty windows, opening new windows, closing windows, reading the #: content of windows, etc. Note that this even works over SSH -#: connections. You can choose to either allow any program running -#: within kitty to control it with yes, or only allow programs that -#: connect to the socket (specified with the listen_on config option -#: or kitty --listen-on command line option) with the value socket- -#: only. The latter is useful if you want to prevent programs running -#: on a remote computer over SSH from controlling kitty. Reloading the -#: config will not affect this option. +#: connections. The default setting of no prevents any form of remote +#: control. The meaning of the various values are: + +#: password +#: Remote control requests received over both the TTY device and the socket are +#: confirmed based on passwords, see remote_control_password. + +#: socket-only +#: Remote control requests received over a socket are accepted unconditionally. +#: Requests received over the TTY are denied. See listen_on. + +#: socket +#: Remote control requests received over a socket are accepted unconditionally. +#: Requests received over the TTY are confirmed based on password. + +#: no +#: Remote control is completely disabled. + +#: yes +#: Remote control requests are always accepted. # listen_on none #: Listen to the specified UNIX socket for remote control connections. #: Note that this will apply to all kitty instances. It can be -#: overridden by the kitty --listen-on command line option, which -#: supports listening on TCP socket. This option accepts only UNIX +#: overridden by the kitty --listen-on command line option, which also +#: supports listening on a TCP socket. This option accepts only UNIX #: sockets, such as unix:${TEMP}/mykitty or unix:@mykitty (on Linux). #: Environment variables are expanded and relative paths are resolved #: with respect to the temporary directory. If {kitty_pid} is present, #: then it is replaced by the PID of the kitty process, otherwise the #: PID of the kitty process is appended to the value, with a hyphen. -#: This option is ignored unless you also set allow_remote_control to -#: enable remote control. See the help for kitty --listen-on for more -#: details. Changing this option by reloading the config is not -#: supported. +#: See the help for kitty --listen-on for more details. Note that this +#: will be ignored unless allow_remote_control is set to either: yes, +#: socket or socket-only. Changing this option by reloading the config +#: is not supported. # env @@ -1230,11 +1299,11 @@ #: Path to a session file to use for all kitty instances. Can be #: overridden by using the kitty --session command line option for #: individual instances. See sessions -#: in the -#: kitty documentation for details. Note that relative paths are -#: interpreted with respect to the kitty config directory. Environment -#: variables in the path are expanded. Changing this option by -#: reloading the config is not supported. +#: in the kitty +#: documentation for details. Note that relative paths are interpreted +#: with respect to the kitty config directory. Environment variables +#: in the path are expanded. Changing this option by reloading the +#: config is not supported. # clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask @@ -1452,10 +1521,10 @@ #: For example: a for the A key, [ for the left square bracket key, #: etc. For functional keys, such as Enter or Escape, the names are #: present at Functional key definitions -#: . For modifier keys, the names are ctrl (control, ⌃), -#: shift (⇧), alt (opt, option, ⌥), super (cmd, command, ⌘). See also: -#: GLFW mods +#: . +#: For modifier keys, the names are ctrl (control, ⌃), shift (⇧), alt +#: (opt, option, ⌥), super (cmd, command, ⌘). See also: GLFW mods +#: #: On Linux you can also use XKB key names to bind keys that are not #: supported by GLFW. See XKB keys @@ -1898,7 +1967,7 @@ #: Similarly, to switch back to the previous layout:: -#: map ctrl+alt+p last_used_layout +#: map ctrl+alt+p last_used_layout #: There is also a toggle_layout action that switches to the named #: layout or back to the previous layout if in the named layout. @@ -2015,6 +2084,10 @@ #: Miscellaneous {{{ +#: Show documentation + +# map kitty_mod+f1 show_kitty_doc overview + #: Toggle fullscreen # map kitty_mod+f11 toggle_fullscreen @@ -2166,5 +2239,4 @@ #: }}} -include pager.conf -include local.conf +include general.conf diff --git a/.config/kitty/local.conf b/.config/kitty/local.conf new file mode 120000 index 0000000..715c5a3 --- /dev/null +++ b/.config/kitty/local.conf @@ -0,0 +1 @@ +local.conf##hostname.elephant \ No newline at end of file diff --git a/.config/kitty/pager.conf b/.config/kitty/pager.conf index 5ca1a83..35a4f11 100644 --- a/.config/kitty/pager.conf +++ b/.config/kitty/pager.conf @@ -1,4 +1,6 @@ # default scrollback pager +#scrollback_pager nvim --noplugin -u NONE -c "silent write! /tmp/kitty_scrollback_buffer | te cat /tmp/kitty_scrollback_buffer - " scrollback_pager ~/.config/kitty/scrollback_pager 'INPUT_LINE_NUMBER' 'CURSOR_LINE' 'CURSOR_COLUMN' # launch action (optional `--stdin-add-formatting`) -map f1 launch --type overlay --stdin-source=@screen_scrollback ~/.config/kitty/scrollback_pager +map f1 show_scrollback +#map f1 launch --type overlay --stdin-source=@screen_scrollback ~/.config/kitty/scrollback_pager diff --git a/.config/kitty/scrollback_pager b/.config/kitty/scrollback_pager old mode 100644 new mode 100755 index 0578fab..0d832d7 --- a/.config/kitty/scrollback_pager +++ b/.config/kitty/scrollback_pager @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # https://github.com/kovidgoyal/kitty/issues/719#issuecomment-952039731 set -eu