mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
0d3c5497ff09a8cd8b6232c0d8df317b80f60c75
Oops, the num is already negative index, no need to reverse here.
Alternatively this is shorter:
```
def nth_os_window(self, num: int = 1) -> None:
if not self.os_window_map:
return
if num == 0:
os_window_id = current_focused_os_window_id() or last_focused_os_window_id()
elif num > 0:
ids = tuple(self.os_window_map.keys())
os_window_id = ids[min(num, len(ids)) - 1]
else:
fc_map = os_window_focus_counters()
ids = sorted(fc_map.keys(), key=fc_map.__getitem__, reverse=True)
os_window_id = ids[min(-num, len(ids)-1)]
focus_os_window(os_window_id, True)
```
…
…
= kitty - the fast, feature-rich, cross-platform, GPU based terminal See https://sw.kovidgoyal.net/kitty/[the kitty website]. image:https://github.com/kovidgoyal/kitty/workflows/CI/badge.svg["Build status", link="https://github.com/kovidgoyal/kitty/actions?query=workflow%3ACI"] https://sw.kovidgoyal.net/kitty/faq/[Frequently Asked Questions] To ask other questions about kitty usage, use either the https://github.com/kovidgoyal/kitty/discussions/[discussions on GitHub] or the https://www.reddit.com/r/KittyTerminal[Reddit community] Packaging status in various repositories: image:https://repology.org/badge/vertical-allrepos/kitty.svg?columns=3&header=kitty["Packaging status", link="https://repology.org/project/kitty/versions"]
Languages
Python
38.5%
C
28%
Go
26.4%
Objective-C
5.5%
Shell
1%
Other
0.5%