Desktop section.
This commit is contained in:
parent
d649581778
commit
3409714715
99 changed files with 24377 additions and 0 deletions
1347
_desktop/kitty/default.conf
Normal file
1347
_desktop/kitty/default.conf
Normal file
File diff suppressed because it is too large
Load diff
135
_desktop/kitty/kitty.conf
Normal file
135
_desktop/kitty/kitty.conf
Normal file
|
@ -0,0 +1,135 @@
|
|||
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
|
||||
|
||||
#: Fonts {{{
|
||||
|
||||
font_family JetBrainsMono Nerd Font Mono Medium
|
||||
bold_font JetBrainsMono Nerd Font Mono Bold
|
||||
italic_font JetBrainsMono Nerd Font Mono Medium Italic
|
||||
bold_italic_font JetBrainsMono Nerd Font Mono Bold Italic
|
||||
font_size 14.0
|
||||
|
||||
adjust_line_height -5
|
||||
adjust_column_width -1
|
||||
#: }}}
|
||||
|
||||
#: Cursor customization {{{
|
||||
|
||||
cursor #c7c7c7
|
||||
cursor_text_color #161616
|
||||
cursor_shape beam
|
||||
cursor_blink_interval 0
|
||||
#: }}}
|
||||
|
||||
#: Mouse {{{
|
||||
|
||||
mouse_hide_wait -1
|
||||
# url_color #0087bd
|
||||
url_style single
|
||||
strip_trailing_spaces always
|
||||
focus_follows_mouse yes
|
||||
#: }}}
|
||||
|
||||
#: Terminal bell {{{
|
||||
|
||||
enable_audio_bell no
|
||||
visual_bell_duration 0.0
|
||||
window_alert_on_bell yes
|
||||
#: }}}
|
||||
|
||||
#: Window layout {{{
|
||||
|
||||
remember_window_size no
|
||||
initial_window_width 180c
|
||||
initial_window_height 50c
|
||||
window_padding_width 0 5
|
||||
hide_window_decorations no
|
||||
#: }}}
|
||||
|
||||
#: Tab bar {{{
|
||||
|
||||
tab_bar_edge top
|
||||
tab_bar_style fade
|
||||
active_tab_background #50b6d8
|
||||
active_tab_font_style normal
|
||||
inactive_tab_background #c7c7c7
|
||||
inactive_tab_font_style italic
|
||||
#: }}}
|
||||
|
||||
#: Color scheme {{{
|
||||
|
||||
foreground #c7c7c7
|
||||
background #161616
|
||||
# background_opacity 1.0
|
||||
selection_foreground #000000
|
||||
selection_background #c1ddff
|
||||
|
||||
color0 #161616
|
||||
color1 #fd4285
|
||||
color2 #a6e22d
|
||||
color3 #e5da72
|
||||
color4 #0094d8
|
||||
color5 #9a37ff
|
||||
color6 #50b6d8
|
||||
color7 #c7c7c7
|
||||
color8 #676767
|
||||
color9 #fa7fac
|
||||
color10 #bde271
|
||||
color11 #fff27f
|
||||
color12 #00bdff
|
||||
color13 #bd9eff
|
||||
color14 #5ed6fe
|
||||
color15 #feffff
|
||||
#: }}}
|
||||
|
||||
#: Advanced {{{
|
||||
|
||||
term xterm-256color
|
||||
#: }}}
|
||||
|
||||
#: Keyboard shortcuts {{{
|
||||
|
||||
kitty_mod cmd
|
||||
clear_all_shortcuts yes
|
||||
|
||||
#: Clipboard {{{
|
||||
|
||||
map kitty_mod+c copy_to_clipboard
|
||||
map kitty_mod+v paste_from_clipboard
|
||||
#: }}}
|
||||
|
||||
#: Window management {{{
|
||||
|
||||
map kitty_mod+enter new_window
|
||||
map kitty_mod+n new_os_window
|
||||
map kitty_mod+] next_window
|
||||
map kitty_mod+[ previous_window
|
||||
map kitty_mod+shift+r start_resizing_window
|
||||
#: }}}
|
||||
|
||||
#: Tab management {{{
|
||||
|
||||
map kitty_mod+shift+] next_tab
|
||||
map kitty_mod+shift+[ previous_tab
|
||||
map kitty_mod+t new_tab
|
||||
map kitty_mod+w close_tab
|
||||
#: }}}
|
||||
|
||||
#: Font sizes {{{
|
||||
|
||||
map kitty_mod+equal change_font_size all +2.0
|
||||
map kitty_mod+minus change_font_size all -2.0
|
||||
map kitty_mod+0 change_font_size all 0
|
||||
#: }}}
|
||||
|
||||
#: Select and act on visible text {{{
|
||||
|
||||
map kitty_mod+o kitten hints --customize-processing weechat-hints.py
|
||||
map kitty_mod+p>l kitten hints --type line --program -
|
||||
map kitty_mod+p>w kitten hints --type word --program -
|
||||
#: }}}
|
||||
|
||||
#: Miscellaneous {{{
|
||||
|
||||
map kitty_mod+u kitten unicode_input
|
||||
#: }}}
|
||||
# }}}
|
90
_desktop/kitty/weechat-hints.py
Normal file
90
_desktop/kitty/weechat-hints.py
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Must be equal to the values of `weechat.look.separator_vertical` and
|
||||
# `weechat.look.prefix_suffix`.
|
||||
SEPARATOR = "│"
|
||||
# How many separators to skip. For very narrow terminals or if you don't use a
|
||||
# bufflist, you should probably set this to 2.
|
||||
SEPARATOR_SKIP_COUNT = 3
|
||||
# How many characters to skip when the last separator (before the continuation
|
||||
# of a message) is reached. For very narrow terminals, you should probably set
|
||||
# this to 0 as WeeChat doesn't insert spaces after the separator in that case.
|
||||
SEPARATOR_SUFFIX_SKIP_COUNT = 1
|
||||
|
||||
|
||||
def extract_url(text, pos, url_prefix):
|
||||
"""Extracts URL from `text` at `pos`, ignoring WeeChat's chrome."""
|
||||
url = ""
|
||||
prefix_pos = 0
|
||||
start_pos = pos
|
||||
reached_next_message = False
|
||||
while True:
|
||||
if pos >= len(text):
|
||||
break
|
||||
# We're at the end of the message on this line / start of the nicklist.
|
||||
# We should keep skipping characters until we reach the start of the
|
||||
# wrapped message on the next line.
|
||||
if (text[pos] == " " and text[pos + 1] == SEPARATOR) or text[pos] == "\n":
|
||||
count = 1 if text[pos] == "\n" else 0
|
||||
old_pos = pos
|
||||
while True:
|
||||
pos += 1
|
||||
if pos >= len(text):
|
||||
break
|
||||
if text[pos] == SEPARATOR:
|
||||
# When a line is wrapped, the nick/nick prefix is not
|
||||
# shown. If it is (i.e. if we don't find a space before the
|
||||
# separator), then we've reached a new message and it's
|
||||
# time to stop looking.
|
||||
if count == SEPARATOR_SKIP_COUNT - 1 and text[pos - 2] != " ":
|
||||
pos = old_pos
|
||||
reached_next_message = True
|
||||
break
|
||||
count += 1
|
||||
if count == SEPARATOR_SKIP_COUNT:
|
||||
pos += 1 + SEPARATOR_SUFFIX_SKIP_COUNT # Skip "| " portion.
|
||||
break
|
||||
# The URL is over.
|
||||
elif text[pos] in [" ", "\0"]:
|
||||
break
|
||||
if pos >= len(text):
|
||||
break
|
||||
if reached_next_message:
|
||||
break
|
||||
# If the prefix (e.g. "https://") isn't matched, stop searching.
|
||||
if prefix_pos < len(url_prefix) - 1 and text[pos] != url_prefix[prefix_pos]:
|
||||
break
|
||||
# This is the real start of a potential URL match (i.e. ignoring
|
||||
# WeeChat decoration).
|
||||
if prefix_pos == 0:
|
||||
start_pos = pos
|
||||
url += text[pos]
|
||||
prefix_pos += 1
|
||||
pos += 1
|
||||
# Is the text we found actually a URL?
|
||||
if not url.startswith(url_prefix):
|
||||
url = None
|
||||
return start_pos, pos, url
|
||||
|
||||
|
||||
def mark(text, args, Mark, extra_cli_args, *a):
|
||||
idx = 0
|
||||
start_pos = 0
|
||||
while start_pos < len(text):
|
||||
# Extract URL, if any.
|
||||
start_pos, end_pos, url = extract_url(text, start_pos, "https://")
|
||||
if not url:
|
||||
start_pos, end_pos, url = extract_url(text, start_pos, "http://")
|
||||
if url:
|
||||
# Return mark info for kitty.
|
||||
yield Mark(idx, start_pos, end_pos, url, {})
|
||||
idx += 1
|
||||
start_pos = end_pos
|
||||
start_pos += 1
|
||||
|
||||
|
||||
def handle_result(args, data, target_window_id, boss, extra_cli_args, *a):
|
||||
matches, groupdicts = [], []
|
||||
for m, g in zip(data["match"], data["groupdicts"]):
|
||||
if m:
|
||||
matches.append(m), groupdicts.append(g)
|
||||
for match, match_data in zip(matches, groupdicts):
|
||||
boss.open_url(match)
|
Loading…
Add table
Add a link
Reference in a new issue