mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-27 01:40:16 -05:00
Merge branch 'master' into bindings
This commit is contained in:
commit
fc7b3b2d85
7 changed files with 40 additions and 22 deletions
5
client.c
5
client.c
|
|
@ -135,10 +135,13 @@ main(int argc, char *const *argv)
|
||||||
} else {
|
} else {
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
|
|
||||||
|
const char *xdg_session_id = getenv("XDG_SESSION_ID");
|
||||||
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
||||||
if (xdg_runtime != NULL) {
|
if (xdg_runtime != NULL) {
|
||||||
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/foot.sock", xdg_runtime);
|
if (xdg_session_id == NULL)
|
||||||
|
xdg_session_id = "<no-session>";
|
||||||
|
|
||||||
|
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/foot-%s.sock", xdg_runtime, xdg_session_id);
|
||||||
if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == 0)
|
if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == 0)
|
||||||
connected = true;
|
connected = true;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
14
config.c
14
config.c
|
|
@ -413,6 +413,12 @@ parse_section_csd(const char *key, const char *value, struct config *conf,
|
||||||
conf->csd.color.close_set = true;
|
conf->csd.color.close_set = true;
|
||||||
conf->csd.color.close = color;
|
conf->csd.color.close = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
LOG_WARN("%s:%u: invalid key: %s", path, lineno, key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -561,12 +567,16 @@ err:
|
||||||
static char *
|
static char *
|
||||||
get_server_socket_path(void)
|
get_server_socket_path(void)
|
||||||
{
|
{
|
||||||
|
const char *xdg_session_id = getenv("XDG_SESSION_ID");
|
||||||
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
||||||
if (xdg_runtime == NULL)
|
if (xdg_runtime == NULL)
|
||||||
return strdup("/tmp/foot.sock");
|
return strdup("/tmp/foot.sock");
|
||||||
|
|
||||||
char *path = malloc(strlen(xdg_runtime) + 1 + strlen("foot.sock") + 1);
|
if (xdg_session_id == NULL)
|
||||||
sprintf(path, "%s/foot.sock", xdg_runtime);
|
xdg_session_id = "<no-session>";
|
||||||
|
|
||||||
|
char *path = malloc(strlen(xdg_runtime) + 1 + strlen("foot-.sock") + strlen(xdg_session_id) + 1);
|
||||||
|
sprintf(path, "%s/foot-%s.sock", xdg_runtime, xdg_session_id);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Exec=foot --server
|
Exec=foot --server
|
||||||
Icon=terminal
|
Icon=utilities-terminal
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=System;TerminalEmulator;
|
Categories=System;TerminalEmulator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Exec=foot
|
Exec=foot
|
||||||
Icon=terminal
|
Icon=utilities-terminal
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=System;TerminalEmulator;
|
Categories=System;TerminalEmulator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import enum
|
import enum
|
||||||
import shutil
|
import fcntl
|
||||||
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
import termios
|
||||||
|
|
||||||
|
|
||||||
class ColorVariant(enum.IntEnum):
|
class ColorVariant(enum.IntEnum):
|
||||||
|
|
@ -25,9 +27,11 @@ def main():
|
||||||
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
|
||||||
|
|
||||||
term_size = shutil.get_terminal_size()
|
lines, cols, _, _ = struct.unpack(
|
||||||
lines = term_size.lines
|
'HHHH',
|
||||||
cols = term_size.columns
|
fcntl.ioctl(sys.stdout.fileno(),
|
||||||
|
termios.TIOCGWINSZ,
|
||||||
|
struct.pack('HHHH', 0, 0, 0, 0)))
|
||||||
|
|
||||||
# Number of characters to write to screen
|
# Number of characters to write to screen
|
||||||
count = 256 * 1024**1
|
count = 256 * 1024**1
|
||||||
|
|
|
||||||
10
terminal.c
10
terminal.c
|
|
@ -770,15 +770,15 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
|
||||||
if ((term->window = wayl_win_init(term)) == NULL)
|
if ((term->window = wayl_win_init(term)) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* Let the Wayland backend know we exist */
|
|
||||||
tll_push_back(wayl->terms, term);
|
|
||||||
wayl_roundtrip(term->wl);
|
|
||||||
term_set_window_title(term, "foot");
|
|
||||||
|
|
||||||
/* Load fonts */
|
/* Load fonts */
|
||||||
if (!term_font_dpi_changed(term))
|
if (!term_font_dpi_changed(term))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
term_set_window_title(term, "foot");
|
||||||
|
|
||||||
|
/* Let the Wayland backend know we exist */
|
||||||
|
tll_push_back(wayl->terms, term);
|
||||||
|
|
||||||
/* Start the slave/client */
|
/* Start the slave/client */
|
||||||
if ((term->slave = slave_spawn(term->ptmx, argc, term->cwd, argv, term_env, conf->shell, login_shell)) == -1)
|
if ((term->slave = slave_spawn(term->ptmx, argc, term->cwd, argv, term_env, conf->shell, login_shell)) == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
||||||
17
wayland.c
17
wayland.c
|
|
@ -727,6 +727,11 @@ wayl_init(const struct config *conf, struct fdm *fdm)
|
||||||
wayl->fdm = fdm;
|
wayl->fdm = fdm;
|
||||||
wayl->kbd.repeat.fd = -1;
|
wayl->kbd.repeat.fd = -1;
|
||||||
|
|
||||||
|
if (!fdm_hook_add(fdm, &fdm_hook, wayl, FDM_HOOK_PRIORITY_LOW)) {
|
||||||
|
LOG_ERR("failed to add FDM hook");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
wayl->display = wl_display_connect(NULL);
|
wayl->display = wl_display_connect(NULL);
|
||||||
if (wayl->display == NULL) {
|
if (wayl->display == NULL) {
|
||||||
LOG_ERR("failed to connect to wayland; no compositor running?");
|
LOG_ERR("failed to connect to wayland; no compositor running?");
|
||||||
|
|
@ -775,9 +780,10 @@ wayl_init(const struct config *conf, struct fdm *fdm)
|
||||||
if (wayl->primary_selection_device_manager == NULL)
|
if (wayl->primary_selection_device_manager == NULL)
|
||||||
LOG_WARN("no primary selection available");
|
LOG_WARN("no primary selection available");
|
||||||
|
|
||||||
if (conf->presentation_timings && wayl->presentation == NULL)
|
if (conf->presentation_timings && wayl->presentation == NULL) {
|
||||||
LOG_WARN("presentation time interface not implemented by compositor; "
|
LOG_ERR("presentation time interface not implemented by compositor");
|
||||||
"timings will not be available");
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
tll_foreach(wayl->monitors, it) {
|
tll_foreach(wayl->monitors, it) {
|
||||||
LOG_INFO(
|
LOG_INFO(
|
||||||
|
|
@ -851,11 +857,6 @@ wayl_init(const struct config *conf, struct fdm *fdm)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fdm_hook_add(fdm, &fdm_hook, wayl, FDM_HOOK_PRIORITY_LOW)) {
|
|
||||||
LOG_ERR("failed to add FDM hook");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wayl;
|
return wayl;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue