mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-12 02:42:56 +02:00
Merge branch 'feat-macos-open-website' of https://github.com/page-down/kitty
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import string
|
||||
from kitty.conf.types import Action, Definition
|
||||
from kitty.constants import website_url
|
||||
|
||||
|
||||
definition = Definition(
|
||||
@@ -3786,5 +3787,10 @@ Some more examples::
|
||||
map ctrl+alt+a send_text normal,application some command with arguments\\r
|
||||
'''
|
||||
)
|
||||
|
||||
map('Open kitty Website',
|
||||
f'open_kitty_website shift+cmd+/ open_url {website_url()}',
|
||||
only='macos',
|
||||
)
|
||||
egr() # }}}
|
||||
egr() # }}}
|
||||
|
||||
1
kitty/options/types.py
generated
1
kitty/options/types.py
generated
@@ -922,6 +922,7 @@ if is_macos:
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=107), definition='clear_terminal to_cursor active')) # noqa
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=44), definition='load_config_file')) # noqa
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=44), definition='debug_config')) # noqa
|
||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=9, key=47), definition='open_url https://sw.kovidgoyal.net/kitty/')) # noqa
|
||||
defaults.mouse_map = [
|
||||
# click_url_or_select
|
||||
MouseMapping(repeat_count=-2, definition='mouse_handle_click selection link prompt'), # noqa
|
||||
|
||||
@@ -91,6 +91,20 @@ def kitten_parse(func: str, rest: str) -> FuncArgsType:
|
||||
return func, [args[0]] + (to_cmdline(args[1]) if len(args) > 1 else [])
|
||||
|
||||
|
||||
@func_with_args('open_url')
|
||||
def open_url_parse(func: str, rest: str) -> FuncArgsType:
|
||||
from urllib.parse import urlparse
|
||||
url = ''
|
||||
try:
|
||||
url = python_string(rest)
|
||||
tokens = urlparse(url)
|
||||
if not all((tokens.scheme, tokens.netloc,)):
|
||||
raise ValueError('Invalid URL')
|
||||
except Exception:
|
||||
log_error('Ignoring invalid URL string: ' + rest)
|
||||
return func, (url,)
|
||||
|
||||
|
||||
@func_with_args('goto_tab')
|
||||
def goto_tab_parse(func: str, rest: str) -> FuncArgsType:
|
||||
args = (max(0, int(rest)), )
|
||||
|
||||
Reference in New Issue
Block a user