mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
config(kitty,yazi,lazygit,lazydocker,gh): add universal tui tools from live home
kitty full config (theme symlink preserved, VictorMono NF). yazi opener OS-branched via template (open vs xdg-open). yazi/lazygit refreshed to live. lazydocker default empty config. gh config.yml as private_ — hosts.yml excluded (oauth token). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f30802426d
commit
3c691e8dc5
24 files changed
+1426
-8
No files matched your search
@@ -0,0 +1,97 @@
|
||||
# ~/.config/kitty/mywatcher.py
|
||||
from kitty.tabs import TabManager
|
||||
from typing import Any
|
||||
|
||||
from kitty.boss import Boss
|
||||
from kitty.window import Window
|
||||
|
||||
# from pprint import pprint
|
||||
|
||||
# Kitty currently ships with Python 3.12, but os.ptsname was added in 3.13.
|
||||
import ctypes
|
||||
|
||||
libc = ctypes.CDLL("libc.so.6")
|
||||
libc.ptsname.restype = ctypes.c_char_p
|
||||
|
||||
updating = False
|
||||
|
||||
|
||||
def get_title(window: Window, title: str) -> str:
|
||||
vt = "n/a"
|
||||
try:
|
||||
vt = window.user_vars["vt"]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
ptsname = libc.ptsname(window.child.child_fd).decode()
|
||||
ptsname = ptsname.removeprefix("/dev/")
|
||||
|
||||
return f"{title} [{vt} {ptsname}]"
|
||||
|
||||
|
||||
def on_title_change(boss: Boss, window: Window, data: dict[str, Any]) -> None:
|
||||
# pprint(("title change", "window", window, "data", data))
|
||||
tm = boss.active_tab_manager_with_dispatch
|
||||
if tm is not None:
|
||||
update_title(boss, window, tm)
|
||||
|
||||
|
||||
def on_tab_bar_dirty(boss: Boss, window: Window, data: dict[str, Any]) -> None:
|
||||
# called when any changes happen to the tab bar, such a new tabs being
|
||||
# created, tab titles changing, tabs moving, etc. Useful to display the
|
||||
# tab bar externally to kitty. This is called even if the tab bar is
|
||||
# hidden. Note that this is called only in *global watchers*, that is
|
||||
# watchers defined in kitty.conf or using the --watcher command line
|
||||
# flag. data contains tab_manager which is the object responsible for
|
||||
# managing all tabs in a single OS Window.
|
||||
# return get_title(window, data["title"])
|
||||
tm = data["tab_manager"]
|
||||
update_title(boss, window, tm)
|
||||
|
||||
|
||||
def update_title(boss: Boss, window: Window, tm: TabManager) -> None:
|
||||
# pprint(("update title", "window", window))
|
||||
global updating
|
||||
|
||||
if updating:
|
||||
# pprint("already updating, skipping")
|
||||
return
|
||||
|
||||
tab = tm.active_tab
|
||||
if tab is None:
|
||||
return
|
||||
|
||||
title = get_title(window, window.child_title)
|
||||
if title != tab.effective_title:
|
||||
updating = True
|
||||
# pprint(
|
||||
# (
|
||||
# "title",
|
||||
# title,
|
||||
# "tab.effective title",
|
||||
# tab.effective_title,
|
||||
# "window.title",
|
||||
# window.title,
|
||||
# "window.child_title",
|
||||
# window.child_title,
|
||||
# )
|
||||
# )
|
||||
window.set_title(title)
|
||||
updating = False
|
||||
else:
|
||||
pass
|
||||
# pprint(
|
||||
# (
|
||||
# "no update",
|
||||
# "title",
|
||||
# title,
|
||||
# "tab.effective title",
|
||||
# tab.effective_title,
|
||||
# "window.title",
|
||||
# window.title,
|
||||
# "window.child_title",
|
||||
# window.child_title,
|
||||
# )
|
||||
# )
|
||||
|
||||
return
|
||||
Reference in new issue
Block a user