mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
@@ -45,6 +45,8 @@ version 0.6.0 [future]
|
|||||||
|
|
||||||
- Add an option to control the underline style for URL highlighting on hover
|
- Add an option to control the underline style for URL highlighting on hover
|
||||||
|
|
||||||
|
- X11: Set the WINDOWID environment variable
|
||||||
|
|
||||||
version 0.5.1 [2017-12-01]
|
version 0.5.1 [2017-12-01]
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ class Child:
|
|||||||
child_fd = pid = None
|
child_fd = pid = None
|
||||||
forked = False
|
forked = False
|
||||||
|
|
||||||
def __init__(self, argv, cwd, opts, stdin=None):
|
def __init__(self, argv, cwd, opts, stdin=None, env=None):
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.cwd = os.path.abspath(os.path.expandvars(os.path.expanduser(cwd or os.getcwd())))
|
self.cwd = os.path.abspath(os.path.expandvars(os.path.expanduser(cwd or os.getcwd())))
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
self.stdin = stdin
|
self.stdin = stdin
|
||||||
|
self.env = env or {}
|
||||||
|
|
||||||
def fork(self):
|
def fork(self):
|
||||||
if self.forked:
|
if self.forked:
|
||||||
@@ -37,6 +38,7 @@ class Child:
|
|||||||
if stdin is not None:
|
if stdin is not None:
|
||||||
stdin_read_fd, stdin_write_fd = os.pipe()
|
stdin_read_fd, stdin_write_fd = os.pipe()
|
||||||
remove_cloexec(stdin_read_fd)
|
remove_cloexec(stdin_read_fd)
|
||||||
|
env = self.env
|
||||||
pid = os.fork()
|
pid = os.fork()
|
||||||
if pid == 0: # child
|
if pid == 0: # child
|
||||||
try:
|
try:
|
||||||
@@ -54,6 +56,7 @@ class Child:
|
|||||||
os.closerange(3, 200)
|
os.closerange(3, 200)
|
||||||
# Establish the controlling terminal (see man 7 credentials)
|
# Establish the controlling terminal (see man 7 credentials)
|
||||||
os.close(os.open(os.ttyname(1), os.O_RDWR))
|
os.close(os.open(os.ttyname(1), os.O_RDWR))
|
||||||
|
os.environ.update(env)
|
||||||
os.environ['TERM'] = self.opts.term
|
os.environ['TERM'] = self.opts.term
|
||||||
os.environ['COLORTERM'] = 'truecolor'
|
os.environ['COLORTERM'] = 'truecolor'
|
||||||
if os.path.isdir(terminfo_dir):
|
if os.path.isdir(terminfo_dir):
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ from functools import partial
|
|||||||
from .borders import Borders
|
from .borders import Borders
|
||||||
from .child import Child
|
from .child import Child
|
||||||
from .config import build_ansi_color_table
|
from .config import build_ansi_color_table
|
||||||
from .constants import WindowGeometry, appname, get_boss, shell_path
|
from .constants import (
|
||||||
|
WindowGeometry, appname, get_boss, is_macos, is_wayland, shell_path
|
||||||
|
)
|
||||||
from .fast_data_types import (
|
from .fast_data_types import (
|
||||||
DECAWM, Screen, add_tab, glfw_post_empty_event, remove_tab, remove_window,
|
DECAWM, Screen, add_tab, glfw_post_empty_event, remove_tab, remove_window,
|
||||||
set_active_tab, set_active_window, set_tab_bar_render_data, swap_tabs,
|
set_active_tab, set_active_window, set_tab_bar_render_data, swap_tabs,
|
||||||
swap_windows, viewport_for_window
|
swap_windows, viewport_for_window, x11_window_id
|
||||||
)
|
)
|
||||||
from .layout import Rect, all_layouts
|
from .layout import Rect, all_layouts
|
||||||
from .utils import color_as_int
|
from .utils import color_as_int
|
||||||
@@ -113,7 +115,14 @@ class Tab: # {{{
|
|||||||
cmd = [shell_path]
|
cmd = [shell_path]
|
||||||
else:
|
else:
|
||||||
cmd = self.args.args or [shell_path]
|
cmd = self.args.args or [shell_path]
|
||||||
ans = Child(cmd, self.cwd, self.opts, stdin)
|
env = {}
|
||||||
|
if not is_macos and not is_wayland:
|
||||||
|
try:
|
||||||
|
env['WINDOWID'] = str(x11_window_id(self.os_window_id))
|
||||||
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
ans = Child(cmd, self.cwd, self.opts, stdin, env)
|
||||||
ans.fork()
|
ans.fork()
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user