Compare commits

..

No commits in common. "master" and "1.25.0" have entirely different histories.

133 changed files with 513 additions and 1013 deletions

View file

@ -1,7 +1,7 @@
# -*- yaml -*- # -*- yaml -*-
steps: steps:
- name: pychecks - name: codespell
when: when:
- event: [manual, pull_request] - event: [manual, pull_request]
- event: [push, tag] - event: [push, tag]
@ -11,15 +11,10 @@ steps:
- apk add openssl - apk add openssl
- apk add python3 - apk add python3
- apk add py3-pip - apk add py3-pip
- python3 -m venv venv - python3 -m venv codespell-venv
- source venv/bin/activate - source codespell-venv/bin/activate
- python -m pip install --upgrade pip
- pip install codespell - pip install codespell
- pip install mypy - codespell -Lser,doas,zar README.md INSTALL.md CHANGELOG.md *.c *.h doc/*.scd
- pip install ruff
- codespell
- mypy
- ruff check
- deactivate - deactivate
- name: subprojects - name: subprojects

View file

@ -1,6 +1,5 @@
# Changelog # Changelog
* [Unreleased](#unreleased)
* [1.25.0](#1-25-0) * [1.25.0](#1-25-0)
* [1.24.0](#1-24-0) * [1.24.0](#1-24-0)
* [1.23.1](#1-23-1) * [1.23.1](#1-23-1)
@ -67,78 +66,6 @@
* [1.2.0](#1-2-0) * [1.2.0](#1-2-0)
## Unreleased
### Added
* `toplevel-tag` option (and `--toplevel-tag` command line options to
`foot` and `footclient`), allowing you to set a custom toplevel
tag. The compositor must implement the new `xdg-toplevel-tag-v1`
Wayland protocol ([#2212][2212]).
* `[colors-dark]` section to `foot.ini`. Replaces `[colors]`.
* `[colors-light]` section to `foot.ini`. Replaces `[colors2]`.
* `XTGETTCAP`: added `query-os-name`, returning the OS foot is
compiled for (e.g. _'Linux'_) ([#2209][2209]).
[2212]: https://codeberg.org/dnkl/foot/issues/2212
[2209]: https://codeberg.org/dnkl/foot/issues/2209
### Changed
* When enabling _"focus mode"_ (private mode 1004), foot now sends a
focus event immediately, to inform the application what the current
state is ([#2202][2202]).
* Scrollback search is now case sensitive when the search string
contains at least one upper case character.
* Mouse tracking in SGR pixel mode no longer emits negative column/row
pixel values ([#2226][2226]).
* Foot now always uses ARGB SHM surfaces. In earlier versions, XRGB
surfaces were used for opaque surfaces. Unfortunately, several
compositors had issues when foot switched between ARGB and XRGB
surfaces (for example when switching color theme, or toggling
fullscreen).
[2202]: https://codeberg.org/dnkl/foot/issues/2202
[2226]: https://codeberg.org/dnkl/foot/issues/2226
### Deprecated
* `[colors]` section in `foot.ini`. Use `[colors-dark]` instead.
* `[colors2]` section in `foot.ini`. Use `[colors-light]` instead.
### Removed
* `cursor.color` config option (deprecated in 1.23.0). Use
`colors-{dark,light}.cursor` instead.
### Fixed
* Search mode: composing keys not ignored.
* Crash when triple-clicking a soft-wrapped line and there is a quote
character in the last column.
* Crash when reverse-scrolling (terminfo capability `rin`) such that
the current viewport ends up outside the scrollback ([#2232][2232]).
* Regression: visual glitches in rare circumstances.
* Key release events for shortcuts being sent to the client
application (kitty keyboard protocol only) ([#2257][2257]).
* Crash when application emits sixel RA with a height of 0, a width >
0, and then starts writing sixel data ([#2267][2267]).
* Crash if shutting down terminal instance while a "pre-apply damage"
thread is running ([#2263][2263]).
[2232]: https://codeberg.org/dnkl/foot/issues/2232
[2257]: https://codeberg.org/dnkl/foot/issues/2257
[2267]: https://codeberg.org/dnkl/foot/issues/2267
[2263]: https://codeberg.org/dnkl/foot/issues/2263
### Security
### Contributors
## 1.25.0 ## 1.25.0
### Added ### Added

View file

@ -53,7 +53,7 @@ decisions when appropriate.
Participants in the foot community are expected to uphold the described Participants in the foot community are expected to uphold the described
standards not only in official community spaces (issue trackers, IRC channels, standards not only in official community spaces (issue trackers, IRC channels,
etc.) but in all public spaces. The Code of Conduct however does acknowledge etc.) but in all public spaces. The Code of Conduct however does acknowledge
that people are fallible and that it is possible to truly correct a past that people are fallible and that it is possible to truely correct a past
pattern of unacceptable behavior. That is to say, the scope of the Code of pattern of unacceptable behavior. That is to say, the scope of the Code of
Conduct does not necessarily extend into the distant past. Conduct does not necessarily extend into the distant past.

View file

@ -641,10 +641,6 @@ All replies are in `tigetstr()` format. That is, given the same
capability name, foot's reply is identical to what `tigetstr()` would capability name, foot's reply is identical to what `tigetstr()` would
have returned. have returned.
In addition to queries for terminfo entries, the `query-os-name` query
will be answered with a response of the form `uname=$(uname -s)`,
where `$(uname -s)` is the name of the OS foot was compiled for.
# Credits # Credits

View file

@ -2,6 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <fenv.h>
#include <errno.h> #include <errno.h>
#define LOG_MODULE "box-drawing" #define LOG_MODULE "box-drawing"

View file

@ -53,14 +53,6 @@ UNITTEST
xassert(c32cmp(U"b", U"a") > 0); xassert(c32cmp(U"b", U"a") > 0);
} }
UNITTEST
{
xassert(c32ncmp(U"foo", U"foot", 3) == 0);
xassert(c32ncmp(U"foot", U"FOOT", 4) > 0);
xassert(c32ncmp(U"a", U"b", 1) < 0);
xassert(c32ncmp(U"bb", U"aa", 2) > 0);
}
UNITTEST UNITTEST
{ {
char32_t copy[16]; char32_t copy[16];
@ -135,20 +127,6 @@ UNITTEST
xassert(c32cmp(dst, U"foobar12345678") == 0); xassert(c32cmp(dst, U"foobar12345678") == 0);
} }
UNITTEST
{
xassert(!isc32upper(U'a'));
xassert(isc32upper(U'A'));
xassert(!isc32upper(U'a'));
}
UNITTEST
{
xassert(hasc32upper(U"abc1A"));
xassert(!hasc32upper(U"abc1_aaa"));
xassert(!hasc32upper(U""));
}
UNITTEST UNITTEST
{ {
char32_t *c = xc32dup(U"foobar"); char32_t *c = xc32dup(U"foobar");

View file

@ -20,10 +20,6 @@ static inline int c32cmp(const char32_t *s1, const char32_t *s2) {
return wcscmp((const wchar_t *)s1, (const wchar_t *)s2); return wcscmp((const wchar_t *)s1, (const wchar_t *)s2);
} }
static inline int c32ncmp(const char32_t *s1, const char32_t *s2, size_t n) {
return wcsncmp((const wchar_t *)s1, (const wchar_t *)s2, n);
}
static inline char32_t *c32ncpy(char32_t *dst, const char32_t *src, size_t n) { static inline char32_t *c32ncpy(char32_t *dst, const char32_t *src, size_t n) {
return (char32_t *)wcsncpy((wchar_t *)dst, (const wchar_t *)src, n); return (char32_t *)wcsncpy((wchar_t *)dst, (const wchar_t *)src, n);
} }
@ -64,10 +60,6 @@ static inline char32_t toc32upper(char32_t c) {
return (char32_t)towupper((wint_t)c); return (char32_t)towupper((wint_t)c);
} }
static inline bool isc32upper(char32_t c32) {
return iswupper((wint_t)c32);
}
static inline bool isc32space(char32_t c32) { static inline bool isc32space(char32_t c32) {
return iswspace((wint_t)c32); return iswspace((wint_t)c32);
} }
@ -80,13 +72,6 @@ static inline bool isc32graph(char32_t c32) {
return iswgraph((wint_t)c32); return iswgraph((wint_t)c32);
} }
static inline bool hasc32upper(const char32_t *s) {
for (int i = 0; s[i] != '\0'; i++) {
if (isc32upper(s[i])) return true;
}
return false;
}
static inline int c32width(char32_t c) { static inline int c32width(char32_t c) {
#if defined(FOOT_GRAPHEME_CLUSTERING) #if defined(FOOT_GRAPHEME_CLUSTERING)
return utf8proc_charwidth((utf8proc_int32_t)c); return utf8proc_charwidth((utf8proc_int32_t)c);

View file

@ -1,13 +1,12 @@
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h>
#include <signal.h>
#include <errno.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
@ -77,7 +76,6 @@ print_usage(const char *prog_name)
" -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n" " -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n"
" -T,--title=TITLE initial window title (foot)\n" " -T,--title=TITLE initial window title (foot)\n"
" -a,--app-id=ID window application ID (foot)\n" " -a,--app-id=ID window application ID (foot)\n"
" --toplevel-tag=TAG set a custom toplevel tag\n"
" -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n" " -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
" -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n" " -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
" -m,--maximized start in maximized mode\n" " -m,--maximized start in maximized mode\n"
@ -139,10 +137,6 @@ send_string_list(int fd, const string_list_t *string_list)
return true; return true;
} }
enum {
TOPLEVEL_TAG_OPTION = CHAR_MAX + 1,
};
int int
main(int argc, char *const *argv) main(int argc, char *const *argv)
{ {
@ -157,7 +151,6 @@ main(int argc, char *const *argv)
{"term", required_argument, NULL, 't'}, {"term", required_argument, NULL, 't'},
{"title", required_argument, NULL, 'T'}, {"title", required_argument, NULL, 'T'},
{"app-id", required_argument, NULL, 'a'}, {"app-id", required_argument, NULL, 'a'},
{"toplevel-tag", required_argument, NULL, TOPLEVEL_TAG_OPTION},
{"window-size-pixels", required_argument, NULL, 'w'}, {"window-size-pixels", required_argument, NULL, 'w'},
{"window-size-chars", required_argument, NULL, 'W'}, {"window-size-chars", required_argument, NULL, 'W'},
{"maximized", no_argument, NULL, 'm'}, {"maximized", no_argument, NULL, 'm'},
@ -227,12 +220,6 @@ main(int argc, char *const *argv)
goto err; goto err;
break; break;
case TOPLEVEL_TAG_OPTION:
snprintf(buf, sizeof(buf), "toplevel-tag=%s", optarg);
if (!push_string(&overrides, buf, &total_len))
goto err;
break;
case 'L': case 'L':
if (!push_string(&overrides, "login-shell=yes", &total_len)) if (!push_string(&overrides, "login-shell=yes", &total_len))
goto err; goto err;

View file

@ -6,7 +6,6 @@ _foot()
local cur prev flags word commands match previous_words i offset local cur prev flags word commands match previous_words i offset
flags=( flags=(
"--app-id" "--app-id"
"--toplevel-tag"
"--check-config" "--check-config"
"--config" "--config"
"--font" "--font"
@ -41,7 +40,7 @@ _foot()
for word in "${previous_words[@]}" ; do for word in "${previous_words[@]}" ; do
match=$(printf "$commands" | grep -Fx "$word" 2>/dev/null) match=$(printf "$commands" | grep -Fx "$word" 2>/dev/null)
if [[ ! -z "$match" ]] ; then if [[ ! -z "$match" ]] ; then
if [[ ${COMP_WORDS[i-1]} =~ ^(--app-id|--toplevel-tag|--config|--font|--log-level|--pty|--term|--title|--window-size-pixels|--window-size-chars|--working-directory)$ ]] ; then if [[ ${COMP_WORDS[i-1]} =~ ^(--app-id|--config|--font|--log-level|--pty|--term|--title|--window-size-pixels|--window-size-chars|--working-directory)$ ]] ; then
(( i++ )) (( i++ ))
continue continue
fi fi
@ -76,7 +75,7 @@ _foot()
COMPREPLY=( $(compgen -W "none error warning info" -- ${cur}) ) ;; COMPREPLY=( $(compgen -W "none error warning info" -- ${cur}) ) ;;
--log-colorize|-l) --log-colorize|-l)
COMPREPLY=( $(compgen -W "never always auto" -- ${cur}) ) ;; COMPREPLY=( $(compgen -W "never always auto" -- ${cur}) ) ;;
--app-id|--toplevel-tag|--help|--override|--pty|--title|--version|--window-size-chars|--window-size-pixels|--check-config|-[ahoTvWwC]) --app-id|--help|--override|--pty|--title|--version|--window-size-chars|--window-size-pixels|--check-config|-[ahoTvWwC])
# Don't autocomplete for these flags # Don't autocomplete for these flags
: ;; : ;;
*) *)

View file

@ -6,7 +6,6 @@ _footclient()
local cur prev flags word commands match previous_words i offset local cur prev flags word commands match previous_words i offset
flags=( flags=(
"--app-id" "--app-id"
"--toplevel-tag"
"--fullscreen" "--fullscreen"
"--help" "--help"
"--hold" "--hold"
@ -36,7 +35,7 @@ _footclient()
for word in "${previous_words[@]}" ; do for word in "${previous_words[@]}" ; do
match=$(printf "$commands" | grep -Fx "$word" 2>/dev/null) match=$(printf "$commands" | grep -Fx "$word" 2>/dev/null)
if [[ ! -z "$match" ]] ; then if [[ ! -z "$match" ]] ; then
if [[ ${COMP_WORDS[i-1]} =~ ^(--app-id|--toplevel-tag|--log-level|--server-socket|--term|--title|--window-size-pixels|--window-size-chars|--working-directory)$ ]] ; then if [[ ${COMP_WORDS[i-1]} =~ ^(--app-id|--log-level|--server-socket|--term|--title|--window-size-pixels|--window-size-chars|--working-directory)$ ]] ; then
(( i++ )) (( i++ ))
continue continue
fi fi
@ -68,7 +67,7 @@ _footclient()
COMPREPLY=( $(compgen -W "none error warning info" -- ${cur}) ) ;; COMPREPLY=( $(compgen -W "none error warning info" -- ${cur}) ) ;;
--log-colorize|-l) --log-colorize|-l)
COMPREPLY=( $(compgen -W "never always auto" -- ${cur}) ) ;; COMPREPLY=( $(compgen -W "never always auto" -- ${cur}) ) ;;
--app-id|--toplevel-tag|--help|--override|--title|--version|--window-size-chars|--window-size-pixels|-[ahoTvWw]) --app-id|--help|--override|--title|--version|--window-size-chars|--window-size-pixels|-[ahoTvWw])
# Don't autocomplete for these flags # Don't autocomplete for these flags
: ;; : ;;
*) *)

View file

@ -6,7 +6,6 @@ complete -c foot -x -s f -l font -a "(fc-list : family | sed 's/,/
complete -c foot -x -s t -l term -a '(find /usr/share/terminfo -type f -printf "%f\n")' -d "value to set the environment variable TERM to (foot)" complete -c foot -x -s t -l term -a '(find /usr/share/terminfo -type f -printf "%f\n")' -d "value to set the environment variable TERM to (foot)"
complete -c foot -x -s T -l title -d "initial window title" complete -c foot -x -s T -l title -d "initial window title"
complete -c foot -x -s a -l app-id -d "value to set the app-id property on the Wayland window to (foot)" complete -c foot -x -s a -l app-id -d "value to set the app-id property on the Wayland window to (foot)"
complete -c foot -x -l toplevel-tag -d "value to set the toplevel-tag property on the Wayland window to"
complete -c foot -s m -l maximized -d "start in maximized mode" complete -c foot -s m -l maximized -d "start in maximized mode"
complete -c foot -s F -l fullscreen -d "start in fullscreen mode" complete -c foot -s F -l fullscreen -d "start in fullscreen mode"
complete -c foot -s L -l login-shell -d "start shell as a login shell" complete -c foot -s L -l login-shell -d "start shell as a login shell"

View file

@ -2,7 +2,6 @@ complete -c footclient -x -a "(__fish_complete_subcom
complete -c footclient -x -s t -l term -a '(find /usr/share/terminfo -type f -printf "%f\n")' -d "value to set the environment variable TERM to (foot)" complete -c footclient -x -s t -l term -a '(find /usr/share/terminfo -type f -printf "%f\n")' -d "value to set the environment variable TERM to (foot)"
complete -c footclient -x -s T -l title -d "initial window title" complete -c footclient -x -s T -l title -d "initial window title"
complete -c footclient -x -s a -l app-id -d "value to set the app-id property on the Wayland window to (foot)" complete -c footclient -x -s a -l app-id -d "value to set the app-id property on the Wayland window to (foot)"
complete -c footclient -x -l toplevel-tag -d "value to set the toplevel-tag property on the Wayland window to"
complete -c footclient -s m -l maximized -d "start in maximized mode" complete -c footclient -s m -l maximized -d "start in maximized mode"
complete -c footclient -s F -l fullscreen -d "start in fullscreen mode" complete -c footclient -s F -l fullscreen -d "start in fullscreen mode"
complete -c footclient -s L -l login-shell -d "start shell as a login shell" complete -c footclient -s L -l login-shell -d "start shell as a login shell"

View file

@ -9,7 +9,6 @@ _arguments \
'(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \ '(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \
'(-T --title)'{-T,--title}'[initial window title]:()' \ '(-T --title)'{-T,--title}'[initial window title]:()' \
'(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \ '(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \
'--toplevel-tag=[value to set the toplevel-tag property on the Wayland window to]:()' \
'(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \ '(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \
'(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \ '(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \
'(-L --login-shell)'{-L,--login-shell}'[start shell as a login shell]' \ '(-L --login-shell)'{-L,--login-shell}'[start shell as a login shell]' \

View file

@ -5,7 +5,6 @@ _arguments \
'(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \ '(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \
'(-T --title)'{-T,--title}'[initial window title]:()' \ '(-T --title)'{-T,--title}'[initial window title]:()' \
'(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \ '(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \
'--toplevel-tag=[value to set the toplevel-tag property on the Wayland window to]:()' \
'(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \ '(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \
'(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \ '(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \
'(-L --login-shell)'{-L,--login-shell}'[start shell as a login shell]' \ '(-L --login-shell)'{-L,--login-shell}'[start shell as a login shell]' \

150
config.c
View file

@ -144,8 +144,6 @@ static const char *const binding_action_map[] = {
[BIND_ACTION_REGEX_COPY] = "regex-copy", [BIND_ACTION_REGEX_COPY] = "regex-copy",
[BIND_ACTION_THEME_SWITCH_1] = "color-theme-switch-1", [BIND_ACTION_THEME_SWITCH_1] = "color-theme-switch-1",
[BIND_ACTION_THEME_SWITCH_2] = "color-theme-switch-2", [BIND_ACTION_THEME_SWITCH_2] = "color-theme-switch-2",
[BIND_ACTION_THEME_SWITCH_DARK] = "color-theme-switch-dark",
[BIND_ACTION_THEME_SWITCH_LIGHT] = "color-theme-switch-light",
[BIND_ACTION_THEME_TOGGLE] = "color-theme-toggle", [BIND_ACTION_THEME_TOGGLE] = "color-theme-toggle",
/* Mouse-specific actions */ /* Mouse-specific actions */
@ -925,9 +923,6 @@ parse_section_main(struct context *ctx)
else if (streq(key, "app-id")) else if (streq(key, "app-id"))
return value_to_str(ctx, &conf->app_id); return value_to_str(ctx, &conf->app_id);
else if (streq(key, "toplevel-tag"))
return value_to_str(ctx, &conf->toplevel_tag);
else if (streq(key, "initial-window-size-pixels")) { else if (streq(key, "initial-window-size-pixels")) {
if (!value_to_dimensions(ctx, &conf->size.width, &conf->size.height)) if (!value_to_dimensions(ctx, &conf->size.width, &conf->size.height))
return false; return false;
@ -1120,40 +1115,8 @@ parse_section_main(struct context *ctx)
sizeof(conf->initial_color_theme) == sizeof(int), sizeof(conf->initial_color_theme) == sizeof(int),
"enum is not 32-bit"); "enum is not 32-bit");
if (!value_to_enum(ctx, (const char*[]){ return value_to_enum(ctx, (const char*[]){"1", "2", NULL},
"dark", "light", "1", "2", NULL}, (int *)&conf->initial_color_theme);
(int *)&conf->initial_color_theme))
return false;
if (streq(ctx->value, "1")) {
LOG_WARN("%s:%d: [main].initial-color-theme=1 deprecated, "
"use [main].initial-color-theme=dark instead",
ctx->path, ctx->lineno);
user_notification_add(
&ctx->conf->notifications,
USER_NOTIFICATION_DEPRECATED,
xstrdup("[main].initial-color-theme=1: "
"use [main].initial-color-theme=dark instead"));
conf->initial_color_theme = COLOR_THEME_DARK;
}
else if (streq(ctx->value, "2")) {
LOG_WARN("%s:%d: [main].initial-color-theme=2 deprecated, "
"use [main].initial-color-theme=light instead",
ctx->path, ctx->lineno);
user_notification_add(
&ctx->conf->notifications,
USER_NOTIFICATION_DEPRECATED,
xstrdup("[main].initial-color-theme=2: "
"use [main].initial-color-theme=light instead"));
conf->initial_color_theme = COLOR_THEME_LIGHT;
}
return true;
} }
else if (streq(key, "uppercase-regex-insert")) else if (streq(key, "uppercase-regex-insert"))
@ -1589,44 +1552,16 @@ parse_color_theme(struct context *ctx, struct color_theme *theme)
return true; return true;
} }
static bool
parse_section_colors_dark(struct context *ctx)
{
return parse_color_theme(ctx, &ctx->conf->colors_dark);
}
static bool
parse_section_colors_light(struct context *ctx)
{
return parse_color_theme(ctx, &ctx->conf->colors_light);
}
static bool static bool
parse_section_colors(struct context *ctx) parse_section_colors(struct context *ctx)
{ {
LOG_WARN("%s:%d: [colors]: deprecated; use [colors-dark] instead", return parse_color_theme(ctx, &ctx->conf->colors);
ctx->path, ctx->lineno);
user_notification_add(
&ctx->conf->notifications,
USER_NOTIFICATION_DEPRECATED,
xstrdup("[colors]: use [colors-dark] instead"));
return parse_color_theme(ctx, &ctx->conf->colors_dark);
} }
static bool static bool
parse_section_colors2(struct context *ctx) parse_section_colors2(struct context *ctx)
{ {
LOG_WARN("%s:%d: [colors2]: deprecated; use [colors-light] instead", return parse_color_theme(ctx, &ctx->conf->colors2);
ctx->path, ctx->lineno);
user_notification_add(
&ctx->conf->notifications,
USER_NOTIFICATION_DEPRECATED,
xstrdup("[colors2]: use [colors-light] instead"));
return parse_color_theme(ctx, &ctx->conf->colors_light);
} }
static bool static bool
@ -1661,6 +1596,28 @@ parse_section_cursor(struct context *ctx)
else if (streq(key, "blink-rate")) else if (streq(key, "blink-rate"))
return value_to_uint32(ctx, 10, &conf->cursor.blink.rate_ms); return value_to_uint32(ctx, 10, &conf->cursor.blink.rate_ms);
else if (streq(key, "color")) {
LOG_WARN("%s:%d: cursor.color: deprecated; use colors.cursor instead",
ctx->path, ctx->lineno);
user_notification_add(
&conf->notifications,
USER_NOTIFICATION_DEPRECATED,
xstrdup("cursor.color: use colors.cursor instead"));
if (!value_to_two_colors(
ctx,
&conf->colors.cursor.text,
&conf->colors.cursor.cursor,
false))
{
return false;
}
conf->colors.use_custom.cursor = true;
return true;
}
else if (streq(key, "beam-thickness")) else if (streq(key, "beam-thickness"))
return value_to_pt_or_px(ctx, &conf->cursor.beam_thickness); return value_to_pt_or_px(ctx, &conf->cursor.beam_thickness);
@ -2308,29 +2265,6 @@ parse_key_binding_section(struct context *ctx,
aux.regex_name = regex_name; aux.regex_name = regex_name;
} }
if (action_map == binding_action_map &&
action >= BIND_ACTION_THEME_SWITCH_1 &&
action <= BIND_ACTION_THEME_SWITCH_2)
{
const char *use_instead =
action_map[action == BIND_ACTION_THEME_SWITCH_1
? BIND_ACTION_THEME_SWITCH_DARK
: BIND_ACTION_THEME_SWITCH_LIGHT];
const char *notif = action == BIND_ACTION_THEME_SWITCH_1
? "[key-bindings].color-theme-switch-1: use [key-bindings].color-theme-switch-dark instead"
: "[key-bindings].color-theme-switch-2: use [key-bindings].color-theme-switch-light instead";
LOG_WARN("%s:%d: [key-bindings].%s: deprecated, use %s instead",
ctx->path, ctx->lineno,
action_map[action], use_instead);
user_notification_add(
&ctx->conf->notifications,
USER_NOTIFICATION_DEPRECATED,
xstrdup(notif));
}
if (!value_to_key_combos(ctx, action, &aux, bindings, KEY_BINDING)) { if (!value_to_key_combos(ctx, action, &aux, bindings, KEY_BINDING)) {
free_binding_aux(&aux); free_binding_aux(&aux);
return false; return false;
@ -3021,8 +2955,8 @@ enum section {
SECTION_SCROLLBACK, SECTION_SCROLLBACK,
SECTION_URL, SECTION_URL,
SECTION_REGEX, SECTION_REGEX,
SECTION_COLORS_DARK, SECTION_COLORS,
SECTION_COLORS_LIGHT, SECTION_COLORS2,
SECTION_CURSOR, SECTION_CURSOR,
SECTION_MOUSE, SECTION_MOUSE,
SECTION_CSD, SECTION_CSD,
@ -3034,11 +2968,6 @@ enum section {
SECTION_ENVIRONMENT, SECTION_ENVIRONMENT,
SECTION_TWEAK, SECTION_TWEAK,
SECTION_TOUCH, SECTION_TOUCH,
/* Deprecated */
SECTION_COLORS,
SECTION_COLORS2,
SECTION_COUNT, SECTION_COUNT,
}; };
@ -3057,8 +2986,8 @@ static const struct {
[SECTION_SCROLLBACK] = {&parse_section_scrollback, "scrollback"}, [SECTION_SCROLLBACK] = {&parse_section_scrollback, "scrollback"},
[SECTION_URL] = {&parse_section_url, "url"}, [SECTION_URL] = {&parse_section_url, "url"},
[SECTION_REGEX] = {&parse_section_regex, "regex", true}, [SECTION_REGEX] = {&parse_section_regex, "regex", true},
[SECTION_COLORS_DARK] = {&parse_section_colors_dark, "colors-dark"}, [SECTION_COLORS] = {&parse_section_colors, "colors"},
[SECTION_COLORS_LIGHT] = {&parse_section_colors_light, "colors-light"}, [SECTION_COLORS2] = {&parse_section_colors2, "colors2"},
[SECTION_CURSOR] = {&parse_section_cursor, "cursor"}, [SECTION_CURSOR] = {&parse_section_cursor, "cursor"},
[SECTION_MOUSE] = {&parse_section_mouse, "mouse"}, [SECTION_MOUSE] = {&parse_section_mouse, "mouse"},
[SECTION_CSD] = {&parse_section_csd, "csd"}, [SECTION_CSD] = {&parse_section_csd, "csd"},
@ -3070,10 +2999,6 @@ static const struct {
[SECTION_ENVIRONMENT] = {&parse_section_environment, "environment"}, [SECTION_ENVIRONMENT] = {&parse_section_environment, "environment"},
[SECTION_TWEAK] = {&parse_section_tweak, "tweak"}, [SECTION_TWEAK] = {&parse_section_tweak, "tweak"},
[SECTION_TOUCH] = {&parse_section_touch, "touch"}, [SECTION_TOUCH] = {&parse_section_touch, "touch"},
/* Deprecated */
[SECTION_COLORS] = {&parse_section_colors, "colors"},
[SECTION_COLORS2] = {&parse_section_colors2, "colors2"},
}; };
static_assert(ALEN(section_info) == SECTION_COUNT, "section info array size mismatch"); static_assert(ALEN(section_info) == SECTION_COUNT, "section info array size mismatch");
@ -3446,7 +3371,6 @@ config_load(struct config *conf, const char *conf_path,
.shell = get_shell(), .shell = get_shell(),
.title = xstrdup("foot"), .title = xstrdup("foot"),
.app_id = (as_server ? xstrdup("footclient") : xstrdup("foot")), .app_id = (as_server ? xstrdup("footclient") : xstrdup("foot")),
.toplevel_tag = xstrdup(""),
.word_delimiters = xc32dup(U",│`|:\"'()[]{}<>"), .word_delimiters = xc32dup(U",│`|:\"'()[]{}<>"),
.size = { .size = {
.type = CONF_SIZE_PX, .type = CONF_SIZE_PX,
@ -3507,7 +3431,7 @@ config_load(struct config *conf, const char *conf_path,
}, },
.multiplier = 3., .multiplier = 3.,
}, },
.colors_dark = { .colors = {
.fg = default_foreground, .fg = default_foreground,
.bg = default_background, .bg = default_background,
.flash = 0x7f7f00, .flash = 0x7f7f00,
@ -3527,7 +3451,7 @@ config_load(struct config *conf, const char *conf_path,
.url = false, .url = false,
}, },
}, },
.initial_color_theme = COLOR_THEME_DARK, .initial_color_theme = COLOR_THEME1,
.cursor = { .cursor = {
.style = CURSOR_BLOCK, .style = CURSOR_BLOCK,
.unfocused_style = CURSOR_UNFOCUSED_HOLLOW, .unfocused_style = CURSOR_UNFOCUSED_HOLLOW,
@ -3607,10 +3531,10 @@ config_load(struct config *conf, const char *conf_path,
.notifications = tll_init(), .notifications = tll_init(),
}; };
memcpy(conf->colors_dark.table, default_color_table, sizeof(default_color_table)); memcpy(conf->colors.table, default_color_table, sizeof(default_color_table));
memcpy(conf->colors_dark.sixel, default_sixel_colors, sizeof(default_sixel_colors)); memcpy(conf->colors.sixel, default_sixel_colors, sizeof(default_sixel_colors));
memcpy(&conf->colors_light, &conf->colors_dark, sizeof(conf->colors_dark)); memcpy(&conf->colors2, &conf->colors, sizeof(conf->colors));
conf->colors_light.dim_blend_towards = DIM_BLEND_TOWARDS_WHITE; conf->colors2.dim_blend_towards = DIM_BLEND_TOWARDS_WHITE;
parse_modifiers(XKB_MOD_NAME_SHIFT, 5, &conf->mouse.selection_override_modifiers); parse_modifiers(XKB_MOD_NAME_SHIFT, 5, &conf->mouse.selection_override_modifiers);
@ -3899,7 +3823,6 @@ config_clone(const struct config *old)
conf->shell = xstrdup(old->shell); conf->shell = xstrdup(old->shell);
conf->title = xstrdup(old->title); conf->title = xstrdup(old->title);
conf->app_id = xstrdup(old->app_id); conf->app_id = xstrdup(old->app_id);
conf->toplevel_tag = xstrdup(old->toplevel_tag);
conf->word_delimiters = xc32dup(old->word_delimiters); conf->word_delimiters = xc32dup(old->word_delimiters);
conf->scrollback.indicator.text = xc32dup(old->scrollback.indicator.text); conf->scrollback.indicator.text = xc32dup(old->scrollback.indicator.text);
conf->server_socket_path = xstrdup(old->server_socket_path); conf->server_socket_path = xstrdup(old->server_socket_path);
@ -3999,7 +3922,6 @@ config_free(struct config *conf)
free(conf->shell); free(conf->shell);
free(conf->title); free(conf->title);
free(conf->app_id); free(conf->app_id);
free(conf->toplevel_tag);
free(conf->word_delimiters); free(conf->word_delimiters);
spawn_template_free(&conf->bell.command); spawn_template_free(&conf->bell.command);
free(conf->scrollback.indicator.text); free(conf->scrollback.indicator.text);

View file

@ -195,10 +195,8 @@ struct color_theme {
}; };
enum which_color_theme { enum which_color_theme {
COLOR_THEME_DARK, COLOR_THEME1,
COLOR_THEME_LIGHT, COLOR_THEME2,
COLOR_THEME_1, /* Deprecated */
COLOR_THEME_2, /* Deprecated */
}; };
enum shm_bit_depth { enum shm_bit_depth {
@ -221,7 +219,6 @@ struct config {
char *shell; char *shell;
char *title; char *title;
char *app_id; char *app_id;
char *toplevel_tag;
char32_t *word_delimiters; char32_t *word_delimiters;
bool login_shell; bool login_shell;
bool locked_title; bool locked_title;
@ -329,8 +326,8 @@ struct config {
tll(struct custom_regex) custom_regexes; tll(struct custom_regex) custom_regexes;
struct color_theme colors_dark; struct color_theme colors;
struct color_theme colors_light; struct color_theme colors2;
enum which_color_theme initial_color_theme; enum which_color_theme initial_color_theme;
struct { struct {

18
csi.c
View file

@ -117,9 +117,9 @@ csi_sgr(struct terminal *term)
style > UNDERLINE_SINGLE; style > UNDERLINE_SINGLE;
break; break;
} }
} else
term->bits_affecting_ascii_printer.underline_style = false; term_update_ascii_printer(term);
term_update_ascii_printer(term); }
break; break;
} }
case 5: term->vt.attrs.blink = true; break; case 5: term->vt.attrs.blink = true; break;
@ -422,8 +422,6 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
case 1004: case 1004:
term->focus_events = enable; term->focus_events = enable;
if (enable)
term_to_slave(term, term->kbd_focus ? "\033[I" : "\033[O", 3);
break; break;
case 1005: case 1005:
@ -1578,7 +1576,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
int chars = snprintf( int chars = snprintf(
reply, sizeof(reply), reply, sizeof(reply),
"\033[?997;%dn", "\033[?997;%dn",
term->colors.active_theme == COLOR_THEME_DARK ? 1 : 2); term->colors.active_theme == COLOR_THEME1 ? 1 : 2);
term_to_slave(term, reply, chars); term_to_slave(term, reply, chars);
break; break;
@ -1644,10 +1642,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
* 64 - vt520 * 64 - vt520
* 65 - vt525 * 65 - vt525
* *
* Param 2 - firmware version xterm uses its version * Param 2 - firmware version
* number. We do to, in the format "MAJORMINORPATCH", * xterm uses its version number. We use an xterm
* where all three version numbers are always two * version number too, since e.g. Emacs uses this to
* digits. So e.g. 1.25.0 is reported as 012500. * determine level of support.
* *
* We report ourselves as a VT220. This must be * We report ourselves as a VT220. This must be
* synchronized with the primary DA response. * synchronized with the primary DA response.

View file

@ -67,11 +67,6 @@ the foot command line
Value to set the *app-id* property on the Wayland window Value to set the *app-id* property on the Wayland window
to. Default: _foot_ (normal mode), or _footclient_ (server mode). to. Default: _foot_ (normal mode), or _footclient_ (server mode).
*toplevel-tag*=_TAG_
Value to set the *toplevel-tag* property on the Wayland window
to. The compositor can use this value for session management,
window rules etc. Default: _not set_
*-m*,*--maximized* *-m*,*--maximized*
Start in maximized mode. If both *--maximized* and *--fullscreen* Start in maximized mode. If both *--maximized* and *--fullscreen*
are specified, the _last_ one takes precedence. are specified, the _last_ one takes precedence.
@ -257,6 +252,9 @@ These keyboard shortcuts affect the search selection:
*ctrl*+*shift*+*left* *ctrl*+*shift*+*left*
Extend current selection to the left to the last word boundary. Extend current selection to the left to the last word boundary.
*ctrl*+*shift*+*w*
Extend the current selection to the right to the last whitespace.
*shift*+*down* *shift*+*down*
Extend current selection down one line Extend current selection down one line
@ -695,8 +693,8 @@ variables to unset may be defined in *foot.ini*(5).
The following signals have special meaning in foot: The following signals have special meaning in foot:
- SIGUSR1: switch to the dark color theme (*[colors-dark]*). - SIGUSR1: switch to color theme 1 (i.e. use the *[colors]* section).
- SIGUSR2: switch to the light color theme (*[colors-light]*). - SIGUSR2: switch to color theme 2 (i.e. use the *[colors2]* section).
Note: you can send SIGUSR1/SIGUSR2 to a *foot --server* process too, Note: you can send SIGUSR1/SIGUSR2 to a *foot --server* process too,
in which case all client instances will switch theme. Furthermore, all in which case all client instances will switch theme. Furthermore, all

View file

@ -24,7 +24,7 @@ commented out will usually be installed to */etc/xdg/foot/foot.ini*.
Options are set using KEY=VALUE pairs: Options are set using KEY=VALUE pairs:
*\[colors-dark\]*++ *\[colors\]*++
*background=000000*++ *background=000000*++
*foreground=ffffff* *foreground=ffffff*
@ -371,12 +371,12 @@ empty string to be set, but it must be quoted: *KEY=""*)
Default: _yes_ Default: _yes_
*initial-color-theme* *initial-color-theme*
Selects which color theme to use, *dark*, or *light*. Selects which color theme to use, *1*, or *2*.
*dark* uses the colors defined in the *colors-dark* section, while *1* uses the colors defined in the *colors* section, while *2*
*light* uses the colors from the *colors-light* section. uses the colors from the *colors2* section.
Use the *color-theme-switch-dark*, *color-theme-switch-light* and Use the *color-theme-switch-1*, *color-theme-switch-2* and
*color-theme-toggle* key bindings to switch between the two themes *color-theme-toggle* key bindings to switch between the two themes
at runtime, or send SIGUSR1/SIGUSR2 to the foot process (see at runtime, or send SIGUSR1/SIGUSR2 to the foot process (see
*foot*(1) for details). *foot*(1) for details).
@ -429,11 +429,6 @@ empty string to be set, but it must be quoted: *KEY=""*)
apply window management rules. Default: _foot_ (normal mode), or apply window management rules. Default: _foot_ (normal mode), or
_footclient_ (server mode). _footclient_ (server mode).
*toplevel-tag*
Value to set the *toplevel-tag* property on the Wayland window
to. The compositor can use this value for session management,
window rules etc. Default: _not set_
*bold-text-in-bright* *bold-text-in-bright*
Semi-boolean. When enabled, bold text is rendered in a brighter Semi-boolean. When enabled, bold text is rendered in a brighter
color (in addition to using a bold font). The color is brightened color (in addition to using a bold font). The color is brightened
@ -987,24 +982,19 @@ applications can change these at runtime.
Default: _400_. Default: _400_.
# SECTION: colors-dark, colors-light # SECTION: colors
These two sections controls the 16 ANSI colors, the default foreground This section controls the 16 ANSI colors, the default foreground and
and background colors, and the extended 256 color palette. Note that background colors, and the extended 256 color palette. Note that
applications can change these at runtime. applications can change these at runtime.
The colors are in RRGGBB format (i.e. plain old 6-digit hex values, The colors are in RRGGBB format (i.e. plain old 6-digit hex values,
without prefix). That is, they do *not* have an alpha component. You without prefix). That is, they do *not* have an alpha component. You
can configure the background transparency with the _alpha_ option. can configure the background transparency with the _alpha_ option.
*colors-dark* is intended to define a dark color theme, and In the context of private mode 2031 (Dark and Light Mode detection),
*colors-light* is intended to define a light color theme. You can the primary theme (i.e. the *colors* section) is considered to be the
switch between them using the *color-theme-switch-dark*, dark theme (since the default theme is dark).
*color-theme-switch-light* and *color-theme-toggle* key bindings, or
by sending SIGUSR1/SIGUSR2 to the foot process.
The default theme used is *colors-dark*, unless
*initial-color-theme=light* has been set.
*cursor* *cursor*
Two space separated RRGGBB values (i.e. plain old 6-digit hex Two space separated RRGGBB values (i.e. plain old 6-digit hex
@ -1103,7 +1093,7 @@ The default theme used is *colors-dark*, unless
black makes the text darker, while blending towards white makes it black makes the text darker, while blending towards white makes it
whiter (but still dimmer than normal text). whiter (but still dimmer than normal text).
Default: _black_ (*colors-dark*), _white_ (*colors-light*) Default: _black_ (*colors*), _white_ (*colors2*)
*selection-foreground*, *selection-background* *selection-foreground*, *selection-background*
Foreground (text) and background color to use in selected Foreground (text) and background color to use in selected
@ -1140,6 +1130,20 @@ The default theme used is *colors-dark*, unless
Flash translucency. A value in the range 0.0-1.0, where 0.0 means Flash translucency. A value in the range 0.0-1.0, where 0.0 means
completely transparent, and 1.0 is opaque. Default: _0.5_. completely transparent, and 1.0 is opaque. Default: _0.5_.
# SECTION: colors2
This section defines an alternative color theme. It has the exact same
keys as the *colors* section. The default values are the same, except
for *dim-blend-towards*, which defaults to *white* instead.
Note that values are not inherited. That is, if you set a value in
*colors*, but not in *colors2*, the value from *colors* is not
inherited by *colors2*.
In the context of private mode 2031 (Dark and Light Mode detection),
the alternative theme (i.e. the *colors2* section) is considered to be
the light theme (since the default, the primary theme, is dark).
# SECTION: csd # SECTION: csd
This section controls the look of the _CSDs_ (Client Side This section controls the look of the _CSDs_ (Client Side
@ -1446,16 +1450,16 @@ e.g. *search-start=none*.
Default: _Control+Shift+u_. Default: _Control+Shift+u_.
*color-theme-switch-dark*, *color-theme-switch-dark*, *color-theme-toggle* *color-theme-switch-1*, *color-theme-switch-2*, *color-theme-toggle*
Switch between the dark color theme (defined in the *colors-dark* Switch between the primary color theme (defined in the *colors*
section), and the light color theme (defined in the *colors-light* section), and the alternative color theme (defined in the
section). *colors2* section).
*color-theme-switch-dark* applies the dark color theme regardless *color-theme-switch-1* applies the primary color theme regardless
of which color theme is currently active. of which color theme is currently active.
*color-theme-switch-light* applies the light color theme *color-theme-switch-2* applies the alternative color theme regardless
regardless of which color theme is currently active. of which color theme is currently active.
*color-theme-toggle* toggles between the primary and alternative *color-theme-toggle* toggles between the primary and alternative
color themes. color themes.
@ -2116,7 +2120,7 @@ any of these options.
frame, foot proceeds with rendering the cells that has changed frame, foot proceeds with rendering the cells that has changed
between the last frame and the new frame. between the last frame and the new frame.
When this option is enabled, the changes between the last two frames When this open is enabled, the changes between the last two frames
are brought over to what will become the next frame before foot are brought over to what will become the next frame before foot
starts rendering the next frame. As soon as the compositor starts rendering the next frame. As soon as the compositor
releases the previous buffer (typically right after foot has releases the previous buffer (typically right after foot has

View file

@ -33,11 +33,6 @@ terminal has terminated.
Value to set the *app-id* property on the Wayland window Value to set the *app-id* property on the Wayland window
to. Default: _foot_ (normal mode), or _footclient_ (server mode). to. Default: _foot_ (normal mode), or _footclient_ (server mode).
*toplevel-tag*=_TAG_
Value to set the *toplevel-tag* property on the Wayland window
to. The compositor can use this value for session management,
window rules etc. Default: _not set_
*-w*,*--window-size-pixels*=_WIDTHxHEIGHT_ *-w*,*--window-size-pixels*=_WIDTHxHEIGHT_
Set initial window width and height, in pixels. Default: _700x500_. Set initial window width and height, in pixels. Default: _700x500_.
@ -198,8 +193,8 @@ variables to unset may be defined in *foot.ini*(5).
The following signals have special meaning in footclient: The following signals have special meaning in footclient:
- SIGUSR1: switch to the dark color theme (*[colors-dark]*). - SIGUSR1: switch to color theme 1 (i.e. use the *[colors]* section).
- SIGUSR2: switch to the light color theme (*[colors-light]*). - SIGUSR2: switch to color theme 2 (i.e. use the *[colors2]* section).
When sending SIGUSR1/SIGUSR2 to a footclient instance, the theme is When sending SIGUSR1/SIGUSR2 to a footclient instance, the theme is
changed in that instance only. This is different from when you send changed in that instance only. This is different from when you send

View file

@ -22,12 +22,6 @@ const char version_and_features[] =
" -graphemes" " -graphemes"
#endif #endif
#if defined(HAVE_XDG_TOPLEVEL_TAG)
" +toplevel-tag"
#else
" -toplevel-tag"
#endif
#if !defined(NDEBUG) #if !defined(NDEBUG)
" +assertions" " +assertions"
#else #else

View file

@ -24,7 +24,7 @@
# dpi-aware=no # dpi-aware=no
# gamma-correct-blending=no # gamma-correct-blending=no
# initial-color-theme=dark # initial-color-theme=1
# initial-window-size-pixels=700x500 # Or, # initial-window-size-pixels=700x500 # Or,
# initial-window-size-chars=<COLSxROWS> # initial-window-size-chars=<COLSxROWS>
# initial-window-mode=windowed # initial-window-mode=windowed
@ -101,7 +101,7 @@
[touch] [touch]
# long-press-delay=400 # long-press-delay=400
[colors-dark] [colors]
# alpha=1.0 # alpha=1.0
# alpha-mode=default # Can be `default`, `matching` or `all` # alpha-mode=default # Can be `default`, `matching` or `all`
# background=242424 # background=242424
@ -169,7 +169,7 @@
# search-box-match=<regular0> <regular3> # black-on-yellow # search-box-match=<regular0> <regular3> # black-on-yellow
# urls=<regular3> # urls=<regular3>
[colors-light] [colors2]
# Alternative color theme, see man page foot.ini(5) # Alternative color theme, see man page foot.ini(5)
# Same builtin defaults as [color], except for: # Same builtin defaults as [color], except for:
# dim-blend-towards=white # dim-blend-towards=white

67
input.c
View file

@ -120,14 +120,10 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_SCROLLBACK_UP_MOUSE: case BIND_ACTION_SCROLLBACK_UP_MOUSE:
if (term->grid == &term->alt) { if (term->grid == &term->alt) {
if (term->alt_scrolling) { if (term->alt_scrolling)
alternate_scroll(seat, amount, BTN_BACK); alternate_scroll(seat, amount, BTN_BACK);
return true; } else
} cmd_scrollback_up(term, amount);
} else {
cmd_scrollback_up(term, amount);
return true;
}
break; break;
case BIND_ACTION_SCROLLBACK_DOWN_PAGE: case BIND_ACTION_SCROLLBACK_DOWN_PAGE:
@ -153,14 +149,10 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_SCROLLBACK_DOWN_MOUSE: case BIND_ACTION_SCROLLBACK_DOWN_MOUSE:
if (term->grid == &term->alt) { if (term->grid == &term->alt) {
if (term->alt_scrolling) { if (term->alt_scrolling)
alternate_scroll(seat, amount, BTN_FORWARD); alternate_scroll(seat, amount, BTN_FORWARD);
return true; } else
}
} else {
cmd_scrollback_down(term, amount); cmd_scrollback_down(term, amount);
return true;
}
break; break;
case BIND_ACTION_SCROLLBACK_HOME: case BIND_ACTION_SCROLLBACK_HOME:
@ -494,13 +486,11 @@ execute_binding(struct seat *seat, struct terminal *term,
return true; return true;
case BIND_ACTION_THEME_SWITCH_1: case BIND_ACTION_THEME_SWITCH_1:
case BIND_ACTION_THEME_SWITCH_DARK: term_theme_switch_to_1(term);
term_theme_switch_to_dark(term);
return true; return true;
case BIND_ACTION_THEME_SWITCH_2: case BIND_ACTION_THEME_SWITCH_2:
case BIND_ACTION_THEME_SWITCH_LIGHT: term_theme_switch_to_2(term);
term_theme_switch_to_light(term);
return true; return true;
case BIND_ACTION_THEME_TOGGLE: case BIND_ACTION_THEME_TOGGLE:
@ -543,7 +533,7 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_SELECT_QUOTE: case BIND_ACTION_SELECT_QUOTE:
selection_start( selection_start(
term, seat->mouse.col, seat->mouse.row, SELECTION_QUOTE_WISE, false); term, seat->mouse.col, seat->mouse.row, SELECTION_QUOTE_WISE, false);
return true; break;
case BIND_ACTION_SELECT_ROW: case BIND_ACTION_SELECT_ROW:
selection_start( selection_start(
@ -586,20 +576,23 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
/* Verify keymap is in a format we understand */ /* Verify keymap is in a format we understand */
switch ((enum wl_keyboard_keymap_format)format) { switch ((enum wl_keyboard_keymap_format)format) {
case WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP: case WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP:
goto err; close(fd);
return;
case WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1: case WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1:
break; break;
default: default:
LOG_WARN("unrecognized keymap format: %u", format); LOG_WARN("unrecognized keymap format: %u", format);
goto err; close(fd);
return;
} }
char *map_str = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); char *map_str = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (map_str == MAP_FAILED) { if (map_str == MAP_FAILED) {
LOG_ERRNO("failed to mmap keyboard keymap"); LOG_ERRNO("failed to mmap keyboard keymap");
goto err; close(fd);
return;
} }
while (map_str[size - 1] == '\0') while (map_str[size - 1] == '\0')
@ -612,8 +605,6 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
} }
munmap(map_str, size);
if (seat->kbd.xkb_keymap != NULL) { if (seat->kbd.xkb_keymap != NULL) {
seat->kbd.xkb_state = xkb_state_new(seat->kbd.xkb_keymap); seat->kbd.xkb_state = xkb_state_new(seat->kbd.xkb_keymap);
@ -694,10 +685,10 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
seat->kbd.key_arrow_down = xkb_keymap_key_by_name(seat->kbd.xkb_keymap, "DOWN"); seat->kbd.key_arrow_down = xkb_keymap_key_by_name(seat->kbd.xkb_keymap, "DOWN");
} }
key_binding_load_keymap(wayl->key_binding_manager, seat); munmap(map_str, size);
err:
close(fd); close(fd);
key_binding_load_keymap(wayl->key_binding_manager, seat);
} }
static void static void
@ -1605,9 +1596,6 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (released) if (released)
stop_repeater(seat, key); stop_repeater(seat, key);
if (pressed)
seat->kbd.last_shortcut_sym = XKB_KEYSYM_MAX + 1;
bool should_repeat = bool should_repeat =
pressed && xkb_keymap_key_repeats(seat->kbd.xkb_keymap, key); pressed && xkb_keymap_key_repeats(seat->kbd.xkb_keymap, key);
@ -1709,7 +1697,6 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (bind->k.sym == raw_syms[i] && if (bind->k.sym == raw_syms[i] &&
execute_binding(seat, term, bind, serial, 1)) execute_binding(seat, term, bind, serial, 1))
{ {
seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat; goto maybe_repeat;
} }
} }
@ -1723,7 +1710,6 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
bind->mods == (mods & ~consumed) && bind->mods == (mods & ~consumed) &&
execute_binding(seat, term, bind, serial, 1)) execute_binding(seat, term, bind, serial, 1))
{ {
seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat; goto maybe_repeat;
} }
} }
@ -1739,31 +1725,12 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (code->item == key && if (code->item == key &&
execute_binding(seat, term, bind, serial, 1)) execute_binding(seat, term, bind, serial, 1))
{ {
seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat; goto maybe_repeat;
} }
} }
} }
} }
if (released && seat->kbd.last_shortcut_sym == sym) {
/*
* Don't process a release event, if it corresponds to a
* triggered shortcut.
*
* 1. If we consumed a key (press) event, we shouldn't emit an
* escape for its release event.
* 2. Ignoring the incorrectness of doing so; this also caused
* us to reset the viewport.
*
* Background: if the kitty keyboard protocol was enabled,
* then the viewport was instantly reset to the bottom, after
* scrolling up.
*/
//seat->kbd.last_shortcut_sym = XKB_KEYSYM_MAX + 1;
goto maybe_repeat;
}
/* /*
* Keys generating escape sequences * Keys generating escape sequences
*/ */

View file

@ -45,8 +45,6 @@ enum bind_action_normal {
BIND_ACTION_REGEX_COPY, BIND_ACTION_REGEX_COPY,
BIND_ACTION_THEME_SWITCH_1, BIND_ACTION_THEME_SWITCH_1,
BIND_ACTION_THEME_SWITCH_2, BIND_ACTION_THEME_SWITCH_2,
BIND_ACTION_THEME_SWITCH_DARK,
BIND_ACTION_THEME_SWITCH_LIGHT,
BIND_ACTION_THEME_TOGGLE, BIND_ACTION_THEME_TOGGLE,
/* Mouse specific actions - i.e. they require a mouse coordinate */ /* Mouse specific actions - i.e. they require a mouse coordinate */

15
main.c
View file

@ -59,14 +59,14 @@ fdm_sigusr(struct fdm *fdm, int signo, void *data)
if (ctx->server != NULL) { if (ctx->server != NULL) {
if (signo == SIGUSR1) if (signo == SIGUSR1)
server_global_theme_switch_to_dark(ctx->server); server_global_theme_switch_to_1(ctx->server);
else else
server_global_theme_switch_to_light(ctx->server); server_global_theme_switch_to_2(ctx->server);
} else { } else {
if (signo == SIGUSR1) if (signo == SIGUSR1)
term_theme_switch_to_dark(ctx->term); term_theme_switch_to_1(ctx->term);
else else
term_theme_switch_to_light(ctx->term); term_theme_switch_to_2(ctx->term);
} }
return true; return true;
@ -84,7 +84,6 @@ print_usage(const char *prog_name)
" -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n" " -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n"
" -T,--title=TITLE initial window title (foot)\n" " -T,--title=TITLE initial window title (foot)\n"
" -a,--app-id=ID window application ID (foot)\n" " -a,--app-id=ID window application ID (foot)\n"
" --toplevel-tag=TAG set a custom toplevel tag\n"
" -m,--maximized start in maximized mode\n" " -m,--maximized start in maximized mode\n"
" -F,--fullscreen start in fullscreen mode\n" " -F,--fullscreen start in fullscreen mode\n"
" -L,--login-shell start shell as a login shell\n" " -L,--login-shell start shell as a login shell\n"
@ -186,7 +185,6 @@ sanitize_signals(void)
enum { enum {
PTY_OPTION = CHAR_MAX + 1, PTY_OPTION = CHAR_MAX + 1,
TOPLEVEL_TAG_OPTION = CHAR_MAX + 2,
}; };
int int
@ -216,7 +214,6 @@ main(int argc, char *const *argv)
{"term", required_argument, NULL, 't'}, {"term", required_argument, NULL, 't'},
{"title", required_argument, NULL, 'T'}, {"title", required_argument, NULL, 'T'},
{"app-id", required_argument, NULL, 'a'}, {"app-id", required_argument, NULL, 'a'},
{"toplevel-tag", required_argument, NULL, TOPLEVEL_TAG_OPTION},
{"login-shell", no_argument, NULL, 'L'}, {"login-shell", no_argument, NULL, 'L'},
{"working-directory", required_argument, NULL, 'D'}, {"working-directory", required_argument, NULL, 'D'},
{"font", required_argument, NULL, 'f'}, {"font", required_argument, NULL, 'f'},
@ -288,10 +285,6 @@ main(int argc, char *const *argv)
tll_push_back(overrides, xstrjoin("app-id=", optarg)); tll_push_back(overrides, xstrjoin("app-id=", optarg));
break; break;
case TOPLEVEL_TAG_OPTION:
tll_push_back(overrides, xstrjoin("toplevel-tag=", optarg));
break;
case 'D': { case 'D': {
struct stat st; struct stat st;
if (stat(optarg, &st) < 0 || !(st.st_mode & S_IFDIR)) { if (stat(optarg, &st) < 0 || !(st.st_mode & S_IFDIR)) {

View file

@ -182,12 +182,7 @@ wl_proto_xml = [
wayland_protocols_datadir / 'staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml', wayland_protocols_datadir / 'staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml',
wayland_protocols_datadir / 'staging/xdg-system-bell/xdg-system-bell-v1.xml', wayland_protocols_datadir / 'staging/xdg-system-bell/xdg-system-bell-v1.xml',
wayland_protocols_datadir / 'staging/color-management/color-management-v1.xml', wayland_protocols_datadir / 'staging/color-management/color-management-v1.xml',
] ]
if (wayland_protocols.version().version_compare('>=1.43'))
wl_proto_xml += [wayland_protocols_datadir / 'staging/xdg-toplevel-tag/xdg-toplevel-tag-v1.xml']
add_project_arguments('-DHAVE_XDG_TOPLEVEL_TAG=1', language: 'c')
endif
foreach prot : wl_proto_xml foreach prot : wl_proto_xml
wl_proto_headers += custom_target( wl_proto_headers += custom_target(

View file

@ -114,7 +114,7 @@ consume_stdout(struct notification *notif, bool eof)
while (left > 0) { while (left > 0) {
line = data; line = data;
size_t len = left; size_t len = left;
char *eol = (char *)memchr(line, '\n', left); char *eol = memchr(line, '\n', left);
if (eol != NULL) { if (eol != NULL) {
*eol = '\0'; *eol = '\0';

54
osc.c
View file

@ -513,7 +513,7 @@ osc_uri(struct terminal *term, char *string)
key_value = strtok_r(NULL, ":", &ctx)) key_value = strtok_r(NULL, ":", &ctx))
{ {
const char *key = key_value; const char *key = key_value;
char *operator = (char *)strchr(key_value, '='); char *operator = strchr(key_value, '=');
if (operator == NULL) if (operator == NULL)
continue; continue;
@ -525,14 +525,12 @@ osc_uri(struct terminal *term, char *string)
id = sdbm_hash(value); id = sdbm_hash(value);
} }
LOG_DBG("OSC-8: URL=%s, id=%" PRIu64, uri, id);
if (uri[0] == '\0') { if (uri[0] == '\0')
LOG_DBG("OSC-8: close");
term_osc8_close(term); term_osc8_close(term);
} else { else
LOG_DBG("OSC-8: URL=%s, id=%" PRIu64, uri, id);
term_osc8_open(term, id, uri); term_osc8_open(term, id, uri);
}
} }
static void static void
@ -1461,9 +1459,9 @@ osc_dispatch(struct terminal *term)
case 11: case 11:
term->colors.bg = color; term->colors.bg = color;
if (!have_alpha) { if (!have_alpha) {
alpha = term->colors.active_theme == COLOR_THEME_DARK alpha = term->colors.active_theme == COLOR_THEME1
? term->conf->colors_dark.alpha ? term->conf->colors.alpha
: term->conf->colors_light.alpha; : term->conf->colors2.alpha;
} }
const bool changed = term->colors.alpha != alpha; const bool changed = term->colors.alpha != alpha;
@ -1518,9 +1516,9 @@ osc_dispatch(struct terminal *term)
/* Reset Color Number 'c' (whole table if no parameter) */ /* Reset Color Number 'c' (whole table if no parameter) */
const struct color_theme *theme = const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK term->colors.active_theme == COLOR_THEME1
? &term->conf->colors_dark ? &term->conf->colors
: &term->conf->colors_light; : &term->conf->colors2;
if (string[0] == '\0') { if (string[0] == '\0') {
LOG_DBG("resetting all colors"); LOG_DBG("resetting all colors");
@ -1561,9 +1559,9 @@ osc_dispatch(struct terminal *term)
LOG_DBG("resetting foreground color"); LOG_DBG("resetting foreground color");
const struct color_theme *theme = const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK term->colors.active_theme == COLOR_THEME1
? &term->conf->colors_dark ? &term->conf->colors
: &term->conf->colors_light; : &term->conf->colors2;
term->colors.fg = theme->fg; term->colors.fg = theme->fg;
term_damage_color(term, COLOR_DEFAULT, 0); term_damage_color(term, COLOR_DEFAULT, 0);
@ -1573,9 +1571,9 @@ osc_dispatch(struct terminal *term)
LOG_DBG("resetting background color"); LOG_DBG("resetting background color");
const struct color_theme *theme = const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK term->colors.active_theme == COLOR_THEME1
? &term->conf->colors_dark ? &term->conf->colors
: &term->conf->colors_light; : &term->conf->colors2;
bool alpha_changed = term->colors.alpha != theme->alpha; bool alpha_changed = term->colors.alpha != theme->alpha;
@ -1596,14 +1594,14 @@ osc_dispatch(struct terminal *term)
LOG_DBG("resetting cursor color"); LOG_DBG("resetting cursor color");
const struct color_theme *theme = const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK term->colors.active_theme == COLOR_THEME1
? &term->conf->colors_dark ? &term->conf->colors
: &term->conf->colors_light; : &term->conf->colors2;
term->colors.cursor_fg = theme->cursor.text; term->colors.cursor_fg = theme->cursor.text;
term->colors.cursor_bg = theme->cursor.cursor; term->colors.cursor_bg = theme->cursor.cursor;
if (term->conf->colors_dark.use_custom.cursor) { if (term->conf->colors.use_custom.cursor) {
term->colors.cursor_fg |= 1u << 31; term->colors.cursor_fg |= 1u << 31;
term->colors.cursor_bg |= 1u << 31; term->colors.cursor_bg |= 1u << 31;
} }
@ -1616,9 +1614,9 @@ osc_dispatch(struct terminal *term)
LOG_DBG("resetting selection background color"); LOG_DBG("resetting selection background color");
const struct color_theme *theme = const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK term->colors.active_theme == COLOR_THEME1
? &term->conf->colors_dark ? &term->conf->colors
: &term->conf->colors_light; : &term->conf->colors2;
term->colors.selection_bg = theme->selection_bg; term->colors.selection_bg = theme->selection_bg;
break; break;
@ -1628,9 +1626,9 @@ osc_dispatch(struct terminal *term)
LOG_DBG("resetting selection foreground color"); LOG_DBG("resetting selection foreground color");
const struct color_theme *theme = const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK term->colors.active_theme == COLOR_THEME1
? &term->conf->colors_dark ? &term->conf->colors
: &term->conf->colors_light; : &term->conf->colors2;
term->colors.selection_fg = theme->selection_fg; term->colors.selection_fg = theme->selection_fg;
break; break;

View file

@ -1,10 +0,0 @@
[tool.pyright]
strict = ['scripts']
[tool.mypy]
files = '$MYPY_CONFIG_FILE_DIR/scripts'
strict = true
[tool.codespell]
skip = 'pyproject.toml,./subprojects,./pkg,./src,./bld,foot.info,./unicode,./venv'
ignore-regex = 'terminfo capability `rin`|\* Simon Ser|\* \[zar\]\(https://codeberg.org/zar\)|iterm theme|iterm.toml|iterm/OneHalfDark.itermcolors'

View file

@ -293,7 +293,7 @@ static inline uint32_t
color_dim(const struct terminal *term, uint32_t color) color_dim(const struct terminal *term, uint32_t color)
{ {
const struct config *conf = term->conf; const struct config *conf = term->conf;
const uint8_t custom_dim = conf->colors_dark.use_custom.dim; const uint8_t custom_dim = conf->colors.use_custom.dim;
if (unlikely(custom_dim != 0)) { if (unlikely(custom_dim != 0)) {
for (size_t i = 0; i < 8; i++) { for (size_t i = 0; i < 8; i++) {
@ -302,7 +302,7 @@ color_dim(const struct terminal *term, uint32_t color)
if (term->colors.table[0 + i] == color) { if (term->colors.table[0 + i] == color) {
/* "Regular" color, return the corresponding "dim" */ /* "Regular" color, return the corresponding "dim" */
return conf->colors_dark.dim[i]; return conf->colors.dim[i];
} }
else if (term->colors.table[8 + i] == color) { else if (term->colors.table[8 + i] == color) {
@ -312,9 +312,9 @@ color_dim(const struct terminal *term, uint32_t color)
} }
} }
const struct color_theme *theme = term->colors.active_theme == COLOR_THEME_DARK const struct color_theme *theme = term->colors.active_theme == COLOR_THEME1
? &conf->colors_dark ? &conf->colors
: &conf->colors_light; : &conf->colors2;
return color_blend_towards( return color_blend_towards(
color, color,
@ -776,7 +776,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
} }
else if (!term->window->is_fullscreen && term->colors.alpha != 0xffff) { else if (!term->window->is_fullscreen && term->colors.alpha != 0xffff) {
switch (term->conf->colors_dark.alpha_mode) { switch (term->conf->colors.alpha_mode) {
case ALPHA_MODE_DEFAULT: { case ALPHA_MODE_DEFAULT: {
if (cell->attrs.bg_src == COLOR_DEFAULT) { if (cell->attrs.bg_src == COLOR_DEFAULT) {
alpha = term->colors.alpha; alpha = term->colors.alpha;
@ -1175,8 +1175,8 @@ render_cell(struct terminal *term, pixman_image_t *pix,
if (unlikely(cell->attrs.url)) { if (unlikely(cell->attrs.url)) {
pixman_color_t url_color = color_hex_to_pixman( pixman_color_t url_color = color_hex_to_pixman(
term->conf->colors_dark.use_custom.url term->conf->colors.use_custom.url
? term->conf->colors_dark.url ? term->conf->colors.url
: term->colors.table[3], : term->colors.table[3],
gamma_correct); gamma_correct);
draw_underline(term, pix, font, &url_color, x, y, cell_cols); draw_underline(term, pix, font, &url_color, x, y, cell_cols);
@ -1991,8 +1991,8 @@ render_overlay(struct terminal *term)
case OVERLAY_FLASH: case OVERLAY_FLASH:
color = color_hex_to_pixman_with_alpha( color = color_hex_to_pixman_with_alpha(
term->conf->colors_dark.flash, term->conf->colors.flash,
term->conf->colors_dark.flash_alpha, term->conf->colors.flash_alpha,
wayl_do_linear_blending(term->wl, term->conf)); wayl_do_linear_blending(term->wl, term->conf));
break; break;
@ -2012,7 +2012,7 @@ render_overlay(struct terminal *term)
} }
struct buffer *buf = shm_get_buffer( struct buffer *buf = shm_get_buffer(
term->render.chains.overlay, term->width, term->height); term->render.chains.overlay, term->width, term->height, true);
pixman_image_set_clip_region32(buf->pix[0], NULL); pixman_image_set_clip_region32(buf->pix[0], NULL);
/* Bounding rectangle of damaged areas - for wl_surface_damage_buffer() */ /* Bounding rectangle of damaged areas - for wl_surface_damage_buffer() */
@ -2288,8 +2288,8 @@ render_worker_thread(void *_ctx)
return -1; return -1;
} }
void static void
render_wait_for_preapply_damage(struct terminal *term) wait_for_preapply_damage(struct terminal *term)
{ {
if (!term->render.preapply_last_frame_damage) if (!term->render.preapply_last_frame_damage)
return; return;
@ -2510,10 +2510,10 @@ render_csd_title(struct terminal *term, const struct csd_data *info,
uint32_t bg = term->conf->csd.color.title_set uint32_t bg = term->conf->csd.color.title_set
? term->conf->csd.color.title ? term->conf->csd.color.title
: 0xffu << 24 | term->conf->colors_dark.fg; : 0xffu << 24 | term->conf->colors.fg;
uint32_t fg = term->conf->csd.color.buttons_set uint32_t fg = term->conf->csd.color.buttons_set
? term->conf->csd.color.buttons ? term->conf->csd.color.buttons
: term->conf->colors_dark.bg; : term->conf->colors.bg;
if (!term->visual_focus) { if (!term->visual_focus) {
bg = color_dim(term, bg); bg = color_dim(term, bg);
@ -2607,7 +2607,7 @@ render_csd_border(struct terminal *term, enum csd_surface surf_idx,
uint32_t _color = uint32_t _color =
conf->csd.color.border_set ? conf->csd.color.border : conf->csd.color.border_set ? conf->csd.color.border :
conf->csd.color.title_set ? conf->csd.color.title : conf->csd.color.title_set ? conf->csd.color.title :
0xffu << 24 | term->conf->colors_dark.fg; 0xffu << 24 | term->conf->colors.fg;
if (!term->visual_focus) if (!term->visual_focus)
_color = color_dim(term, _color); _color = color_dim(term, _color);
@ -2627,7 +2627,7 @@ static pixman_color_t
get_csd_button_fg_color(const struct terminal *term) get_csd_button_fg_color(const struct terminal *term)
{ {
const struct config *conf = term->conf; const struct config *conf = term->conf;
uint32_t _color = conf->colors_dark.bg; uint32_t _color = conf->colors.bg;
uint16_t alpha = 0xffff; uint16_t alpha = 0xffff;
if (conf->csd.color.buttons_set) { if (conf->csd.color.buttons_set) {
@ -2872,7 +2872,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx,
switch (surf_idx) { switch (surf_idx) {
case CSD_SURF_MINIMIZE: case CSD_SURF_MINIMIZE:
_color = term->conf->colors_dark.table[4]; /* blue */ _color = term->conf->colors.table[4]; /* blue */
is_set = term->conf->csd.color.minimize_set; is_set = term->conf->csd.color.minimize_set;
conf_color = &term->conf->csd.color.minimize; conf_color = &term->conf->csd.color.minimize;
is_active = term->active_surface == TERM_SURF_BUTTON_MINIMIZE && is_active = term->active_surface == TERM_SURF_BUTTON_MINIMIZE &&
@ -2880,7 +2880,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx,
break; break;
case CSD_SURF_MAXIMIZE: case CSD_SURF_MAXIMIZE:
_color = term->conf->colors_dark.table[2]; /* green */ _color = term->conf->colors.table[2]; /* green */
is_set = term->conf->csd.color.maximize_set; is_set = term->conf->csd.color.maximize_set;
conf_color = &term->conf->csd.color.maximize; conf_color = &term->conf->csd.color.maximize;
is_active = term->active_surface == TERM_SURF_BUTTON_MAXIMIZE && is_active = term->active_surface == TERM_SURF_BUTTON_MAXIMIZE &&
@ -2888,7 +2888,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx,
break; break;
case CSD_SURF_CLOSE: case CSD_SURF_CLOSE:
_color = term->conf->colors_dark.table[1]; /* red */ _color = term->conf->colors.table[1]; /* red */
is_set = term->conf->csd.color.close_set; is_set = term->conf->csd.color.close_set;
conf_color = &term->conf->csd.color.quit; conf_color = &term->conf->csd.color.quit;
is_active = term->active_surface == TERM_SURF_BUTTON_CLOSE && is_active = term->active_surface == TERM_SURF_BUTTON_CLOSE &&
@ -2970,7 +2970,7 @@ render_csd(struct terminal *term)
} }
struct buffer *bufs[CSD_SURF_COUNT]; struct buffer *bufs[CSD_SURF_COUNT];
shm_get_many(term->render.chains.csd, CSD_SURF_COUNT, widths, heights, bufs); shm_get_many(term->render.chains.csd, CSD_SURF_COUNT, widths, heights, bufs, true);
for (size_t i = CSD_SURF_LEFT; i <= CSD_SURF_BOTTOM; i++) for (size_t i = CSD_SURF_LEFT; i <= CSD_SURF_BOTTOM; i++)
render_csd_border(term, i, &infos[i], bufs[i]); render_csd_border(term, i, &infos[i], bufs[i]);
@ -3110,16 +3110,16 @@ render_scrollback_position(struct terminal *term)
} }
struct buffer_chain *chain = term->render.chains.scrollback_indicator; struct buffer_chain *chain = term->render.chains.scrollback_indicator;
struct buffer *buf = shm_get_buffer(chain, width, height); struct buffer *buf = shm_get_buffer(chain, width, height, false);
wl_subsurface_set_position( wl_subsurface_set_position(
win->scrollback_indicator.sub, roundf(x / scale), roundf(y / scale)); win->scrollback_indicator.sub, roundf(x / scale), roundf(y / scale));
uint32_t fg = term->colors.table[0]; uint32_t fg = term->colors.table[0];
uint32_t bg = term->colors.table[8 + 4]; uint32_t bg = term->colors.table[8 + 4];
if (term->conf->colors_dark.use_custom.scrollback_indicator) { if (term->conf->colors.use_custom.scrollback_indicator) {
fg = term->conf->colors_dark.scrollback_indicator.fg; fg = term->conf->colors.scrollback_indicator.fg;
bg = term->conf->colors_dark.scrollback_indicator.bg; bg = term->conf->colors.scrollback_indicator.bg;
} }
render_osd( render_osd(
@ -3153,7 +3153,7 @@ render_render_timer(struct terminal *term, struct timespec render_time)
height = roundf(scale * ceilf(height / scale)); height = roundf(scale * ceilf(height / scale));
struct buffer_chain *chain = term->render.chains.render_timer; struct buffer_chain *chain = term->render.chains.render_timer;
struct buffer *buf = shm_get_buffer(chain, width, height); struct buffer *buf = shm_get_buffer(chain, width, height, false);
wl_subsurface_set_position( wl_subsurface_set_position(
win->render_timer.sub, win->render_timer.sub,
@ -3325,7 +3325,7 @@ grid_render(struct terminal *term)
term->render.workers.preapplied_damage.buf != NULL)) term->render.workers.preapplied_damage.buf != NULL))
{ {
clock_gettime(CLOCK_MONOTONIC, &start_wait_preapply); clock_gettime(CLOCK_MONOTONIC, &start_wait_preapply);
render_wait_for_preapply_damage(term); wait_for_preapply_damage(term);
clock_gettime(CLOCK_MONOTONIC, &stop_wait_preapply); clock_gettime(CLOCK_MONOTONIC, &stop_wait_preapply);
} }
@ -3336,7 +3336,10 @@ grid_render(struct terminal *term)
xassert(term->height > 0); xassert(term->height > 0);
struct buffer_chain *chain = term->render.chains.grid; struct buffer_chain *chain = term->render.chains.grid;
struct buffer *buf = shm_get_buffer(chain, term->width, term->height); bool use_alpha = !term->window->is_fullscreen &&
term->colors.alpha != 0xffff;
struct buffer *buf = shm_get_buffer(
chain, term->width, term->height, use_alpha);
/* Dirty old and current cursor cell, to ensure they're repainted */ /* Dirty old and current cursor cell, to ensure they're repainted */
dirty_old_cursor(term); dirty_old_cursor(term);
@ -3784,7 +3787,7 @@ render_search_box(struct terminal *term)
size_t glyph_offset = term->render.search_glyph_offset; size_t glyph_offset = term->render.search_glyph_offset;
struct buffer_chain *chain = term->render.chains.search; struct buffer_chain *chain = term->render.chains.search;
struct buffer *buf = shm_get_buffer(chain, width, height); struct buffer *buf = shm_get_buffer(chain, width, height, true);
pixman_region32_t clip; pixman_region32_t clip;
pixman_region32_init_rect(&clip, 0, 0, width, height); pixman_region32_init_rect(&clip, 0, 0, width, height);
@ -3796,18 +3799,18 @@ render_search_box(struct terminal *term)
const bool is_match = term->search.match_len == text_len; const bool is_match = term->search.match_len == text_len;
const bool custom_colors = is_match const bool custom_colors = is_match
? term->conf->colors_dark.use_custom.search_box_match ? term->conf->colors.use_custom.search_box_match
: term->conf->colors_dark.use_custom.search_box_no_match; : term->conf->colors.use_custom.search_box_no_match;
/* Background - yellow on empty/match, red on mismatch (default) */ /* Background - yellow on empty/match, red on mismatch (default) */
const bool gamma_correct = wayl_do_linear_blending(term->wl, term->conf); const bool gamma_correct = wayl_do_linear_blending(term->wl, term->conf);
const pixman_color_t color = color_hex_to_pixman( const pixman_color_t color = color_hex_to_pixman(
is_match is_match
? (custom_colors ? (custom_colors
? term->conf->colors_dark.search_box.match.bg ? term->conf->colors.search_box.match.bg
: term->colors.table[3]) : term->colors.table[3])
: (custom_colors : (custom_colors
? term->conf->colors_dark.search_box.no_match.bg ? term->conf->colors.search_box.no_match.bg
: term->colors.table[1]), : term->colors.table[1]),
gamma_correct); gamma_correct);
@ -3829,8 +3832,8 @@ render_search_box(struct terminal *term)
pixman_color_t fg = color_hex_to_pixman( pixman_color_t fg = color_hex_to_pixman(
custom_colors custom_colors
? (is_match ? (is_match
? term->conf->colors_dark.search_box.match.fg ? term->conf->colors.search_box.match.fg
: term->conf->colors_dark.search_box.no_match.fg) : term->conf->colors.search_box.no_match.fg)
: term->colors.table[0], : term->colors.table[0],
gamma_correct); gamma_correct);
@ -4249,13 +4252,13 @@ render_urls(struct terminal *term)
struct buffer_chain *chain = term->render.chains.url; struct buffer_chain *chain = term->render.chains.url;
struct buffer *bufs[render_count]; struct buffer *bufs[render_count];
shm_get_many(chain, render_count, widths, heights, bufs); shm_get_many(chain, render_count, widths, heights, bufs, false);
uint32_t fg = term->conf->colors_dark.use_custom.jump_label uint32_t fg = term->conf->colors.use_custom.jump_label
? term->conf->colors_dark.jump_label.fg ? term->conf->colors.jump_label.fg
: term->colors.table[0]; : term->colors.table[0];
uint32_t bg = term->conf->colors_dark.use_custom.jump_label uint32_t bg = term->conf->colors.use_custom.jump_label
? term->conf->colors_dark.jump_label.bg ? term->conf->colors.jump_label.bg
: term->colors.table[3]; : term->colors.table[3];
for (size_t i = 0; i < render_count; i++) { for (size_t i = 0; i < render_count; i++) {
@ -4401,7 +4404,7 @@ delayed_reflow_of_normal_grid(struct terminal *term)
term->interactive_resizing.old_hide_cursor = false; term->interactive_resizing.old_hide_cursor = false;
/* Invalidate render pointers */ /* Invalidate render pointers */
render_wait_for_preapply_damage(term); wait_for_preapply_damage(term);
shm_unref(term->render.last_buf); shm_unref(term->render.last_buf);
term->render.last_buf = NULL; term->render.last_buf = NULL;
term->render.last_cursor.row = NULL; term->render.last_cursor.row = NULL;
@ -4976,7 +4979,7 @@ damage_view:
tll_free(term->normal.scroll_damage); tll_free(term->normal.scroll_damage);
tll_free(term->alt.scroll_damage); tll_free(term->alt.scroll_damage);
render_wait_for_preapply_damage(term); wait_for_preapply_damage(term);
shm_unref(term->render.last_buf); shm_unref(term->render.last_buf);
term->render.last_buf = NULL; term->render.last_buf = NULL;
term_damage_view(term); term_damage_view(term);

View file

@ -49,4 +49,3 @@ struct csd_data {
struct csd_data get_csd_data(const struct terminal *term, enum csd_surface surf_idx); struct csd_data get_csd_data(const struct terminal *term, enum csd_surface surf_idx);
void render_buffer_release_callback(struct buffer *buf, void *data); void render_buffer_release_callback(struct buffer *buf, void *data);
void render_wait_for_preapply_damage(struct terminal *term);

View file

@ -11,7 +11,7 @@ import termios
from datetime import datetime from datetime import datetime
def main() -> None: def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('files', type=argparse.FileType('rb'), nargs='+') parser.add_argument('files', type=argparse.FileType('rb'), nargs='+')
parser.add_argument('--iterations', type=int, default=20) parser.add_argument('--iterations', type=int, default=20)
@ -24,12 +24,12 @@ def main() -> None:
termios.TIOCGWINSZ, termios.TIOCGWINSZ,
struct.pack('HHHH', 0, 0, 0, 0))) struct.pack('HHHH', 0, 0, 0, 0)))
times: dict[str, list[float]] = {name: [] for name in [f.name for f in args.files]} times = {name: [] for name in [f.name for f in args.files]}
for f in args.files: for f in args.files:
bench_bytes = f.read() bench_bytes = f.read()
for _ in range(args.iterations): for i in range(args.iterations):
start = datetime.now() start = datetime.now()
sys.stdout.buffer.write(bench_bytes) sys.stdout.buffer.write(bench_bytes)
stop = datetime.now() stop = datetime.now()
@ -48,4 +48,4 @@ def main() -> None:
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View file

@ -8,8 +8,6 @@ import struct
import sys import sys
import termios import termios
from typing import Any
class ColorVariant(enum.IntEnum): class ColorVariant(enum.IntEnum):
NONE = enum.auto() NONE = enum.auto()
@ -19,7 +17,7 @@ class ColorVariant(enum.IntEnum):
RGB = enum.auto() RGB = enum.auto()
def main() -> None: def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
'out', type=argparse.FileType(mode='w'), nargs='?', help='name of output file') 'out', type=argparse.FileType(mode='w'), nargs='?', help='name of output file')
@ -40,16 +38,10 @@ def main() -> None:
opts = parser.parse_args() opts = parser.parse_args()
out = opts.out if opts.out is not None else sys.stdout out = opts.out if opts.out is not None else sys.stdout
lines: int | None = None
cols: int | None = None
width: int | None = None
height: int | None = None
if opts.rows is None or opts.cols is None: if opts.rows is None or opts.cols is None:
try: try:
def dummy(*args: Any) -> None: def dummy(*args):
"""Need a handler installed for sigwait() to trigger.""" """Need a handler installed for sigwait() to trigger."""
_ = args
pass pass
signal.signal(signal.SIGWINCH, dummy) signal.signal(signal.SIGWINCH, dummy)
@ -61,9 +53,6 @@ def main() -> None:
termios.TIOCGWINSZ, termios.TIOCGWINSZ,
struct.pack('HHHH', 0, 0, 0, 0))) struct.pack('HHHH', 0, 0, 0, 0)))
assert width is not None
assert height is not None
if width > 0 and height > 0: if width > 0 and height > 0:
break break
@ -82,11 +71,9 @@ def main() -> None:
if opts.rows is not None: if opts.rows is not None:
lines = opts.rows lines = opts.rows
assert lines is not None
height = 15 * lines # PGO helper binary hardcodes cell height to 15px height = 15 * lines # PGO helper binary hardcodes cell height to 15px
if opts.cols is not None: if opts.cols is not None:
cols = opts.cols cols = opts.cols
assert cols is not None
width = 8 * cols # PGO help binary hardcodes cell width to 8px width = 8 * cols # PGO help binary hardcodes cell width to 8px
if lines is None or cols is None or height is None or width is None: if lines is None or cols is None or height is None or width is None:
@ -203,8 +190,8 @@ def main() -> None:
# The sixel 'alphabet' # The sixel 'alphabet'
sixels = '?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~' sixels = '?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
last_pos: tuple[int, int] | None = None last_pos = None
last_size: tuple[int, int] = 0, 0 last_size = None
for _ in range(20): for _ in range(20):
if last_pos is not None and random.randrange(2): if last_pos is not None and random.randrange(2):
@ -267,4 +254,4 @@ def main() -> None:
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View file

@ -1,12 +1,14 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import os
import re import re
import sys
from typing import Dict, Union
class Capability: class Capability:
def __init__(self, name: str, value: bool | int | str): def __init__(self, name: str, value: Union[bool, int, str]):
self._name = name self._name = name
self._value = value self._value = value
@ -15,37 +17,25 @@ class Capability:
return self._name return self._name
@property @property
def value(self) -> bool | int | str: def value(self) -> Union[bool, int, str]:
return self._value return self._value
def __lt__(self, other: object) -> bool: def __lt__(self, other):
if not isinstance(other, Capability):
return NotImplemented
return self._name < other._name return self._name < other._name
def __le__(self, other: object) -> bool: def __le__(self, other):
if not isinstance(other, Capability):
return NotImplemented
return self._name <= other._name return self._name <= other._name
def __eq__(self, other: object) -> bool: def __eq__(self, other):
if not isinstance(other, Capability):
return NotImplemented
return self._name == other._name return self._name == other._name
def __ne__(self, other: object) -> bool: def __ne__(self, other):
if not isinstance(other, Capability): return self._name != other._name
return NotImplemented
return bool(self._name != other._name)
def __gt__(self, other: object) -> bool: def __gt__(self, other):
if not isinstance(other, Capability): return self._name > other._name
return NotImplemented
return bool(self._name > other._name)
def __ge__(self, other: object) -> bool: def __ge__(self, other):
if not isinstance(other, Capability):
return NotImplemented
return self._name >= other._name return self._name >= other._name
@ -63,7 +53,7 @@ class StringCapability(Capability):
# see terminfo(5) for valid escape sequences # see terminfo(5) for valid escape sequences
# Control characters # Control characters
def translate_ctrl_chr(m: re.Match[str]) -> str: def translate_ctrl_chr(m):
ctrl = m.group(1) ctrl = m.group(1)
if ctrl == '?': if ctrl == '?':
return '\\x7f' return '\\x7f'
@ -95,7 +85,7 @@ class Fragment:
def __init__(self, name: str, description: str): def __init__(self, name: str, description: str):
self._name = name self._name = name
self._description = description self._description = description
self._caps = dict[str, Capability]() self._caps = {}
@property @property
def name(self) -> str: def name(self) -> str:
@ -106,18 +96,18 @@ class Fragment:
return self._description return self._description
@property @property
def caps(self) -> dict[str, Capability]: def caps(self) -> Dict[str, Capability]:
return self._caps return self._caps
def add_capability(self, cap: Capability) -> None: def add_capability(self, cap: Capability):
assert cap.name not in self._caps assert cap.name not in self._caps
self._caps[cap.name] = cap self._caps[cap.name] = cap
def del_capability(self, name: str) -> None: def del_capability(self, name: str):
del self._caps[name] del self._caps[name]
def main() -> None: def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('source_entry_name') parser.add_argument('source_entry_name')
parser.add_argument('source', type=argparse.FileType('r')) parser.add_argument('source', type=argparse.FileType('r'))
@ -130,15 +120,15 @@ def main() -> None:
source = opts.source source = opts.source
target = opts.target target = opts.target
lines = list[str]() lines = []
for line in source.readlines(): for l in source.readlines():
line = line.strip() l = l.strip()
if line.startswith('#'): if l.startswith('#'):
continue continue
lines.append(line) lines.append(l)
fragments = dict[str, Fragment]() fragments = {}
cur_fragment: Fragment | None = None cur_fragment = None
for m in re.finditer( for m in re.finditer(
r'(?P<name>(?P<entry_name>[-+\w@]+)\|(?P<entry_desc>.+?),)|' r'(?P<name>(?P<entry_name>[-+\w@]+)\|(?P<entry_desc>.+?),)|'
@ -157,20 +147,17 @@ def main() -> None:
elif m.group('bool_cap') is not None: elif m.group('bool_cap') is not None:
name = m.group('bool_name') name = m.group('bool_name')
assert cur_fragment is not None
cur_fragment.add_capability(BoolCapability(name)) cur_fragment.add_capability(BoolCapability(name))
elif m.group('int_cap') is not None: elif m.group('int_cap') is not None:
name = m.group('int_name') name = m.group('int_name')
int_value = int(m.group('int_val'), 0) value = int(m.group('int_val'), 0)
assert cur_fragment is not None cur_fragment.add_capability(IntCapability(name, value))
cur_fragment.add_capability(IntCapability(name, int_value))
elif m.group('str_cap') is not None: elif m.group('str_cap') is not None:
name = m.group('str_name') name = m.group('str_name')
str_value = m.group('str_val') value = m.group('str_val')
assert cur_fragment is not None cur_fragment.add_capability(StringCapability(name, value))
cur_fragment.add_capability(StringCapability(name, str_value))
else: else:
assert False assert False
@ -179,9 +166,6 @@ def main() -> None:
for frag in fragments.values(): for frag in fragments.values():
for cap in frag.caps.values(): for cap in frag.caps.values():
if cap.name == 'use': if cap.name == 'use':
assert isinstance(cap, StringCapability)
assert isinstance(cap.value, str)
use_frag = fragments[cap.value] use_frag = fragments[cap.value]
for use_cap in use_frag.caps.values(): for use_cap in use_frag.caps.values():
frag.add_capability(use_cap) frag.add_capability(use_cap)
@ -201,9 +185,8 @@ def main() -> None:
entry.add_capability(StringCapability('TN', target_entry_name)) entry.add_capability(StringCapability('TN', target_entry_name))
entry.add_capability(StringCapability('name', target_entry_name)) entry.add_capability(StringCapability('name', target_entry_name))
entry.add_capability(IntCapability('RGB', 8)) # 8 bits per channel entry.add_capability(IntCapability('RGB', 8)) # 8 bits per channel
entry.add_capability(StringCapability('query-os-name', os.uname().sysname))
terminfo_parts = list[str]() terminfo_parts = []
for cap in sorted(entry.caps.values()): for cap in sorted(entry.caps.values()):
name = cap.name name = cap.name
value = str(cap.value) value = str(cap.value)
@ -227,4 +210,4 @@ def main() -> None:
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View file

@ -1,10 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import sys
class Codepoint: class Codepoint:
def __init__(self, start: int, end: None | int = None): def __init__(self, start: int, end: None|int = None):
self.start = start self.start = start
self.end = start if end is None else end self.end = start if end is None else end
self.vs15 = False self.vs15 = False
@ -14,7 +15,7 @@ class Codepoint:
return f'{self.start:x}-{self.end:x}, vs15={self.vs15}, vs16={self.vs16}' return f'{self.start:x}-{self.end:x}, vs15={self.vs15}, vs16={self.vs16}'
def main() -> None: def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('input', type=argparse.FileType('r')) parser.add_argument('input', type=argparse.FileType('r'))
parser.add_argument('output', type=argparse.FileType('w')) parser.add_argument('output', type=argparse.FileType('w'))
@ -99,4 +100,4 @@ def main() -> None:
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View file

@ -2,6 +2,7 @@
import argparse import argparse
import math import math
import sys
# Note: we use a pure gamma 2.2 function, rather than the piece-wise # Note: we use a pure gamma 2.2 function, rather than the piece-wise
@ -16,7 +17,7 @@ def linear_to_srgb(f: float) -> float:
return math.pow(f, 1 / 2.2) return math.pow(f, 1 / 2.2)
def main() -> None: def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('c_output', type=argparse.FileType('w')) parser.add_argument('c_output', type=argparse.FileType('w'))
parser.add_argument('h_output', type=argparse.FileType('w')) parser.add_argument('h_output', type=argparse.FileType('w'))
@ -67,4 +68,4 @@ def main() -> None:
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View file

@ -283,13 +283,8 @@ matches_cell(const struct terminal *term, const struct cell *cell, size_t search
if (composed == NULL && base == 0 && term->search.buf[search_ofs] == U' ') if (composed == NULL && base == 0 && term->search.buf[search_ofs] == U' ')
return 1; return 1;
if (hasc32upper(term->search.buf)) { if (c32ncasecmp(&base, &term->search.buf[search_ofs], 1) != 0)
if (c32ncmp(&base, &term->search.buf[search_ofs], 1) != 0) return -1;
return -1;
} else {
if (c32ncasecmp(&base, &term->search.buf[search_ofs], 1) != 0)
return -1;
}
if (composed != NULL) { if (composed != NULL) {
if (search_ofs + composed->count > term->search.len) if (search_ofs + composed->count > term->search.len)
@ -1484,8 +1479,7 @@ search_input(struct seat *seat, struct terminal *term,
count = xkb_compose_state_get_utf8( count = xkb_compose_state_get_utf8(
seat->kbd.xkb_compose_state, (char *)buf, sizeof(buf)); seat->kbd.xkb_compose_state, (char *)buf, sizeof(buf));
xkb_compose_state_reset(seat->kbd.xkb_compose_state); xkb_compose_state_reset(seat->kbd.xkb_compose_state);
} else if (compose_status == XKB_COMPOSE_CANCELLED || } else if (compose_status == XKB_COMPOSE_CANCELLED) {
compose_status == XKB_COMPOSE_COMPOSING) {
count = 0; count = 0;
} else { } else {
count = xkb_state_key_get_utf8( count = xkb_state_key_get_utf8(

View file

@ -19,7 +19,6 @@
#include "char32.h" #include "char32.h"
#include "commands.h" #include "commands.h"
#include "config.h" #include "config.h"
#include "debug.h"
#include "extract.h" #include "extract.h"
#include "grid.h" #include "grid.h"
#include "misc.h" #include "misc.h"
@ -559,15 +558,9 @@ selection_find_quote_left(struct terminal *term, struct coord *pos,
if (*quote_char == '\0' ? (wc == '"' || wc == '\'') if (*quote_char == '\0' ? (wc == '"' || wc == '\'')
: wc == *quote_char) : wc == *quote_char)
{ {
xassert(next_col + 1 <= term->cols); pos->row = next_row;
if (next_col + 1 == term->cols) { pos->col = next_col + 1;
xassert(next_row < pos->row); xassert(pos->col < term->cols);
pos->row = next_row + 1;
pos->col = 0;
} else {
pos->row = next_row;
pos->col = next_col + 1;
}
*quote_char = wc; *quote_char = wc;
return true; return true;

View file

@ -182,11 +182,11 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data)
switch (sigusr.signo) { switch (sigusr.signo) {
case SIGUSR1: case SIGUSR1:
term_theme_switch_to_dark(client->instance->terminal); term_theme_switch_to_1(client->instance->terminal);
break; break;
case SIGUSR2: case SIGUSR2:
term_theme_switch_to_light(client->instance->terminal); term_theme_switch_to_2(client->instance->terminal);
break; break;
default: default:
@ -670,21 +670,21 @@ server_destroy(struct server *server)
} }
void void
server_global_theme_switch_to_dark(struct server *server) server_global_theme_switch_to_1(struct server *server)
{ {
server->conf->initial_color_theme = COLOR_THEME_DARK; server->conf->initial_color_theme = COLOR_THEME1;
tll_foreach(server->clients, it) tll_foreach(server->clients, it)
term_theme_switch_to_dark(it->item->instance->terminal); term_theme_switch_to_1(it->item->instance->terminal);
tll_foreach(server->terminals, it) tll_foreach(server->terminals, it)
term_theme_switch_to_dark(it->item->terminal); term_theme_switch_to_1(it->item->terminal);
} }
void void
server_global_theme_switch_to_light(struct server *server) server_global_theme_switch_to_2(struct server *server)
{ {
server->conf->initial_color_theme = COLOR_THEME_LIGHT; server->conf->initial_color_theme = COLOR_THEME2;
tll_foreach(server->clients, it) tll_foreach(server->clients, it)
term_theme_switch_to_light(it->item->instance->terminal); term_theme_switch_to_2(it->item->instance->terminal);
tll_foreach(server->terminals, it) tll_foreach(server->terminals, it)
term_theme_switch_to_light(it->item->terminal); term_theme_switch_to_2(it->item->terminal);
} }

View file

@ -10,5 +10,5 @@ struct server *server_init(struct config *conf, struct fdm *fdm,
struct reaper *reaper, struct wayland *wayl); struct reaper *reaper, struct wayland *wayl);
void server_destroy(struct server *server); void server_destroy(struct server *server);
void server_global_theme_switch_to_dark(struct server *server); void server_global_theme_switch_to_1(struct server *server);
void server_global_theme_switch_to_light(struct server *server); void server_global_theme_switch_to_2(struct server *server);

94
shm.c
View file

@ -84,6 +84,7 @@ struct buffer_private {
struct buffer_pool *pool; struct buffer_pool *pool;
off_t offset; /* Offset into memfd where data begins */ off_t offset; /* Offset into memfd where data begins */
size_t size; size_t size;
bool with_alpha;
bool scrollable; bool scrollable;
@ -97,8 +98,11 @@ struct buffer_chain {
size_t pix_instances; size_t pix_instances;
bool scrollable; bool scrollable;
pixman_format_code_t pixman_fmt; pixman_format_code_t pixman_fmt_without_alpha;
enum wl_shm_format shm_format; enum wl_shm_format shm_format_without_alpha;
pixman_format_code_t pixman_fmt_with_alpha;
enum wl_shm_format shm_format_with_alpha;
void (*release_cb)(struct buffer *buf, void *data); void (*release_cb)(struct buffer *buf, void *data);
void *cb_data; void *cb_data;
@ -281,7 +285,9 @@ instantiate_offset(struct buffer_private *buf, off_t new_offset)
wl_buf = wl_shm_pool_create_buffer( wl_buf = wl_shm_pool_create_buffer(
pool->wl_pool, new_offset, pool->wl_pool, new_offset,
buf->public.width, buf->public.height, buf->public.stride, buf->public.width, buf->public.height, buf->public.stride,
buf->chain->shm_format); buf->with_alpha
? buf->chain->shm_format_with_alpha
: buf->chain->shm_format_without_alpha);
if (wl_buf == NULL) { if (wl_buf == NULL) {
LOG_ERR("failed to create SHM buffer"); LOG_ERR("failed to create SHM buffer");
@ -291,7 +297,9 @@ instantiate_offset(struct buffer_private *buf, off_t new_offset)
/* One pixman image for each worker thread (do we really need multiple?) */ /* One pixman image for each worker thread (do we really need multiple?) */
for (size_t i = 0; i < buf->public.pix_instances; i++) { for (size_t i = 0; i < buf->public.pix_instances; i++) {
pix[i] = pixman_image_create_bits_no_clear( pix[i] = pixman_image_create_bits_no_clear(
buf->chain->pixman_fmt, buf->with_alpha
? buf->chain->pixman_fmt_with_alpha
: buf->chain->pixman_fmt_without_alpha,
buf->public.width, buf->public.height, buf->public.width, buf->public.height,
(uint32_t *)mmapped, buf->public.stride); (uint32_t *)mmapped, buf->public.stride);
@ -326,7 +334,8 @@ err:
static void NOINLINE static void NOINLINE
get_new_buffers(struct buffer_chain *chain, size_t count, get_new_buffers(struct buffer_chain *chain, size_t count,
int widths[static count], int heights[static count], int widths[static count], int heights[static count],
struct buffer *bufs[static count], bool immediate_purge) struct buffer *bufs[static count], bool with_alpha,
bool immediate_purge)
{ {
xassert(count == 1 || !chain->scrollable); xassert(count == 1 || !chain->scrollable);
/* /*
@ -345,7 +354,10 @@ get_new_buffers(struct buffer_chain *chain, size_t count,
size_t total_size = 0; size_t total_size = 0;
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
stride[i] = stride_for_format_and_width( stride[i] = stride_for_format_and_width(
chain->pixman_fmt, widths[i]); with_alpha
? chain->pixman_fmt_with_alpha
: chain->pixman_fmt_without_alpha,
widths[i]);
if (min_stride_alignment > 0) { if (min_stride_alignment > 0) {
const size_t m = min_stride_alignment; const size_t m = min_stride_alignment;
@ -509,6 +521,7 @@ get_new_buffers(struct buffer_chain *chain, size_t count,
.chain = chain, .chain = chain,
.ref_count = immediate_purge ? 0 : 1, .ref_count = immediate_purge ? 0 : 1,
.busy = true, .busy = true,
.with_alpha = with_alpha,
.pool = pool, .pool = pool,
.offset = 0, .offset = 0,
.size = sizes[i], .size = sizes[i],
@ -580,13 +593,13 @@ shm_did_not_use_buf(struct buffer *_buf)
void void
shm_get_many(struct buffer_chain *chain, size_t count, shm_get_many(struct buffer_chain *chain, size_t count,
int widths[static count], int heights[static count], int widths[static count], int heights[static count],
struct buffer *bufs[static count]) struct buffer *bufs[static count], bool with_alpha)
{ {
get_new_buffers(chain, count, widths, heights, bufs, true); get_new_buffers(chain, count, widths, heights, bufs, with_alpha, true);
} }
struct buffer * struct buffer *
shm_get_buffer(struct buffer_chain *chain, int width, int height) shm_get_buffer(struct buffer_chain *chain, int width, int height, bool with_alpha)
{ {
LOG_DBG( LOG_DBG(
"chain=%p: looking for a reusable %dx%d buffer " "chain=%p: looking for a reusable %dx%d buffer "
@ -597,7 +610,9 @@ shm_get_buffer(struct buffer_chain *chain, int width, int height)
tll_foreach(chain->bufs, it) { tll_foreach(chain->bufs, it) {
struct buffer_private *buf = it->item; struct buffer_private *buf = it->item;
if (buf->public.width != width || buf->public.height != height) { if (buf->public.width != width || buf->public.height != height ||
with_alpha != buf->with_alpha)
{
LOG_DBG("purging mismatching buffer %p", (void *)buf); LOG_DBG("purging mismatching buffer %p", (void *)buf);
if (buffer_unref_no_remove_from_chain(buf)) if (buffer_unref_no_remove_from_chain(buf))
tll_remove(chain->bufs, it); tll_remove(chain->bufs, it);
@ -613,14 +628,14 @@ shm_get_buffer(struct buffer_chain *chain, int width, int height)
else else
#endif #endif
{ {
if (cached == NULL) { if (cached == NULL)
cached = buf; cached = buf;
} else { else {
/* We have multiple buffers eligible for /* We have multiple buffers eligible for
* reuse. Pick the "youngest" one, and mark the * reuse. Pick the "youngest" one, and mark the
* other one for purging */ * other one for purging */
if (buf->public.age < cached->public.age) { if (buf->public.age < cached->public.age) {
shm_unref(&cached->public); //shm_unref(&cached->public);
cached = buf; cached = buf;
} else { } else {
/* /*
@ -631,8 +646,8 @@ shm_get_buffer(struct buffer_chain *chain, int width, int height)
* should be safe; "our" tll_foreach() already * should be safe; "our" tll_foreach() already
* holds the next pointer. * holds the next pointer.
*/ */
if (buffer_unref_no_remove_from_chain(buf)) //if (buffer_unref_no_remove_from_chain(buf))
tll_remove(chain->bufs, it); // tll_remove(chain->bufs, it);
} }
} }
} }
@ -648,7 +663,7 @@ shm_get_buffer(struct buffer_chain *chain, int width, int height)
} }
struct buffer *ret; struct buffer *ret;
get_new_buffers(chain, 1, &width, &height, &ret, false); get_new_buffers(chain, 1, &width, &height, &ret, with_alpha, false);
return ret; return ret;
} }
@ -994,8 +1009,11 @@ shm_chain_new(struct wayland *wayl, bool scrollable, size_t pix_instances,
enum shm_bit_depth desired_bit_depth, enum shm_bit_depth desired_bit_depth,
void (*release_cb)(struct buffer *buf, void *data), void *cb_data) void (*release_cb)(struct buffer *buf, void *data), void *cb_data)
{ {
pixman_format_code_t pixman_fmt = PIXMAN_a8r8g8b8; pixman_format_code_t pixman_fmt_without_alpha = PIXMAN_x8r8g8b8;
enum wl_shm_format shm_fmt = WL_SHM_FORMAT_ARGB8888; enum wl_shm_format shm_fmt_without_alpha = WL_SHM_FORMAT_XRGB8888;
pixman_format_code_t pixman_fmt_with_alpha = PIXMAN_a8r8g8b8;
enum wl_shm_format shm_fmt_with_alpha = WL_SHM_FORMAT_ARGB8888;
static bool have_logged = false; static bool have_logged = false;
static bool have_logged_10_fallback = false; static bool have_logged_10_fallback = false;
@ -1004,9 +1022,12 @@ shm_chain_new(struct wayland *wayl, bool scrollable, size_t pix_instances,
static bool have_logged_16_fallback = false; static bool have_logged_16_fallback = false;
if (desired_bit_depth == SHM_BITS_16) { if (desired_bit_depth == SHM_BITS_16) {
if (wayl->shm_have_abgr161616) { if (wayl->shm_have_abgr161616 && wayl->shm_have_xbgr161616) {
pixman_fmt = PIXMAN_a16b16g16r16; pixman_fmt_without_alpha = PIXMAN_a16b16g16r16;
shm_fmt = WL_SHM_FORMAT_ABGR16161616; shm_fmt_without_alpha = WL_SHM_FORMAT_XBGR16161616;
pixman_fmt_with_alpha = PIXMAN_a16b16g16r16;
shm_fmt_with_alpha = WL_SHM_FORMAT_ABGR16161616;
if (!have_logged) { if (!have_logged) {
have_logged = true; have_logged = true;
@ -1024,10 +1045,15 @@ shm_chain_new(struct wayland *wayl, bool scrollable, size_t pix_instances,
} }
#endif #endif
if (desired_bit_depth >= SHM_BITS_10 && pixman_fmt == PIXMAN_a8r8g8b8) { if (desired_bit_depth >= SHM_BITS_10 &&
if (wayl->shm_have_argb2101010) { pixman_fmt_with_alpha == PIXMAN_a8r8g8b8)
pixman_fmt = PIXMAN_a2r10g10b10; {
shm_fmt = WL_SHM_FORMAT_ARGB2101010; if (wayl->shm_have_argb2101010 && wayl->shm_have_xrgb2101010) {
pixman_fmt_without_alpha = PIXMAN_x2r10g10b10;
shm_fmt_without_alpha = WL_SHM_FORMAT_XRGB2101010;
pixman_fmt_with_alpha = PIXMAN_a2r10g10b10;
shm_fmt_with_alpha = WL_SHM_FORMAT_ARGB2101010;
if (!have_logged) { if (!have_logged) {
have_logged = true; have_logged = true;
@ -1035,9 +1061,12 @@ shm_chain_new(struct wayland *wayl, bool scrollable, size_t pix_instances,
} }
} }
else if (wayl->shm_have_abgr2101010) { else if (wayl->shm_have_abgr2101010 && wayl->shm_have_xbgr2101010) {
pixman_fmt = PIXMAN_a2b10g10r10; pixman_fmt_without_alpha = PIXMAN_x2b10g10r10;
shm_fmt = WL_SHM_FORMAT_ABGR2101010; shm_fmt_without_alpha = WL_SHM_FORMAT_XBGR2101010;
pixman_fmt_with_alpha = PIXMAN_a2b10g10r10;
shm_fmt_with_alpha = WL_SHM_FORMAT_ABGR2101010;
if (!have_logged) { if (!have_logged) {
have_logged = true; have_logged = true;
@ -1069,8 +1098,11 @@ shm_chain_new(struct wayland *wayl, bool scrollable, size_t pix_instances,
.pix_instances = pix_instances, .pix_instances = pix_instances,
.scrollable = scrollable, .scrollable = scrollable,
.pixman_fmt = pixman_fmt, .pixman_fmt_without_alpha = pixman_fmt_without_alpha,
.shm_format = shm_fmt, .shm_format_without_alpha = shm_fmt_without_alpha,
.pixman_fmt_with_alpha = pixman_fmt_with_alpha,
.shm_format_with_alpha = shm_fmt_with_alpha,
.release_cb = release_cb, .release_cb = release_cb,
.cb_data = cb_data, .cb_data = cb_data,
@ -1097,7 +1129,7 @@ shm_chain_free(struct buffer_chain *chain)
enum shm_bit_depth enum shm_bit_depth
shm_chain_bit_depth(const struct buffer_chain *chain) shm_chain_bit_depth(const struct buffer_chain *chain)
{ {
const pixman_format_code_t fmt = chain->pixman_fmt; const pixman_format_code_t fmt = chain->pixman_fmt_with_alpha;
return fmt == PIXMAN_a8r8g8b8 return fmt == PIXMAN_a8r8g8b8
? SHM_BITS_8 ? SHM_BITS_8

5
shm.h
View file

@ -65,7 +65,8 @@ enum shm_bit_depth shm_chain_bit_depth(const struct buffer_chain *chain);
* *
* A newly allocated buffer has an age of 1234. * A newly allocated buffer has an age of 1234.
*/ */
struct buffer *shm_get_buffer(struct buffer_chain *chain, int width, int height); struct buffer *shm_get_buffer(
struct buffer_chain *chain, int width, int height, bool with_alpha);
/* /*
* Returns many buffers, described by 'info', all sharing the same SHM * Returns many buffers, described by 'info', all sharing the same SHM
* buffer pool. * buffer pool.
@ -83,7 +84,7 @@ struct buffer *shm_get_buffer(struct buffer_chain *chain, int width, int height)
void shm_get_many( void shm_get_many(
struct buffer_chain *chain, size_t count, struct buffer_chain *chain, size_t count,
int widths[static count], int heights[static count], int widths[static count], int heights[static count],
struct buffer *bufs[static count]); struct buffer *bufs[static count], bool with_alpha);
void shm_did_not_use_buf(struct buffer *buf); void shm_did_not_use_buf(struct buffer *buf);

13
sixel.c
View file

@ -125,19 +125,19 @@ sixel_init(struct terminal *term, int p1, int p2, int p3)
* that assumes 32-bit pixels). * that assumes 32-bit pixels).
*/ */
if (shm_chain_bit_depth(term->render.chains.grid) >= SHM_BITS_10) { if (shm_chain_bit_depth(term->render.chains.grid) >= SHM_BITS_10) {
if (term->wl->shm_have_argb2101010) { if (term->wl->shm_have_argb2101010 && term->wl->shm_have_xrgb2101010) {
term->sixel.use_10bit = true; term->sixel.use_10bit = true;
term->sixel.pixman_fmt = PIXMAN_a2r10g10b10; term->sixel.pixman_fmt = PIXMAN_a2r10g10b10;
} }
else if (term->wl->shm_have_abgr2101010) { else if (term->wl->shm_have_abgr2101010 && term->wl->shm_have_xbgr2101010) {
term->sixel.use_10bit = true; term->sixel.use_10bit = true;
term->sixel.pixman_fmt = PIXMAN_a2b10g10r10; term->sixel.pixman_fmt = PIXMAN_a2b10g10r10;
} }
} }
const size_t active_palette_entries = min( const size_t active_palette_entries = min(
ALEN(term->conf->colors_dark.sixel), term->sixel.palette_size); ALEN(term->conf->colors.sixel), term->sixel.palette_size);
if (term->sixel.use_private_palette) { if (term->sixel.use_private_palette) {
xassert(term->sixel.private_palette == NULL); xassert(term->sixel.private_palette == NULL);
@ -145,7 +145,7 @@ sixel_init(struct terminal *term, int p1, int p2, int p3)
term->sixel.palette_size, sizeof(term->sixel.private_palette[0])); term->sixel.palette_size, sizeof(term->sixel.private_palette[0]));
memcpy( memcpy(
term->sixel.private_palette, term->conf->colors_dark.sixel, term->sixel.private_palette, term->conf->colors.sixel,
active_palette_entries * sizeof(term->sixel.private_palette[0])); active_palette_entries * sizeof(term->sixel.private_palette[0]));
if (term->sixel.linear_blending || term->sixel.use_10bit) { if (term->sixel.linear_blending || term->sixel.use_10bit) {
@ -164,7 +164,7 @@ sixel_init(struct terminal *term, int p1, int p2, int p3)
term->sixel.palette_size, sizeof(term->sixel.shared_palette[0])); term->sixel.palette_size, sizeof(term->sixel.shared_palette[0]));
memcpy( memcpy(
term->sixel.shared_palette, term->conf->colors_dark.sixel, term->sixel.shared_palette, term->conf->colors.sixel,
active_palette_entries * sizeof(term->sixel.shared_palette[0])); active_palette_entries * sizeof(term->sixel.shared_palette[0]));
if (term->sixel.linear_blending || term->sixel.use_10bit) { if (term->sixel.linear_blending || term->sixel.use_10bit) {
@ -1559,9 +1559,6 @@ resize(struct terminal *term, int new_width_mutable, int new_height_mutable)
new_height_mutable = term->sixel.max_height; new_height_mutable = term->sixel.max_height;
} }
if (unlikely(new_height_mutable == 0)) {
new_height_mutable = 6 * term->sixel.pan;
}
uint32_t *old_data = term->sixel.image.data; uint32_t *old_data = term->sixel.image.data;
const int old_width = term->sixel.image.width; const int old_width = term->sixel.image.width;

View file

@ -1271,10 +1271,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
const struct color_theme *theme = NULL; const struct color_theme *theme = NULL;
switch (conf->initial_color_theme) { switch (conf->initial_color_theme) {
case COLOR_THEME_DARK: theme = &conf->colors_dark; break; case COLOR_THEME1: theme = &conf->colors; break;
case COLOR_THEME_LIGHT: theme = &conf->colors_light; break; case COLOR_THEME2: theme = &conf->colors2; break;
case COLOR_THEME_1: BUG("COLOR_THEME_1 should not be used"); break;
case COLOR_THEME_2: BUG("COLOR_THEME_2 should not be used"); break;
} }
/* Initialize configure-based terminal attributes */ /* Initialize configure-based terminal attributes */
@ -2179,10 +2177,8 @@ term_reset(struct terminal *term, bool hard)
const struct color_theme *theme = NULL; const struct color_theme *theme = NULL;
switch (term->conf->initial_color_theme) { switch (term->conf->initial_color_theme) {
case COLOR_THEME_DARK: theme = &term->conf->colors_dark; break; case COLOR_THEME1: theme = &term->conf->colors; break;
case COLOR_THEME_LIGHT: theme = &term->conf->colors_light; break; case COLOR_THEME2: theme = &term->conf->colors2; break;
case COLOR_THEME_1: BUG("COLOR_THEME_1 should not be used"); break;
case COLOR_THEME_2: BUG("COLOR_THEME_2 should not be used"); break;
} }
term->flash.active = false; term->flash.active = false;
@ -3169,17 +3165,11 @@ term_scroll_reverse_partial(struct terminal *term,
sixel_scroll_down(term, rows); sixel_scroll_down(term, rows);
const bool view_follows = term->grid->view == term->grid->offset; bool view_follows = term->grid->view == term->grid->offset;
term->grid->offset -= rows; term->grid->offset -= rows;
term->grid->offset += term->grid->num_rows; term->grid->offset += term->grid->num_rows;
term->grid->offset &= term->grid->num_rows - 1; term->grid->offset &= term->grid->num_rows - 1;
/* How many lines from the scrollback start is the current viewport? */
const int view_sb_start_distance = grid_row_abs_to_sb(
term->grid, term->rows, term->grid->view);
const int offset_sb_start_distance = grid_row_abs_to_sb(
term->grid, term->rows, term->grid->offset);
xassert(term->grid->offset >= 0); xassert(term->grid->offset >= 0);
xassert(term->grid->offset < term->grid->num_rows); xassert(term->grid->offset < term->grid->num_rows);
@ -3187,11 +3177,6 @@ term_scroll_reverse_partial(struct terminal *term,
term_damage_scroll(term, DAMAGE_SCROLL_REVERSE, region, rows); term_damage_scroll(term, DAMAGE_SCROLL_REVERSE, region, rows);
selection_view_up(term, term->grid->offset); selection_view_up(term, term->grid->offset);
term->grid->view = term->grid->offset; term->grid->view = term->grid->offset;
} else if (unlikely(view_sb_start_distance > offset_sb_start_distance)) {
/* Part of current view is being scrolled out */
int new_view = term->grid->offset;
selection_view_up(term, new_view);
term->grid->view = new_view;
} }
/* Bottom non-scrolling region */ /* Bottom non-scrolling region */
@ -3208,16 +3193,11 @@ term_scroll_reverse_partial(struct terminal *term,
erase_line(term, row); erase_line(term, row);
} }
if (unlikely(view_sb_start_distance > offset_sb_start_distance))
term_damage_view(term);
term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row); term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row);
#if defined(_DEBUG) #if defined(_DEBUG)
for (int r = 0; r < term->rows; r++) for (int r = 0; r < term->rows; r++)
xassert(grid_row(term->grid, r) != NULL); xassert(grid_row(term->grid, r) != NULL);
for (int r = 0; r < term->rows; r++)
xassert(grid_row_in_view(term->grid, r) != NULL);
#endif #endif
} }
@ -3424,13 +3404,10 @@ report_mouse_click(struct terminal *term, int encoded_button, int row, int col,
encoded_button, col + 1, row + 1, release ? 'm' : 'M'); encoded_button, col + 1, row + 1, release ? 'm' : 'M');
break; break;
case MOUSE_SGR_PIXELS: { case MOUSE_SGR_PIXELS:
const int bounded_col = max(col_pixels, 0);
const int bounded_row = max(row_pixels, 0);
snprintf(response, sizeof(response), "\033[<%d;%d;%d%c", snprintf(response, sizeof(response), "\033[<%d;%d;%d%c",
encoded_button, bounded_col + 1, bounded_row + 1, release ? 'm' : 'M'); encoded_button, col_pixels + 1, row_pixels + 1, release ? 'm' : 'M');
break; break;
}
case MOUSE_URXVT: case MOUSE_URXVT:
snprintf(response, sizeof(response), "\033[%d;%d;%dM", snprintf(response, sizeof(response), "\033[%d;%d;%dM",
@ -4746,13 +4723,13 @@ term_send_size_notification(struct terminal *term)
} }
void void
term_theme_switch_to_dark(struct terminal *term) term_theme_switch_to_1(struct terminal *term)
{ {
if (term->colors.active_theme == COLOR_THEME_DARK) if (term->colors.active_theme == COLOR_THEME1)
return; return;
term_theme_apply(term, &term->conf->colors_dark); term_theme_apply(term, &term->conf->colors);
term->colors.active_theme = COLOR_THEME_DARK; term->colors.active_theme = COLOR_THEME1;
wayl_win_alpha_changed(term->window); wayl_win_alpha_changed(term->window);
term_font_subpixel_changed(term); term_font_subpixel_changed(term);
@ -4766,13 +4743,13 @@ term_theme_switch_to_dark(struct terminal *term)
} }
void void
term_theme_switch_to_light(struct terminal *term) term_theme_switch_to_2(struct terminal *term)
{ {
if (term->colors.active_theme == COLOR_THEME_LIGHT) if (term->colors.active_theme == COLOR_THEME2)
return; return;
term_theme_apply(term, &term->conf->colors_light); term_theme_apply(term, &term->conf->colors2);
term->colors.active_theme = COLOR_THEME_LIGHT; term->colors.active_theme = COLOR_THEME2;
wayl_win_alpha_changed(term->window); wayl_win_alpha_changed(term->window);
term_font_subpixel_changed(term); term_font_subpixel_changed(term);
@ -4788,15 +4765,15 @@ term_theme_switch_to_light(struct terminal *term)
void void
term_theme_toggle(struct terminal *term) term_theme_toggle(struct terminal *term)
{ {
if (term->colors.active_theme == COLOR_THEME_DARK) { if (term->colors.active_theme == COLOR_THEME1) {
term_theme_apply(term, &term->conf->colors_light); term_theme_apply(term, &term->conf->colors2);
term->colors.active_theme = COLOR_THEME_LIGHT; term->colors.active_theme = COLOR_THEME2;
if (term->report_theme_changes) if (term->report_theme_changes)
term_to_slave(term, "\033[?997;2n", 9); term_to_slave(term, "\033[?997;2n", 9);
} else { } else {
term_theme_apply(term, &term->conf->colors_dark); term_theme_apply(term, &term->conf->colors);
term->colors.active_theme = COLOR_THEME_DARK; term->colors.active_theme = COLOR_THEME1;
if (term->report_theme_changes) if (term->report_theme_changes)
term_to_slave(term, "\033[?997;1n", 9); term_to_slave(term, "\033[?997;1n", 9);

View file

@ -994,8 +994,8 @@ void term_enable_size_notifications(struct terminal *term);
void term_disable_size_notifications(struct terminal *term); void term_disable_size_notifications(struct terminal *term);
void term_send_size_notification(struct terminal *term); void term_send_size_notification(struct terminal *term);
void term_theme_switch_to_dark(struct terminal *term); void term_theme_switch_to_1(struct terminal *term);
void term_theme_switch_to_light(struct terminal *term); void term_theme_switch_to_2(struct terminal *term);
void term_theme_toggle(struct terminal *term); void term_theme_toggle(struct terminal *term);
static inline void term_reset_grapheme_state(struct terminal *term) static inline void term_reset_grapheme_state(struct terminal *term)

View file

@ -482,7 +482,6 @@ test_section_main(void)
test_string(&ctx, &parse_section_main, "shell", &conf.shell); test_string(&ctx, &parse_section_main, "shell", &conf.shell);
test_string(&ctx, &parse_section_main, "term", &conf.term); test_string(&ctx, &parse_section_main, "term", &conf.term);
test_string(&ctx, &parse_section_main, "app-id", &conf.app_id); test_string(&ctx, &parse_section_main, "app-id", &conf.app_id);
test_string(&ctx, &parse_section_main, "toplevel-tag", &conf.toplevel_tag);
test_string(&ctx, &parse_section_main, "utmp-helper", &conf.utmp_helper_path); test_string(&ctx, &parse_section_main, "utmp-helper", &conf.utmp_helper_path);
test_c32string(&ctx, &parse_section_main, "word-delimiters", &conf.word_delimiters); test_c32string(&ctx, &parse_section_main, "word-delimiters", &conf.word_delimiters);
@ -521,14 +520,6 @@ test_section_main(void)
(int []){STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN}, (int []){STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN},
(int *)&conf.startup_mode); (int *)&conf.startup_mode);
test_enum(
&ctx, &parse_section_main, "initial-color-theme",
2,
(const char *[]){"dark", "light", "1", "2"},
(int []){COLOR_THEME_DARK, COLOR_THEME_LIGHT,
COLOR_THEME_DARK, COLOR_THEME_LIGHT},
(int *)&conf.initial_color_theme);
/* TODO: font (custom) */ /* TODO: font (custom) */
/* TODO: include (custom) */ /* TODO: include (custom) */
/* TODO: bold-text-in-bright (enum/boolean) */ /* TODO: bold-text-in-bright (enum/boolean) */
@ -703,157 +694,78 @@ test_section_touch(void)
} }
static void static void
test_section_colors_dark(void) test_section_colors(void)
{ {
struct config conf = {0}; struct config conf = {0};
struct context ctx = { struct context ctx = {
.conf = &conf, .section = "colors-dark", .path = "unittest"}; .conf = &conf, .section = "colors", .path = "unittest"};
test_invalid_key(&ctx, &parse_section_colors, "invalid-key"); test_invalid_key(&ctx, &parse_section_colors, "invalid-key");
test_color(&ctx, &parse_section_colors_dark, "foreground", false, &conf.colors_dark.fg); test_color(&ctx, &parse_section_colors, "foreground", false, &conf.colors.fg);
test_color(&ctx, &parse_section_colors_dark, "background", false, &conf.colors_dark.bg); test_color(&ctx, &parse_section_colors, "background", false, &conf.colors.bg);
test_color(&ctx, &parse_section_colors_dark, "regular0", false, &conf.colors_dark.table[0]); test_color(&ctx, &parse_section_colors, "regular0", false, &conf.colors.table[0]);
test_color(&ctx, &parse_section_colors_dark, "regular1", false, &conf.colors_dark.table[1]); test_color(&ctx, &parse_section_colors, "regular1", false, &conf.colors.table[1]);
test_color(&ctx, &parse_section_colors_dark, "regular2", false, &conf.colors_dark.table[2]); test_color(&ctx, &parse_section_colors, "regular2", false, &conf.colors.table[2]);
test_color(&ctx, &parse_section_colors_dark, "regular3", false, &conf.colors_dark.table[3]); test_color(&ctx, &parse_section_colors, "regular3", false, &conf.colors.table[3]);
test_color(&ctx, &parse_section_colors_dark, "regular4", false, &conf.colors_dark.table[4]); test_color(&ctx, &parse_section_colors, "regular4", false, &conf.colors.table[4]);
test_color(&ctx, &parse_section_colors_dark, "regular5", false, &conf.colors_dark.table[5]); test_color(&ctx, &parse_section_colors, "regular5", false, &conf.colors.table[5]);
test_color(&ctx, &parse_section_colors_dark, "regular6", false, &conf.colors_dark.table[6]); test_color(&ctx, &parse_section_colors, "regular6", false, &conf.colors.table[6]);
test_color(&ctx, &parse_section_colors_dark, "regular7", false, &conf.colors_dark.table[7]); test_color(&ctx, &parse_section_colors, "regular7", false, &conf.colors.table[7]);
test_color(&ctx, &parse_section_colors_dark, "bright0", false, &conf.colors_dark.table[8]); test_color(&ctx, &parse_section_colors, "bright0", false, &conf.colors.table[8]);
test_color(&ctx, &parse_section_colors_dark, "bright1", false, &conf.colors_dark.table[9]); test_color(&ctx, &parse_section_colors, "bright1", false, &conf.colors.table[9]);
test_color(&ctx, &parse_section_colors_dark, "bright2", false, &conf.colors_dark.table[10]); test_color(&ctx, &parse_section_colors, "bright2", false, &conf.colors.table[10]);
test_color(&ctx, &parse_section_colors_dark, "bright3", false, &conf.colors_dark.table[11]); test_color(&ctx, &parse_section_colors, "bright3", false, &conf.colors.table[11]);
test_color(&ctx, &parse_section_colors_dark, "bright4", false, &conf.colors_dark.table[12]); test_color(&ctx, &parse_section_colors, "bright4", false, &conf.colors.table[12]);
test_color(&ctx, &parse_section_colors_dark, "bright5", false, &conf.colors_dark.table[13]); test_color(&ctx, &parse_section_colors, "bright5", false, &conf.colors.table[13]);
test_color(&ctx, &parse_section_colors_dark, "bright6", false, &conf.colors_dark.table[14]); test_color(&ctx, &parse_section_colors, "bright6", false, &conf.colors.table[14]);
test_color(&ctx, &parse_section_colors_dark, "bright7", false, &conf.colors_dark.table[15]); test_color(&ctx, &parse_section_colors, "bright7", false, &conf.colors.table[15]);
test_color(&ctx, &parse_section_colors_dark, "dim0", false, &conf.colors_dark.dim[0]); test_color(&ctx, &parse_section_colors, "dim0", false, &conf.colors.dim[0]);
test_color(&ctx, &parse_section_colors_dark, "dim1", false, &conf.colors_dark.dim[1]); test_color(&ctx, &parse_section_colors, "dim1", false, &conf.colors.dim[1]);
test_color(&ctx, &parse_section_colors_dark, "dim2", false, &conf.colors_dark.dim[2]); test_color(&ctx, &parse_section_colors, "dim2", false, &conf.colors.dim[2]);
test_color(&ctx, &parse_section_colors_dark, "dim3", false, &conf.colors_dark.dim[3]); test_color(&ctx, &parse_section_colors, "dim3", false, &conf.colors.dim[3]);
test_color(&ctx, &parse_section_colors_dark, "dim4", false, &conf.colors_dark.dim[4]); test_color(&ctx, &parse_section_colors, "dim4", false, &conf.colors.dim[4]);
test_color(&ctx, &parse_section_colors_dark, "dim5", false, &conf.colors_dark.dim[5]); test_color(&ctx, &parse_section_colors, "dim5", false, &conf.colors.dim[5]);
test_color(&ctx, &parse_section_colors_dark, "dim6", false, &conf.colors_dark.dim[6]); test_color(&ctx, &parse_section_colors, "dim6", false, &conf.colors.dim[6]);
test_color(&ctx, &parse_section_colors_dark, "dim7", false, &conf.colors_dark.dim[7]); test_color(&ctx, &parse_section_colors, "dim7", false, &conf.colors.dim[7]);
test_color(&ctx, &parse_section_colors_dark, "selection-foreground", false, &conf.colors_dark.selection_fg); test_color(&ctx, &parse_section_colors, "selection-foreground", false, &conf.colors.selection_fg);
test_color(&ctx, &parse_section_colors_dark, "selection-background", false, &conf.colors_dark.selection_bg); test_color(&ctx, &parse_section_colors, "selection-background", false, &conf.colors.selection_bg);
test_color(&ctx, &parse_section_colors_dark, "urls", false, &conf.colors_dark.url); test_color(&ctx, &parse_section_colors, "urls", false, &conf.colors.url);
test_two_colors(&ctx, &parse_section_colors_dark, "jump-labels", false, test_two_colors(&ctx, &parse_section_colors, "jump-labels", false,
&conf.colors_dark.jump_label.fg, &conf.colors.jump_label.fg,
&conf.colors_dark.jump_label.bg); &conf.colors.jump_label.bg);
test_two_colors(&ctx, &parse_section_colors_dark, "scrollback-indicator", false, test_two_colors(&ctx, &parse_section_colors, "scrollback-indicator", false,
&conf.colors_dark.scrollback_indicator.fg, &conf.colors.scrollback_indicator.fg,
&conf.colors_dark.scrollback_indicator.bg); &conf.colors.scrollback_indicator.bg);
test_two_colors(&ctx, &parse_section_colors_dark, "search-box-no-match", false, test_two_colors(&ctx, &parse_section_colors, "search-box-no-match", false,
&conf.colors_dark.search_box.no_match.fg, &conf.colors.search_box.no_match.fg,
&conf.colors_dark.search_box.no_match.bg); &conf.colors.search_box.no_match.bg);
test_two_colors(&ctx, &parse_section_colors_dark, "search-box-match", false, test_two_colors(&ctx, &parse_section_colors, "search-box-match", false,
&conf.colors_dark.search_box.match.fg, &conf.colors.search_box.match.fg,
&conf.colors_dark.search_box.match.bg); &conf.colors.search_box.match.bg);
test_two_colors(&ctx, &parse_section_colors_dark, "cursor", false, test_two_colors(&ctx, &parse_section_colors, "cursor", false,
&conf.colors_dark.cursor.text, &conf.colors.cursor.text,
&conf.colors_dark.cursor.cursor); &conf.colors.cursor.cursor);
test_enum(&ctx, &parse_section_colors_dark, "alpha-mode", 3, test_enum(&ctx, &parse_section_colors, "alpha-mode", 3,
(const char *[]){"default", "matching", "all"}, (const char *[]){"default", "matching", "all"},
(int []){ALPHA_MODE_DEFAULT, ALPHA_MODE_MATCHING, ALPHA_MODE_ALL}, (int []){ALPHA_MODE_DEFAULT, ALPHA_MODE_MATCHING, ALPHA_MODE_ALL},
(int *)&conf.colors_dark.alpha_mode); (int *)&conf.colors.alpha_mode);
test_enum(&ctx, &parse_section_colors_dark, "dim-blend-towards", 2, test_enum(&ctx, &parse_section_colors, "dim-blend-towards", 2,
(const char *[]){"black", "white"}, (const char *[]){"black", "white"},
(int []){DIM_BLEND_TOWARDS_BLACK, DIM_BLEND_TOWARDS_WHITE}, (int []){DIM_BLEND_TOWARDS_BLACK, DIM_BLEND_TOWARDS_WHITE},
(int *)&conf.colors_dark.dim_blend_towards); (int *)&conf.colors.dim_blend_towards);
for (size_t i = 0; i < 255; i++) { for (size_t i = 0; i < 255; i++) {
char key_name[4]; char key_name[4];
sprintf(key_name, "%zu", i); sprintf(key_name, "%zu", i);
test_color(&ctx, &parse_section_colors_dark, key_name, false, test_color(&ctx, &parse_section_colors, key_name, false,
&conf.colors_dark.table[i]); &conf.colors.table[i]);
} }
test_invalid_key(&ctx, &parse_section_colors_dark, "256"); test_invalid_key(&ctx, &parse_section_colors, "256");
/* TODO: alpha (float in range 0-1, converted to uint16_t) */
config_free(&conf);
}
static void
test_section_colors_light(void)
{
struct config conf = {0};
struct context ctx = {
.conf = &conf, .section = "colors-light", .path = "unittest"};
test_invalid_key(&ctx, &parse_section_colors, "invalid-key");
test_color(&ctx, &parse_section_colors_light, "foreground", false, &conf.colors_light.fg);
test_color(&ctx, &parse_section_colors_light, "background", false, &conf.colors_light.bg);
test_color(&ctx, &parse_section_colors_light, "regular0", false, &conf.colors_light.table[0]);
test_color(&ctx, &parse_section_colors_light, "regular1", false, &conf.colors_light.table[1]);
test_color(&ctx, &parse_section_colors_light, "regular2", false, &conf.colors_light.table[2]);
test_color(&ctx, &parse_section_colors_light, "regular3", false, &conf.colors_light.table[3]);
test_color(&ctx, &parse_section_colors_light, "regular4", false, &conf.colors_light.table[4]);
test_color(&ctx, &parse_section_colors_light, "regular5", false, &conf.colors_light.table[5]);
test_color(&ctx, &parse_section_colors_light, "regular6", false, &conf.colors_light.table[6]);
test_color(&ctx, &parse_section_colors_light, "regular7", false, &conf.colors_light.table[7]);
test_color(&ctx, &parse_section_colors_light, "bright0", false, &conf.colors_light.table[8]);
test_color(&ctx, &parse_section_colors_light, "bright1", false, &conf.colors_light.table[9]);
test_color(&ctx, &parse_section_colors_light, "bright2", false, &conf.colors_light.table[10]);
test_color(&ctx, &parse_section_colors_light, "bright3", false, &conf.colors_light.table[11]);
test_color(&ctx, &parse_section_colors_light, "bright4", false, &conf.colors_light.table[12]);
test_color(&ctx, &parse_section_colors_light, "bright5", false, &conf.colors_light.table[13]);
test_color(&ctx, &parse_section_colors_light, "bright6", false, &conf.colors_light.table[14]);
test_color(&ctx, &parse_section_colors_light, "bright7", false, &conf.colors_light.table[15]);
test_color(&ctx, &parse_section_colors_light, "dim0", false, &conf.colors_light.dim[0]);
test_color(&ctx, &parse_section_colors_light, "dim1", false, &conf.colors_light.dim[1]);
test_color(&ctx, &parse_section_colors_light, "dim2", false, &conf.colors_light.dim[2]);
test_color(&ctx, &parse_section_colors_light, "dim3", false, &conf.colors_light.dim[3]);
test_color(&ctx, &parse_section_colors_light, "dim4", false, &conf.colors_light.dim[4]);
test_color(&ctx, &parse_section_colors_light, "dim5", false, &conf.colors_light.dim[5]);
test_color(&ctx, &parse_section_colors_light, "dim6", false, &conf.colors_light.dim[6]);
test_color(&ctx, &parse_section_colors_light, "dim7", false, &conf.colors_light.dim[7]);
test_color(&ctx, &parse_section_colors_light, "selection-foreground", false, &conf.colors_light.selection_fg);
test_color(&ctx, &parse_section_colors_light, "selection-background", false, &conf.colors_light.selection_bg);
test_color(&ctx, &parse_section_colors_light, "urls", false, &conf.colors_light.url);
test_two_colors(&ctx, &parse_section_colors_light, "jump-labels", false,
&conf.colors_light.jump_label.fg,
&conf.colors_light.jump_label.bg);
test_two_colors(&ctx, &parse_section_colors_light, "scrollback-indicator", false,
&conf.colors_light.scrollback_indicator.fg,
&conf.colors_light.scrollback_indicator.bg);
test_two_colors(&ctx, &parse_section_colors_light, "search-box-no-match", false,
&conf.colors_light.search_box.no_match.fg,
&conf.colors_light.search_box.no_match.bg);
test_two_colors(&ctx, &parse_section_colors_light, "search-box-match", false,
&conf.colors_light.search_box.match.fg,
&conf.colors_light.search_box.match.bg);
test_two_colors(&ctx, &parse_section_colors_light, "cursor", false,
&conf.colors_light.cursor.text,
&conf.colors_light.cursor.cursor);
test_enum(&ctx, &parse_section_colors_light, "alpha-mode", 3,
(const char *[]){"default", "matching", "all"},
(int []){ALPHA_MODE_DEFAULT, ALPHA_MODE_MATCHING, ALPHA_MODE_ALL},
(int *)&conf.colors_light.alpha_mode);
test_enum(&ctx, &parse_section_colors_light, "dim-blend-towards", 2,
(const char *[]){"black", "white"},
(int []){DIM_BLEND_TOWARDS_BLACK, DIM_BLEND_TOWARDS_WHITE},
(int *)&conf.colors_light.dim_blend_towards);
for (size_t i = 0; i < 255; i++) {
char key_name[4];
sprintf(key_name, "%zu", i);
test_color(&ctx, &parse_section_colors_light, key_name, false,
&conf.colors_light.table[i]);
}
test_invalid_key(&ctx, &parse_section_colors_light, "256");
/* TODO: alpha (float in range 0-1, converted to uint16_t) */ /* TODO: alpha (float in range 0-1, converted to uint16_t) */
@ -1531,8 +1443,7 @@ main(int argc, const char *const *argv)
test_section_cursor(); test_section_cursor();
test_section_mouse(); test_section_mouse();
test_section_touch(); test_section_touch();
test_section_colors_dark(); test_section_colors();
test_section_colors_light();
test_section_csd(); test_section_csd();
test_section_key_bindings(); test_section_key_bindings();
test_section_key_bindings_collisions(); test_section_key_bindings_collisions();

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Aero root theme # Aero root theme
[colors-dark] [colors]
cursor=1a1a1a 9fd5f5 cursor=1a1a1a 9fd5f5
foreground=dedeef foreground=dedeef
background=1a1a1a background=1a1a1a

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Alacritty # Alacritty
[colors-dark] [colors]
cursor = 181818 56d8c9 cursor = 181818 56d8c9
background= 181818 background= 181818
foreground= d8d8d8 foreground= d8d8d8

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# https://github.com/romainl/Apprentice # https://github.com/romainl/Apprentice
[colors-dark] [colors]
cursor=262626 6c6c6c cursor=262626 6c6c6c
foreground=bcbcbc foreground=bcbcbc
background=262626 background=262626

View file

@ -2,7 +2,7 @@
# theme: Ayu Mirage # theme: Ayu Mirage
# description: a theme based on Ayu Mirage for Sublime Text (original: https://github.com/dempfi/ayu) # description: a theme based on Ayu Mirage for Sublime Text (original: https://github.com/dempfi/ayu)
[colors-dark] [colors]
cursor = ffcc66 665a44 cursor = ffcc66 665a44
foreground = cccac2 foreground = cccac2
background = 242936 background = 242936

View file

@ -1,7 +1,7 @@
# _*_ conf _*_ # _*_ conf _*_
# Catppuccin Frappe # Catppuccin Frappe
[colors-dark] [colors]
foreground=c6d0f5 foreground=c6d0f5
background=303446 background=303446

View file

@ -1,10 +1,7 @@
# _*_ conf _*_ # _*_ conf _*_
# Catppuccin Latte # Catppuccin Latte
[main] [colors]
initial-color-theme=light
[colors-light]
foreground=4c4f69 foreground=4c4f69
background=eff1f5 background=eff1f5

View file

@ -1,7 +1,7 @@
# _*_ conf _*_ # _*_ conf _*_
# Catppuccin Macchiato # Catppuccin Macchiato
[colors-dark] [colors]
foreground=cad3f5 foreground=cad3f5
background=24273a background=24273a

View file

@ -1,7 +1,7 @@
# _*_ conf _*_ # _*_ conf _*_
# Catppuccin Mocha # Catppuccin Mocha
[colors-dark] [colors]
foreground=cdd6f4 foreground=cdd6f4
background=1e1e2e background=1e1e2e

View file

@ -3,7 +3,7 @@
# author: ayushnix (https://sr.ht/~ayushnix) # author: ayushnix (https://sr.ht/~ayushnix)
# description: A dark theme with bright cyberpunk colors (WCAG AAA compliant) # description: A dark theme with bright cyberpunk colors (WCAG AAA compliant)
[colors-dark] [colors]
cursor = 181818 cdcdcd cursor = 181818 cdcdcd
foreground = cdcdcd foreground = cdcdcd
background = 181818 background = 181818

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Derp # Derp
[colors-dark] [colors]
cursor=000000 ffffff cursor=000000 ffffff
foreground=ffffff foreground=ffffff
background=000000 background=000000

View file

@ -2,7 +2,7 @@
# Deus # Deus
# Color palette based on: https://github.com/ajmwagar/vim-deus # Color palette based on: https://github.com/ajmwagar/vim-deus
[colors-dark] [colors]
cursor=2c323b eaeaea cursor=2c323b eaeaea
background=2c323b background=2c323b
foreground=eaeaea foreground=eaeaea

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Dracula # Dracula
[colors-dark] [colors]
cursor=282a36 f8f8f2 cursor=282a36 f8f8f2
foreground=f8f8f2 foreground=f8f8f2
background=282a36 background=282a36

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Dracula iTerm2 variant # Dracula iTerm2 variant
[colors-dark] [colors]
cursor=ffffff bbbbbb cursor=ffffff bbbbbb
foreground=f8f8f2 foreground=f8f8f2
background=1e1f29 background=1e1f29

View file

@ -5,10 +5,7 @@
# text and the white background. # text and the white background.
# author: Eugen Rahaian <eugen@rah.ro> # author: Eugen Rahaian <eugen@rah.ro>
[main] [colors]
initial-color-theme=light
[colors-light]
cursor=ffffff 515151 cursor=ffffff 515151
background= ffffff background= ffffff
foreground= 000000 foreground= 000000

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Gruvbox # Gruvbox
[colors-dark] [colors]
background=282828 background=282828
foreground=ebdbb2 foreground=ebdbb2
regular0=282828 regular0=282828
@ -21,7 +21,7 @@ bright5=d3869b
bright6=8ec07c bright6=8ec07c
bright7=ebdbb2 bright7=ebdbb2
[colors-light] [colors2]
background=fbf1c7 background=fbf1c7
foreground=3c3836 foreground=3c3836
regular0=fbf1c7 regular0=fbf1c7

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Gruvbox # Gruvbox
[colors-dark] [colors]
background=282828 background=282828
foreground=ebdbb2 foreground=ebdbb2
regular0=282828 regular0=282828

View file

@ -1,10 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Gruvbox - Light # Gruvbox - Light
[main] [colors]
initial-color-theme=light
[colors-light]
background=fbf1c7 background=fbf1c7
foreground=3c3836 foreground=3c3836
regular0=fbf1c7 regular0=fbf1c7

View file

@ -1,6 +1,6 @@
# -*- conf -*- # -*- conf -*-
[colors-dark] [colors]
cursor=141414 c9c9c9 cursor=141414 c9c9c9
foreground=c9c9c9 foreground=c9c9c9
background=141414 background=141414

View file

@ -2,7 +2,7 @@
# this foot theme is based on alacritty iterm theme: # this foot theme is based on alacritty iterm theme:
# https://github.com/alacritty/alacritty-theme/blob/master/themes/iterm.toml # https://github.com/alacritty/alacritty-theme/blob/master/themes/iterm.toml
[colors-dark] [colors]
foreground=fffbf6 foreground=fffbf6
background=101421 background=101421

View file

@ -2,7 +2,7 @@
# JetBrains Darcula # JetBrains Darcula
# Palette based on the same theme from https://github.com/dexpota/kitty-themes # Palette based on the same theme from https://github.com/dexpota/kitty-themes
[colors-dark] [colors]
cursor=202020 ffffff cursor=202020 ffffff
background=202020 background=202020
foreground=adadad foreground=adadad

View file

@ -1,6 +1,6 @@
# -*- conf -*- # -*- conf -*-
[colors-dark] [colors]
cursor=111111 cccccc cursor=111111 cccccc
foreground=dddddd foreground=dddddd
background=000000 background=000000

View file

@ -2,10 +2,7 @@
# Material Amber # Material Amber
# Based on material.io guidelines with Amber 50 background # Based on material.io guidelines with Amber 50 background
[main] [colors]
initial-color-theme=light
[colors-light]
cursor=fff8e1 21201d cursor=fff8e1 21201d
foreground = 21201d foreground = 21201d
background = fff8e1 background = fff8e1

View file

@ -2,7 +2,7 @@
# Material # Material
# From https://github.com/MartinSeeler/iterm2-material-design # From https://github.com/MartinSeeler/iterm2-material-design
[colors-dark] [colors]
foreground=ECEFF1 foreground=ECEFF1
background=263238 background=263238
regular0=546E7A # black regular0=546E7A # black

View file

@ -3,11 +3,7 @@
# modus-operandi # modus-operandi
# See: https://protesilaos.com/emacs/modus-themes # See: https://protesilaos.com/emacs/modus-themes
# #
[colors]
[main]
initial-color-theme=light
[colors-light]
background=ffffff background=ffffff
foreground=000000 foreground=000000
regular0=000000 regular0=000000

View file

@ -4,7 +4,7 @@
# See: https://protesilaos.com/emacs/modus-themes # See: https://protesilaos.com/emacs/modus-themes
# #
[colors-dark] [colors]
background=000000 background=000000
foreground=ffffff foreground=ffffff
regular0=000000 regular0=000000

View file

@ -4,7 +4,7 @@
# See: https://protesilaos.com/emacs/modus-themes # See: https://protesilaos.com/emacs/modus-themes
# #
[colors-dark] [colors]
background=0d0e1c background=0d0e1c
foreground=ffffff foreground=ffffff
regular0=000000 regular0=000000

View file

@ -2,7 +2,7 @@
# Molokai # Molokai
# Based on zhou13's at https://github.com/zhou13/molokai-terminal/blob/master/xterm/Xresources # Based on zhou13's at https://github.com/zhou13/molokai-terminal/blob/master/xterm/Xresources
[colors-dark] [colors]
background=1B1D1E background=1B1D1E
foreground=CCCCCC foreground=CCCCCC
regular0=1B1D1E regular0=1B1D1E

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Monokai Pro # Monokai Pro
[colors-dark] [colors]
background=2D2A2E background=2D2A2E
foreground=FCFCFA foreground=FCFCFA
regular0=403E41 regular0=403E41

View file

@ -2,7 +2,7 @@
# moonfly # moonfly
# Based on https://github.com/bluz71/vim-moonfly-colors # Based on https://github.com/bluz71/vim-moonfly-colors
[colors-dark] [colors]
cursor = 080808 9e9e9e cursor = 080808 9e9e9e
foreground = b2b2b2 foreground = b2b2b2
background = 080808 background = 080808

View file

@ -6,7 +6,7 @@
# https://xcolors.net/neon # https://xcolors.net/neon
# #
[colors-dark] [colors]
foreground=f8f8f8 foreground=f8f8f8
background=171717 background=171717
regular0=171717 regular0=171717

View file

@ -1,7 +1,7 @@
# _*_ conf _*_ # _*_ conf _*_
# Night Owl # Night Owl
[colors-dark] [colors]
cursor=011627 80a4c2 cursor=011627 80a4c2
foreground=d6deeb foreground=d6deeb
background=011627 background=011627

View file

@ -2,7 +2,7 @@
# nightfly # nightfly
# Based on https://github.com/bluz71/vim-nightfly-guicolors # Based on https://github.com/bluz71/vim-nightfly-guicolors
[colors-dark] [colors]
cursor = 080808 9ca1aa cursor = 080808 9ca1aa
foreground = acb4c2 foreground = acb4c2
background = 011627 background = 011627

View file

@ -3,7 +3,7 @@
# https://github.com/n1ghtmare/noirblaze-kitty # https://github.com/n1ghtmare/noirblaze-kitty
[colors-dark] [colors]
cursor=121212 ff0088 cursor=121212 ff0088
foreground=d5d5d5 foreground=d5d5d5
background=121212 background=121212

View file

@ -6,7 +6,7 @@
# this specific foot theme is based on nord-alacritty: # this specific foot theme is based on nord-alacritty:
# https://github.com/arcticicestudio/nord-alacritty/blob/develop/src/nord.yml # https://github.com/arcticicestudio/nord-alacritty/blob/develop/src/nord.yml
[colors-dark] [colors]
cursor = 2e3440 d8dee9 cursor = 2e3440 d8dee9
foreground = d8dee9 foreground = d8dee9
background = 2e3440 background = 2e3440

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Nordiq # Nordiq
[colors-dark] [colors]
cursor=eeeeee 9f515a cursor=eeeeee 9f515a
foreground=dbdee9 foreground=dbdee9
background=0e1420 background=0e1420

View file

@ -3,7 +3,7 @@
# Uses the dark color palette from the default Neovim color scheme # Uses the dark color palette from the default Neovim color scheme
# See: https://github.com/neovim/neovim/blob/fb6c059dc55c8d594102937be4dd70f5ff51614a/src/nvim/highlight_group.c#L419 # See: https://github.com/neovim/neovim/blob/fb6c059dc55c8d594102937be4dd70f5ff51614a/src/nvim/highlight_group.c#L419
[colors-dark] [colors]
cursor=14161b e0e2ea # NvimDarkGrey2 NvimLightGrey2 cursor=14161b e0e2ea # NvimDarkGrey2 NvimLightGrey2
foreground=e0e2ea # NvimLightGrey2 foreground=e0e2ea # NvimLightGrey2
background=14161b # NvimDarkGrey2 background=14161b # NvimDarkGrey2
@ -29,7 +29,7 @@ bright5=ffcaff # NvimLightMagenta
bright6=8cf8f7 # NvimLightCyan bright6=8cf8f7 # NvimLightCyan
bright7=eef1f8 # NvimLightGrey1 bright7=eef1f8 # NvimLightGrey1
[colors-light] [colors2]
cursor=e0e2ea 14161b # NvimLightGrey2 NvimDarkGrey2 cursor=e0e2ea 14161b # NvimLightGrey2 NvimDarkGrey2
foreground=14161b # NvimDarkGrey2 foreground=14161b # NvimDarkGrey2
background=e0e2ea # NvimLightGrey2 background=e0e2ea # NvimLightGrey2

View file

@ -3,7 +3,7 @@
# Uses the dark color palette from the default Neovim color scheme # Uses the dark color palette from the default Neovim color scheme
# See: https://github.com/neovim/neovim/blob/fb6c059dc55c8d594102937be4dd70f5ff51614a/src/nvim/highlight_group.c#L419 # See: https://github.com/neovim/neovim/blob/fb6c059dc55c8d594102937be4dd70f5ff51614a/src/nvim/highlight_group.c#L419
[colors-dark] [colors]
cursor=14161b e0e2ea # NvimDarkGrey2 NvimLightGrey2 cursor=14161b e0e2ea # NvimDarkGrey2 NvimLightGrey2
foreground=e0e2ea # NvimLightGrey2 foreground=e0e2ea # NvimLightGrey2
background=14161b # NvimDarkGrey2 background=14161b # NvimDarkGrey2

View file

@ -3,10 +3,7 @@
# Uses the light color palette from the default Neovim color scheme # Uses the light color palette from the default Neovim color scheme
# See: https://github.com/neovim/neovim/blob/fb6c059dc55c8d594102937be4dd70f5ff51614a/src/nvim/highlight_group.c#L334 # See: https://github.com/neovim/neovim/blob/fb6c059dc55c8d594102937be4dd70f5ff51614a/src/nvim/highlight_group.c#L334
[main] [colors]
initial-color-theme=light
[colors-light]
cursor=e0e2ea 14161b # NvimLightGrey2 NvimDarkGrey2 cursor=e0e2ea 14161b # NvimLightGrey2 NvimDarkGrey2
foreground=14161b # NvimDarkGrey2 foreground=14161b # NvimDarkGrey2
background=e0e2ea # NvimLightGrey2 background=e0e2ea # NvimLightGrey2

View file

@ -1,7 +1,7 @@
# OneDark # OneDark
# Palette based on the same theme from https://github.com/dexpota/kitty-themes # Palette based on the same theme from https://github.com/dexpota/kitty-themes
[colors-dark] [colors]
cursor=111111 cccccc cursor=111111 cccccc
foreground=979eab foreground=979eab
background=282c34 background=282c34

View file

@ -7,7 +7,7 @@
# + cursor colors from: # + cursor colors from:
# https://github.com/sonph/onehalf/blob/master/iterm/OneHalfDark.itermcolors # https://github.com/sonph/onehalf/blob/master/iterm/OneHalfDark.itermcolors
[colors-dark] [colors]
cursor=dcdfe4 a3b3cc cursor=dcdfe4 a3b3cc
foreground=dcdfe4 foreground=dcdfe4
background=282c34 background=282c34

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# http://panda.siamak.me/ # http://panda.siamak.me/
[colors-dark] [colors]
# alpha=1.0 # alpha=1.0
background=1D1E20 background=1D1E20
foreground=F0F0F0 foreground=F0F0F0

View file

@ -2,7 +2,7 @@
# PaperColorDark # PaperColorDark
# Palette based on https://github.com/NLKNguyen/papercolor-theme # Palette based on https://github.com/NLKNguyen/papercolor-theme
[colors-dark] [colors]
cursor=1c1c1c eeeeee cursor=1c1c1c eeeeee
background=1c1c1c background=1c1c1c
foreground=eeeeee foreground=eeeeee
@ -25,7 +25,7 @@ bright7=5f8787 # bright white
# selection-foreground=1c1c1c # selection-foreground=1c1c1c
# selection-background=af87d7 # selection-background=af87d7
[colors-light] [colors2]
cursor=eeeeee 444444 cursor=eeeeee 444444
background=eeeeee background=eeeeee
foreground=444444 foreground=444444

View file

@ -2,7 +2,7 @@
# PaperColorDark # PaperColorDark
# Palette based on https://github.com/NLKNguyen/papercolor-theme # Palette based on https://github.com/NLKNguyen/papercolor-theme
[colors-dark] [colors]
cursor=1c1c1c eeeeee cursor=1c1c1c eeeeee
background=1c1c1c background=1c1c1c
foreground=eeeeee foreground=eeeeee

View file

@ -2,10 +2,7 @@
# PaperColor Light # PaperColor Light
# Palette based on https://github.com/NLKNguyen/papercolor-theme # Palette based on https://github.com/NLKNguyen/papercolor-theme
[main] [colors]
initial-color-theme=light
xs
[colors-light]
cursor=eeeeee 444444 cursor=eeeeee 444444
background=eeeeee background=eeeeee
foreground=444444 foreground=444444

View file

@ -1,7 +1,7 @@
# Based on Poimandres color theme for kitti terminal emulator # Based on Poimandres color theme for kitti terminal emulator
# https://github.com/ubmit/poimandres-kitty # https://github.com/ubmit/poimandres-kitty
[colors-dark] [colors]
cursor=1b1e28 ffffff cursor=1b1e28 ffffff
foreground=a6accd foreground=a6accd
background=1b1e28 background=1b1e28

View file

@ -13,7 +13,7 @@
# and also posted here: # and also posted here:
# https://forums.debian.net/viewtopic.php?t=29981 # https://forums.debian.net/viewtopic.php?t=29981
[colors-dark] [colors]
foreground = cccccc foreground = cccccc
background = 191911 background = 191911

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Rosé Pine # Rosé Pine
[colors-dark] [colors]
cursor=191724 e0def4 cursor=191724 e0def4
background=191724 background=191724
foreground=e0def4 foreground=e0def4

View file

@ -1,11 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Rosé Pine Dawn # Rosé Pine Dawn
[main] [colors]
initial-color-theme=light
[colors-light]
cursor=faf4ed 575279 cursor=faf4ed 575279
background=faf4ed background=faf4ed
foreground=575279 foreground=575279

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Rosé Pine Moon # Rosé Pine Moon
[colors-dark] [colors]
cursor=232136 e0def4 cursor=232136 e0def4
background=232136 background=232136
foreground=e0def4 foreground=e0def4

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Selenized dark # Selenized dark
[colors-dark] [colors]
cursor = 103c48 53d6c7 cursor = 103c48 53d6c7
background= 103c48 background= 103c48
foreground= adbcbc foreground= adbcbc
@ -24,7 +24,7 @@ bright5= ff84cd
bright6= 53d6c7 bright6= 53d6c7
bright7= cad8d9 bright7= cad8d9
[colors-light] [colors2]
cursor=fbf3db 00978a cursor=fbf3db 00978a
background= fbf3db background= fbf3db
foreground= 53676d foreground= 53676d

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Selenized black # Selenized black
[colors-dark] [colors]
cursor = 181818 56d8c9 cursor = 181818 56d8c9
background= 181818 background= 181818
foreground= b9b9b9 foreground= b9b9b9

View file

@ -1,7 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Selenized dark # Selenized dark
[colors-dark] [colors]
cursor = 103c48 53d6c7 cursor = 103c48 53d6c7
background= 103c48 background= 103c48
foreground= adbcbc foreground= adbcbc

View file

@ -1,10 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Selenized light # Selenized light
[main] [colors]
initial-color-theme=light
[colors-light]
cursor=fbf3db 00978a cursor=fbf3db 00978a
background= fbf3db background= fbf3db
foreground= 53676d foreground= 53676d

View file

@ -1,10 +1,7 @@
# -*- conf -*- # -*- conf -*-
# Selenized white # Selenized white
[main] [colors]
initial-color-theme=light
[colors-light]
cursor=ffffff 009a8a cursor=ffffff 009a8a
background= ffffff background= ffffff
foreground= 474747 foreground= 474747

Some files were not shown because too many files have changed in this diff Show more