Updated weechat, bash and added scripts

This commit is contained in:
jfm 2024-04-25 09:03:13 +02:00
parent 9a05608378
commit 011ea9016a
29 changed files with 1068 additions and 1733 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ env
cache.db*
history*
neomuttrc
irc.conf

View File

@ -18,3 +18,12 @@ stow -t ~ bash
stow -t ~ weechat
stow -t ~ ranger
~~~
# Scripts
I have a few scripts I like to use that sets up som terminal windows the way I like them
* comms.sh opens a tmux with newsboat and weechat
* setup_development.sh sets up a Neovim development tmux which is tailored to my ultrawide monitor
~~~
stow -t ~ scripts
~~~

View File

@ -26,7 +26,8 @@ unset rc
export EDITOR=nvim
alias comms="/home/jfm/Repositories/tmux-scripts/comms.sh ."
alias dev="/home/jfm/Repositories/tmux-scripts/setup_development.sh ."
alias comms="/home/jfm/.local/bin/comms.sh ."
alias dev="/home/jfm/.local/bin/setup_development.sh ."
alias ncspot="flatpak run io.github.hrkfdn.ncspot"
complete -C /usr/bin/terraform terraform

7
scripts/.local/bin/comms.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
tmux new-session -d -s comms 'newsboat && /bin/bash'
tmux rename-window "Comms"
tmux select-window -t comms:1
tmux split-window -v -l 10 'weechat && /bin/bash'
tmux -2 attach-session -t comms

View File

@ -0,0 +1,26 @@
#!/bin/bash
BASE_DIR=$1
SESSION_ID=${PWD##*/}
if [ -e "$BASE_DIR/Pipfile" ]; then
COMMAND_PREFIX="pipenv run "
SHELL_COMMAND="pipenv shell"
echo "Pipenv"
else
COMMAND_PREFIX=""
SHELL_COMMAND="/bin/bash"
fi
cd $BASE_DIR
tmux new-session -d -s $SESSION_ID ${SHELL_COMMAND}
tmux rename-window "${SESSION_ID}"
tmux select-window -t $SESSION_ID:1
tmux split-window -h "${COMMAND_PREFIX}nvim && ${SHELL_COMMAND}"
tmux split-window -h "${SHELL_COMMAND}"
tmux select-layout even-horizontal
tmux split-window -v -t 1 "${SHELL_COMMAND}"
tmux split-window -v -t 4 "ranger && ${SHELL_COMMAND}"
tmux select-pane -t 3
tmux -2 attach-session -t $SESSION_ID

View File

@ -0,0 +1,49 @@
#
# weechat -- alias.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
config_version = 2
[cmd]
aaway = "allserv /away"
anick = "allserv /nick"
beep = "print -beep"
bye = "quit"
c = "buffer clear"
chat = "dcc chat"
cl = "buffer clear"
close = "buffer close"
exit = "quit"
ig = "ignore"
j = "join"
k = "kick"
kb = "kickban"
leave = "part"
m = "msg"
msgbuf = "command -buffer $1 * /input send $2-"
mub = "unban *"
n = "names"
q = "query"
redraw = "window refresh"
say = "msg *"
signoff = "quit"
t = "topic"
ub = "unban"
umode = "mode $nick"
v = "command core version"
w = "who"
wc = "window close"
wi = "whois"
wii = "whois $1 $1"
wm = "window merge"
ww = "whowas"
[completion]
msgbuf = "%(buffers_plugins_names)"

View File

@ -0,0 +1,41 @@
#
# weechat -- buflist.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
add_newline = on
auto_scroll = 50
display_conditions = "${buffer.hidden}==0"
enabled = on
mouse_jump_visited_buffer = off
mouse_move_buffer = on
mouse_wheel = on
nick_prefix = off
nick_prefix_empty = on
signals_refresh = ""
sort = "number,-active"
use_items = 1
[format]
buffer = "${format_number}${indent}${format_nick_prefix}${color_hotlist}${format_name}"
buffer_current = "${color:,17}${format_buffer}"
hotlist = " ${color:green}(${hotlist}${color:green})"
hotlist_highlight = "${color:magenta}"
hotlist_low = "${color:white}"
hotlist_message = "${color:brown}"
hotlist_none = "${color:default}"
hotlist_private = "${color:green}"
hotlist_separator = "${color:default},"
indent = " "
lag = " ${color:green}[${color:brown}${lag}${color:green}]"
name = "${name}"
nick_prefix = "${color_nick_prefix}${nick_prefix}"
number = "${color:green}${number}${if:${number_displayed}?.: }"
tls_version = " ${color:default}(${if:${tls_version}==TLS1.3?${color:green}:${if:${tls_version}==TLS1.2?${color:yellow}:${color:red}}}${translate:${tls_version}}${color:default})"

View File

@ -0,0 +1,18 @@
#
# weechat -- charset.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[default]
decode = "iso-8859-1"
encode = ""
[decode]
[encode]

View File

@ -0,0 +1,19 @@
#
# weechat -- exec.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[command]
default_options = ""
purge_delay = 0
shell = "${env:SHELL}"
[color]
flag_finished = lightred
flag_running = lightgreen

View File

@ -0,0 +1,14 @@
#
# weechat -- fifo.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[file]
enabled = on
path = "${weechat_runtime_dir}/weechat_fifo_${info:pid}"

View File

@ -0,0 +1,100 @@
#
# weechat -- fset.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
auto_refresh = "*"
auto_unmark = off
condition_catch_set = "${count} >= 1"
export_help_default = on
format_number = 1
marked_string = "*"
scroll_horizontal = 10
show_plugins_desc = off
sort = "~name"
unmarked_string = " "
use_color_value = on
use_keys = on
use_mute = off
[format]
export_help = "# ${description2}"
export_option = "/set ${name} ${quoted_value}"
export_option_null = "/unset ${name}"
option1 = ""
option2 = "${marked} ${name} ${type} ${value2}${newline} ${empty_name} ${_default_value}${color:244} -- ${_allowed_values}${newline} ${empty_name} ${_description}"
[color]
allowed_values = default
allowed_values_selected = white
color_name = 246
color_name_selected = default
default_value = default
default_value_selected = white
description = 242
description_selected = default
file = default
file_changed = brown
file_changed_selected = yellow
file_selected = white
help_default_value = white
help_description = default
help_name = white
help_quotes = darkgray
help_values = default
index = cyan
index_selected = lightcyan
line_marked_bg1 = 17
line_marked_bg2 = 17
line_selected_bg1 = 24
line_selected_bg2 = 24
marked = brown
marked_selected = yellow
max = default
max_selected = white
min = default
min_selected = white
name = default
name_changed = 185
name_changed_selected = yellow
name_selected = white
option = default
option_changed = brown
option_changed_selected = yellow
option_selected = white
parent_name = default
parent_name_selected = white
parent_value = cyan
parent_value_selected = lightcyan
quotes = darkgray
quotes_changed = default
quotes_changed_selected = white
quotes_selected = default
section = default
section_changed = brown
section_changed_selected = yellow
section_selected = white
string_values = default
string_values_selected = white
title_count_options = cyan
title_current_option = lightcyan
title_filter = yellow
title_marked_options = lightgreen
title_sort = white
type = 138
type_selected = 216
unmarked = default
unmarked_selected = white
value = 38
value_changed = 185
value_changed_selected = yellow
value_selected = 159
value_undef = magenta
value_undef_selected = lightmagenta

View File

@ -0,0 +1,14 @@
#
# weechat -- guile.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
check_license = off
eval_keep_context = on

View File

@ -0,0 +1,40 @@
#
# weechat -- logger.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
backlog = 20
backlog_conditions = ""
[color]
backlog_end = 246
backlog_line = 246
[file]
auto_log = on
color_lines = off
flush_delay = 120
fsync = off
info_lines = off
log_conditions = ""
mask = "$plugin.$name.weechatlog"
name_lower_case = on
nick_prefix = ""
nick_suffix = ""
path = "${weechat_data_dir}/logs"
replacement_char = "_"
rotation_compression_level = 20
rotation_compression_type = none
rotation_size_max = "0"
time_format = "%Y-%m-%d %H:%M:%S"
[level]
[mask]

View File

@ -0,0 +1,14 @@
#
# weechat -- lua.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
check_license = off
eval_keep_context = on

View File

@ -0,0 +1,14 @@
#
# weechat -- perl.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
check_license = off
eval_keep_context = on

View File

@ -0,0 +1,14 @@
#
# weechat -- plugins.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[var]
[desc]

View File

@ -0,0 +1,14 @@
#
# weechat -- python.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
check_license = off
eval_keep_context = on

View File

@ -0,0 +1,61 @@
#
# weechat -- relay.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
config_version = 2
[look]
auto_open_buffer = on
raw_messages = 256
[color]
client = cyan
status_active = green
status_auth_failed = lightmagenta
status_connecting = white
status_disconnected = lightred
status_waiting_auth = yellow
text = default
text_bg = default
text_selected = white
[network]
allow_empty_password = off
allowed_ips = ""
auth_timeout = 60
bind_address = ""
clients_purge_delay = 0
compression = 20
ipv6 = on
max_clients = 5
nonce_size = 16
password = ""
password_hash_algo = "*"
password_hash_iterations = 100000
tls_cert_key = "${weechat_config_dir}/tls/relay.pem"
tls_priorities = "NORMAL"
totp_secret = ""
totp_window = 0
websocket_allowed_origins = ""
[irc]
backlog_max_minutes = 0
backlog_max_number = 1024
backlog_since_last_disconnect = on
backlog_since_last_message = off
backlog_tags = "irc_privmsg"
backlog_time_format = "[%H:%M] "
[weechat]
commands = ""
[port]
[path]

View File

@ -0,0 +1,14 @@
#
# weechat -- ruby.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
check_license = off
eval_keep_context = on

View File

@ -0,0 +1,57 @@
#
# weechat -- script.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
columns = "%s %n %V %v %u | %d | %t"
diff_color = on
diff_command = "auto"
display_source = on
quiet_actions = on
sort = "i,p,n"
translate_description = on
use_keys = on
[color]
status_autoloaded = 39
status_held = white
status_installed = lightcyan
status_obsolete = lightmagenta
status_popular = yellow
status_running = lightgreen
status_unknown = lightred
text = default
text_bg = default
text_bg_selected = 24
text_date = 65
text_date_selected = 50
text_delimiters = 240
text_description = 249
text_description_selected = white
text_extension = 242
text_extension_selected = 248
text_name = 73
text_name_selected = 51
text_selected = white
text_tags = brown
text_tags_selected = yellow
text_version = 100
text_version_loaded = 246
text_version_loaded_selected = white
text_version_selected = 228
[scripts]
autoload = on
cache_expire = 1440
download_enabled = off
download_timeout = 30
hold = ""
path = "${weechat_cache_dir}/script"
url = "https://weechat.org/files/plugins.xml.gz"

View File

@ -0,0 +1,18 @@
#
# weechat -- sec.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[crypt]
cipher = aes256
hash_algo = sha256
passphrase_command = ""
salt = on
[data]

View File

@ -0,0 +1,33 @@
#
# weechat -- spell.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[color]
misspelled = lightred
suggestion = default
suggestion_delimiter_dict = cyan
suggestion_delimiter_word = cyan
[check]
commands = "away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic"
default_dict = ""
during_search = off
enabled = off
real_time = off
suggestions = -1
word_min_length = 2
[dict]
[look]
suggestion_delimiter_dict = " / "
suggestion_delimiter_word = ","
[option]

View File

@ -0,0 +1,14 @@
#
# weechat -- tcl.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
check_license = off
eval_keep_context = on

View File

@ -0,0 +1,66 @@
#
# weechat -- trigger.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
enabled = on
monitor_strip_colors = off
[color]
flag_command = lightgreen
flag_conditions = yellow
flag_post_action = lightblue
flag_regex = lightcyan
flag_return_code = lightmagenta
identifier = cyan
regex = white
replace = cyan
[trigger]
beep.arguments = ""
beep.command = "/print -beep"
beep.conditions = "${tg_displayed} && ${tg_tags} !!- ,notify_none, && (${tg_highlight} || ${tg_msg_pv}) && ${buffer.notify} > 0"
beep.enabled = on
beep.hook = print
beep.post_action = none
beep.regex = ""
beep.return_code = ok
cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth"
cmd_pass.command = ""
cmd_pass.conditions = ""
cmd_pass.enabled = on
cmd_pass.hook = modifier
cmd_pass.post_action = none
cmd_pass.regex = "s==^((/(msg|m|quote) +(-server +[^ \n]+ +)?nickserv +(id|identify|set +password|ghost +[^ \n]+|release +[^ \n]+|regain +[^ \n]+|recover +[^ \n]+|setpass +[^ \n]+) +)|/oper +[^ \n]+ +|/quote +pass +|/secure +(passphrase|decrypt|set +[^ \n]+) +)([^\n]*)==${re:1}${hide:*,${re:+}}"
cmd_pass.return_code = ok
cmd_pass_register.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth"
cmd_pass_register.command = ""
cmd_pass_register.conditions = ""
cmd_pass_register.enabled = on
cmd_pass_register.hook = modifier
cmd_pass_register.post_action = none
cmd_pass_register.regex = "s==^(/(msg|m|quote) +(-server +[^ \n]+ +)?nickserv +register +)([^ \n]+)([^\n]*)==${re:1}${hide:*,${re:4}}${re:5}"
cmd_pass_register.return_code = ok
msg_auth.arguments = "5000|irc_message_auth"
msg_auth.command = ""
msg_auth.conditions = ""
msg_auth.enabled = on
msg_auth.hook = modifier
msg_auth.post_action = none
msg_auth.regex = "s==^(.*(id|identify|set +password|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+|recover +[^ ]+) +)(.*)==${re:1}${hide:*,${re:+}}"
msg_auth.return_code = ok
server_pass.arguments = "5000|input_text_display;5000|history_add"
server_pass.command = ""
server_pass.conditions = ""
server_pass.enabled = on
server_pass.hook = modifier
server_pass.post_action = none
server_pass.regex = "s==^(/(server|connect) [^\n]*-(sasl_)?password=)([^ \n]+)([^\n]*)==${re:1}${hide:*,${re:4}}${re:5}"
server_pass.return_code = ok

View File

@ -0,0 +1,19 @@
#
# weechat -- typing.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
delay_purge_paused = 30
delay_purge_typing = 6
delay_set_paused = 10
enabled_nicks = off
enabled_self = off
input_min_chars = 4
item_max_length = 0

View File

@ -4,11 +4,13 @@
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use /set or similar command to change settings in WeeChat.
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/quickstart
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
config_version = 2
[debug]
[startup]
@ -32,15 +34,18 @@ buffer_notify_default = all
buffer_position = end
buffer_search_case_sensitive = off
buffer_search_force_default = off
buffer_search_history = local
buffer_search_regex = off
buffer_search_where = prefix_message
buffer_time_format = "%H:%M:%S"
buffer_time_same = ""
chat_space_right = off
color_basic_force_bold = off
color_inactive_buffer = on
color_inactive_message = on
color_inactive_prefix = on
color_inactive_prefix_buffer = on
color_inactive_time = off
color_inactive_time = on
color_inactive_window = on
color_nick_offline = off
color_pairs_auto_reset = 5
@ -55,6 +60,7 @@ day_change_message_2dates = "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --"
eat_newline_glitch = off
emphasized_attributes = ""
highlight = ""
highlight_disable_regex = ""
highlight_regex = ""
highlight_tags = ""
hotlist_add_conditions = "${away} || ${buffer.num_displayed} == 0 || ${info:relay_client_count,weechat,connected} > 0"
@ -71,7 +77,9 @@ hotlist_short_names = on
hotlist_sort = group_time_asc
hotlist_suffix = ""
hotlist_unique_numbers = on
hotlist_update_on_buffer_switch = on
input_cursor_scroll = 20
input_multiline_lead_linebreak = on
input_share = none
input_share_overwrite = off
input_undo_max = 32
@ -89,13 +97,13 @@ mouse = off
mouse_timer_delay = 100
nick_color_force = ""
nick_color_hash = djb2
nick_color_hash_salt = ""
nick_color_stop_chars = "_|["
nick_prefix = ""
nick_suffix = ""
paste_auto_add_newline = on
paste_bracketed = on
paste_bracketed_timer_delay = 10
paste_max_lines = 1
paste_max_lines = 100
prefix_action = " *"
prefix_align = right
prefix_align_max = 0
@ -111,16 +119,18 @@ prefix_join = "-->"
prefix_network = "--"
prefix_quit = "<--"
prefix_same_nick = ""
prefix_suffix = "|"
prefix_same_nick_middle = ""
prefix_suffix = "│"
quote_nick_prefix = "<"
quote_nick_suffix = ">"
quote_time_format = "%H:%M:%S"
read_marker = line
read_marker_always_show = off
read_marker_string = "- "
read_marker_update_on_buffer_switch = on
save_config_on_exit = on
save_config_with_fsync = off
save_layout_on_exit = all
save_layout_on_exit = none
scroll_amount = 3
scroll_bottom_after_switch = off
scroll_page_percent = 100
@ -145,33 +155,35 @@ chat_bg = default
chat_buffer = white
chat_channel = white
chat_day_change = cyan
chat_delimiters = green
chat_delimiters = 22
chat_highlight = yellow
chat_highlight_bg = magenta
chat_highlight_bg = 124
chat_host = cyan
chat_inactive_buffer = default
chat_inactive_window = default
chat_inactive_window = 240
chat_nick = lightcyan
chat_nick_colors = "cyan,magenta,green,brown,lightblue,default,lightcyan,lightmagenta,lightgreen,blue"
chat_nick_offline = default
chat_nick_colors = "cyan,magenta,green,brown,lightblue,lightcyan,lightmagenta,lightgreen,31,35,38,40,49,63,70,80,92,99,112,126,130,138,142,148,160,162,167,169,174,176,178,184,186,210,212,215,248"
chat_nick_offline = 242
chat_nick_offline_highlight = default
chat_nick_offline_highlight_bg = blue
chat_nick_offline_highlight_bg = 17
chat_nick_other = cyan
chat_nick_prefix = green
chat_nick_self = white
chat_nick_suffix = green
chat_prefix_action = white
chat_prefix_buffer = brown
chat_prefix_buffer = 180
chat_prefix_buffer_inactive_buffer = default
chat_prefix_error = yellow
chat_prefix_join = lightgreen
chat_prefix_more = lightmagenta
chat_prefix_network = magenta
chat_prefix_quit = lightred
chat_prefix_suffix = green
chat_prefix_suffix = 24
chat_read_marker = magenta
chat_read_marker_bg = default
chat_server = brown
chat_status_disabled = red
chat_status_enabled = green
chat_tags = red
chat_text_found = yellow
chat_text_found_bg = lightmagenta
@ -180,13 +192,14 @@ chat_time_delimiters = brown
chat_value = cyan
chat_value_null = blue
emphasized = yellow
emphasized_bg = magenta
emphasized_bg = 54
eval_syntax_colors = "green,lightred,lightblue,lightmagenta,yellow,cyan"
input_actions = lightgreen
input_text_not_found = red
item_away = yellow
nicklist_away = cyan
nicklist_away = 240
nicklist_group = green
separator = blue
separator = 236
status_count_highlight = magenta
status_count_msg = brown
status_count_other = default
@ -197,9 +210,10 @@ status_data_other = default
status_data_private = lightgreen
status_filter = green
status_more = yellow
status_mouse = green
status_mouse = lightgreen
status_name = white
status_name_ssl = lightgreen
status_name_insecure = lightmagenta
status_name_tls = white
status_nicklist_count = default
status_number = yellow
status_time = default
@ -210,7 +224,7 @@ command_inline = on
default_template = "%(nicks)|%(irc_channels)"
nick_add_space = on
nick_case_sensitive = off
nick_completer = ":"
nick_completer = ": "
nick_first_only = off
nick_ignore_chars = "[]`_-^"
partial_completion_alert = on
@ -231,19 +245,27 @@ max_visited_buffers = 50
[network]
connection_timeout = 60
gnutls_ca_file = "/etc/ssl/certs/ca-certificates.crt"
gnutls_ca_system = on
gnutls_ca_user = ""
gnutls_handshake_timeout = 30
proxy_curl = ""
[plugin]
autoload = "*"
debug = off
extension = ".so,.dll"
path = "%h/plugins"
path = "${weechat_data_dir}/plugins"
save_config_on_unload = on
[signal]
sighup = "${if:${info:weechat_headless}?/reload:/quit -yes}"
sigquit = "/quit -yes"
sigterm = "/quit -yes"
sigusr1 = ""
sigusr2 = ""
[bar]
buflist.color_bg = default
buflist.color_bg_inactive = default
buflist.color_delim = default
buflist.color_fg = default
buflist.conditions = ""
@ -251,13 +273,14 @@ buflist.filling_left_right = vertical
buflist.filling_top_bottom = columns_vertical
buflist.hidden = off
buflist.items = "buflist"
buflist.position = bottom
buflist.position = top
buflist.priority = 0
buflist.separator = on
buflist.size = 0
buflist.size_max = 0
buflist.type = root
fset.color_bg = default
fset.color_bg_inactive = default
fset.color_delim = cyan
fset.color_fg = default
fset.conditions = "${buffer.full_name} == fset.fset"
@ -272,6 +295,7 @@ fset.size = 3
fset.size_max = 3
fset.type = window
input.color_bg = default
input.color_bg_inactive = default
input.color_delim = cyan
input.color_fg = default
input.conditions = ""
@ -282,10 +306,11 @@ input.items = "[input_prompt]+(away),[input_search],[input_paste],input_text"
input.position = bottom
input.priority = 1000
input.separator = off
input.size = 1
input.size = 0
input.size_max = 0
input.type = window
nicklist.color_bg = default
nicklist.color_bg_inactive = default
nicklist.color_delim = cyan
nicklist.color_fg = default
nicklist.conditions = "${nicklist}"
@ -299,23 +324,25 @@ nicklist.separator = on
nicklist.size = 0
nicklist.size_max = 0
nicklist.type = window
status.color_bg = blue
status.color_bg = 234
status.color_bg_inactive = 232
status.color_delim = cyan
status.color_fg = default
status.conditions = ""
status.filling_left_right = vertical
status.filling_top_bottom = horizontal
status.hidden = on
status.items = "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[hotlist],completion"
status.hidden = off
status.items = "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,mouse_status,scroll,[lag],[hotlist],[typing],completion"
status.position = bottom
status.priority = 500
status.separator = off
status.size = 1
status.size_max = 0
status.type = window
title.color_bg = 3
title.color_bg = 234
title.color_bg_inactive = 232
title.color_delim = cyan
title.color_fg = 0
title.color_fg = default
title.conditions = ""
title.filling_left_right = vertical
title.filling_top_bottom = horizontal
@ -328,64 +355,83 @@ title.size = 1
title.size_max = 0
title.type = window
[custom_bar_item]
[layout]
default.buffer = "core;weechat;1"
default.buffer = "irc;server.freenode;1"
default.buffer = "irc;freenode.#archlinux;2"
default.buffer = "irc;freenode.#i3;3"
default.buffer = "irc;freenode.#archlinux-offtopic;4"
default.window = "1;0;0;0;irc;freenode.#archlinux-offtopic"
default.buffer = "irc;server.libera;1"
default.buffer = "irc;libera.#fedora;2"
default.buffer = "irc;libera.#neovim;3"
default.buffer = "irc;libera.##proxmox;4"
default.buffer = "irc;libera.#tmux;5"
default.buffer = "irc;libera.#kubernetes;6"
default.buffer = "irc;libera.#python;7"
default.buffer = "irc;libera.#gnome;8"
default.buffer = "irc;libera.#homeassistant;9"
default.buffer = "irc;libera.#terraform;10"
default.window = "1;0;0;0;irc;server.libera"
default.current = on
[buffer]
[notify]
[filter]
irc_smart = on;*;irc_smart_filter;*
joinquit = on;*;irc_join,irc_part,irc_quit;*
[key]
ctrl-? = "/input delete_previous_char"
ctrl-A = "/input move_beginning_of_line"
ctrl-B = "/input move_previous_char"
ctrl-C_ = "/input insert \x1F"
ctrl-Cb = "/input insert \x02"
ctrl-Cc = "/input insert \x03"
ctrl-Ci = "/input insert \x1D"
ctrl-Co = "/input insert \x0F"
ctrl-Cv = "/input insert \x16"
ctrl-D = "/input delete_next_char"
ctrl-E = "/input move_end_of_line"
ctrl-F = "/input move_next_char"
ctrl-H = "/input delete_previous_char"
ctrl-I = "/input complete_next"
ctrl-J = "/input return"
ctrl-K = "/input delete_end_of_line"
ctrl-L = "/window refresh"
ctrl-M = "/input return"
ctrl-N = "/buffer +1"
ctrl-P = "/buffer -1"
ctrl-R = "/input search_text_here"
ctrl-Sctrl-U = "/input set_unread"
ctrl-T = "/input transpose_chars"
ctrl-U = "/input delete_beginning_of_line"
ctrl-W = "/input delete_previous_word"
ctrl-X = "/input switch_active_buffer"
ctrl-Y = "/input clipboard_paste"
meta-meta-OP = "/bar scroll buflist * b"
meta-meta-OQ = "/bar scroll buflist * e"
meta-meta2-1~ = "/window scroll_top"
meta-meta2-23~ = "/bar scroll nicklist * b"
meta-meta2-24~ = "/bar scroll nicklist * e"
meta-meta2-4~ = "/window scroll_bottom"
meta-meta2-5~ = "/window scroll_up"
meta-meta2-6~ = "/window scroll_down"
meta-meta2-7~ = "/window scroll_top"
meta-meta2-8~ = "/window scroll_bottom"
meta-meta2-A = "/buffer -1"
meta-meta2-B = "/buffer +1"
meta-meta2-C = "/buffer +1"
meta-meta2-D = "/buffer -1"
backspace = "/input delete_previous_char"
ctrl-_ = "/input undo"
ctrl-a = "/input move_beginning_of_line"
ctrl-b = "/input move_previous_char"
ctrl-c,_ = "/input insert \x1F"
ctrl-c,b = "/input insert \x02"
ctrl-c,c = "/input insert \x03"
ctrl-c,d = "/input insert \x04"
ctrl-c,i = "/input insert \x1D"
ctrl-c,o = "/input insert \x0F"
ctrl-c,v = "/input insert \x16"
ctrl-d = "/input delete_next_char"
ctrl-down = "/input history_global_next"
ctrl-e = "/input move_end_of_line"
ctrl-f = "/input move_next_char"
ctrl-f1 = "/bar scroll buflist * -100%"
ctrl-f11 = "/bar scroll nicklist * -100%"
ctrl-f12 = "/bar scroll nicklist * +100%"
ctrl-f2 = "/bar scroll buflist * +100%"
ctrl-k = "/input delete_end_of_line"
ctrl-l = "/window refresh"
ctrl-left = "/input move_previous_word"
ctrl-n = "/buffer +1"
ctrl-o = "/input history_use_get_next"
ctrl-p = "/buffer -1"
ctrl-r = "/input search_history"
ctrl-right = "/input move_next_word"
ctrl-s = "/input search_text_here"
ctrl-t = "/input transpose_chars"
ctrl-u = "/input delete_beginning_of_line"
ctrl-up = "/input history_global_previous"
ctrl-w = "/input delete_previous_word_whitespace"
ctrl-x = "/buffer switch"
ctrl-y = "/input clipboard_paste"
ctrl-z = "/sys suspend"
delete = "/input delete_next_char"
down = "/input history_next"
end = "/input move_end_of_line"
f1 = "/bar scroll buflist * -100%"
f10 = "/bar scroll title * +30%"
f11 = "/bar scroll nicklist * -100%"
f12 = "/bar scroll nicklist * +100%"
f2 = "/bar scroll buflist * +100%"
f5 = "/buffer -1"
f6 = "/buffer +1"
f7 = "/window -1"
f8 = "/window +1"
f9 = "/bar scroll title * -30%"
home = "/input move_beginning_of_line"
left = "/input move_previous_char"
meta-- = "/filter toggle @"
meta-/ = "/input jump_last_buffer_displayed"
meta-/ = "/buffer jump last_displayed"
meta-0 = "/buffer *10"
meta-1 = "/buffer *1"
meta-2 = "/buffer *2"
@ -396,228 +442,222 @@ meta-6 = "/buffer *6"
meta-7 = "/buffer *7"
meta-8 = "/buffer *8"
meta-9 = "/buffer *9"
meta-< = "/input jump_previously_visited_buffer"
meta-< = "/buffer jump prev_visited"
meta-= = "/filter toggle"
meta-> = "/input jump_next_visited_buffer"
meta-OA = "/input history_global_previous"
meta-OB = "/input history_global_next"
meta-OC = "/input move_next_word"
meta-OD = "/input move_previous_word"
meta-OF = "/input move_end_of_line"
meta-OH = "/input move_beginning_of_line"
meta-OP = "/bar scroll buflist * -100%"
meta-OQ = "/bar scroll buflist * +100%"
meta-Oa = "/input history_global_previous"
meta-Ob = "/input history_global_next"
meta-Oc = "/input move_next_word"
meta-Od = "/input move_previous_word"
meta2-15~ = "/buffer -1"
meta2-17~ = "/buffer +1"
meta2-18~ = "/window -1"
meta2-19~ = "/window +1"
meta2-1;3A = "/buffer -1"
meta2-1;3B = "/buffer +1"
meta2-1;3C = "/buffer +1"
meta2-1;3D = "/buffer -1"
meta2-1;3F = "/window scroll_bottom"
meta2-1;3H = "/window scroll_top"
meta2-1;5A = "/input history_global_previous"
meta2-1;5B = "/input history_global_next"
meta2-1;5C = "/input move_next_word"
meta2-1;5D = "/input move_previous_word"
meta2-1~ = "/input move_beginning_of_line"
meta2-200~ = "/input paste_start"
meta2-201~ = "/input paste_stop"
meta2-20~ = "/bar scroll title * -30%"
meta2-21~ = "/bar scroll title * +30%"
meta2-23;3~ = "/bar scroll nicklist * b"
meta2-23~ = "/bar scroll nicklist * -100%"
meta2-24;3~ = "/bar scroll nicklist * e"
meta2-24~ = "/bar scroll nicklist * +100%"
meta2-3~ = "/input delete_next_char"
meta2-4~ = "/input move_end_of_line"
meta2-5;3~ = "/window scroll_up"
meta2-5~ = "/window page_up"
meta2-6;3~ = "/window scroll_down"
meta2-6~ = "/window page_down"
meta2-7~ = "/input move_beginning_of_line"
meta2-8~ = "/input move_end_of_line"
meta2-A = "/input history_previous"
meta2-B = "/input history_next"
meta2-C = "/input move_next_char"
meta2-D = "/input move_previous_char"
meta2-F = "/input move_end_of_line"
meta2-G = "/window page_down"
meta2-H = "/input move_beginning_of_line"
meta2-I = "/window page_up"
meta2-Z = "/input complete_previous"
meta2-[E = "/buffer -1"
meta-> = "/buffer jump next_visited"
meta-B = "/buflist toggle"
meta-N = "/bar toggle nicklist"
meta-R = "/input delete_input"
meta-U = "/allbuf /buffer set unread"
meta-_ = "/input redo"
meta-a = "/input jump_smart"
meta-a = "/buffer jump smart"
meta-b = "/input move_previous_word"
meta-backspace = "/input delete_previous_word"
meta-ctrl-k = "/input delete_end_of_input"
meta-ctrl-u = "/input delete_beginning_of_input"
meta-d = "/input delete_next_word"
meta-down = "/buffer +1"
meta-end = "/window scroll_bottom"
meta-f = "/input move_next_word"
meta-h = "/input hotlist_clear"
meta-jmeta-f = "/buffer -"
meta-jmeta-l = "/buffer +"
meta-jmeta-r = "/server raw"
meta-jmeta-s = "/server jump"
meta-j01 = "/buffer *1"
meta-j02 = "/buffer *2"
meta-j03 = "/buffer *3"
meta-j04 = "/buffer *4"
meta-j05 = "/buffer *5"
meta-j06 = "/buffer *6"
meta-j07 = "/buffer *7"
meta-j08 = "/buffer *8"
meta-j09 = "/buffer *9"
meta-j10 = "/buffer *10"
meta-j11 = "/buffer *11"
meta-j12 = "/buffer *12"
meta-j13 = "/buffer *13"
meta-j14 = "/buffer *14"
meta-j15 = "/buffer *15"
meta-j16 = "/buffer *16"
meta-j17 = "/buffer *17"
meta-j18 = "/buffer *18"
meta-j19 = "/buffer *19"
meta-j20 = "/buffer *20"
meta-j21 = "/buffer *21"
meta-j22 = "/buffer *22"
meta-j23 = "/buffer *23"
meta-j24 = "/buffer *24"
meta-j25 = "/buffer *25"
meta-j26 = "/buffer *26"
meta-j27 = "/buffer *27"
meta-j28 = "/buffer *28"
meta-j29 = "/buffer *29"
meta-j30 = "/buffer *30"
meta-j31 = "/buffer *31"
meta-j32 = "/buffer *32"
meta-j33 = "/buffer *33"
meta-j34 = "/buffer *34"
meta-j35 = "/buffer *35"
meta-j36 = "/buffer *36"
meta-j37 = "/buffer *37"
meta-j38 = "/buffer *38"
meta-j39 = "/buffer *39"
meta-j40 = "/buffer *40"
meta-j41 = "/buffer *41"
meta-j42 = "/buffer *42"
meta-j43 = "/buffer *43"
meta-j44 = "/buffer *44"
meta-j45 = "/buffer *45"
meta-j46 = "/buffer *46"
meta-j47 = "/buffer *47"
meta-j48 = "/buffer *48"
meta-j49 = "/buffer *49"
meta-j50 = "/buffer *50"
meta-j51 = "/buffer *51"
meta-j52 = "/buffer *52"
meta-j53 = "/buffer *53"
meta-j54 = "/buffer *54"
meta-j55 = "/buffer *55"
meta-j56 = "/buffer *56"
meta-j57 = "/buffer *57"
meta-j58 = "/buffer *58"
meta-j59 = "/buffer *59"
meta-j60 = "/buffer *60"
meta-j61 = "/buffer *61"
meta-j62 = "/buffer *62"
meta-j63 = "/buffer *63"
meta-j64 = "/buffer *64"
meta-j65 = "/buffer *65"
meta-j66 = "/buffer *66"
meta-j67 = "/buffer *67"
meta-j68 = "/buffer *68"
meta-j69 = "/buffer *69"
meta-j70 = "/buffer *70"
meta-j71 = "/buffer *71"
meta-j72 = "/buffer *72"
meta-j73 = "/buffer *73"
meta-j74 = "/buffer *74"
meta-j75 = "/buffer *75"
meta-j76 = "/buffer *76"
meta-j77 = "/buffer *77"
meta-j78 = "/buffer *78"
meta-j79 = "/buffer *79"
meta-j80 = "/buffer *80"
meta-j81 = "/buffer *81"
meta-j82 = "/buffer *82"
meta-j83 = "/buffer *83"
meta-j84 = "/buffer *84"
meta-j85 = "/buffer *85"
meta-j86 = "/buffer *86"
meta-j87 = "/buffer *87"
meta-j88 = "/buffer *88"
meta-j89 = "/buffer *89"
meta-j90 = "/buffer *90"
meta-j91 = "/buffer *91"
meta-j92 = "/buffer *92"
meta-j93 = "/buffer *93"
meta-j94 = "/buffer *94"
meta-j95 = "/buffer *95"
meta-j96 = "/buffer *96"
meta-j97 = "/buffer *97"
meta-j98 = "/buffer *98"
meta-j99 = "/buffer *99"
meta-f1 = "/bar scroll buflist * b"
meta-f11 = "/bar scroll nicklist * b"
meta-f12 = "/bar scroll nicklist * e"
meta-f2 = "/bar scroll buflist * e"
meta-h,meta-R = "/hotlist restore -all"
meta-h,meta-c = "/hotlist clear"
meta-h,meta-m = "/hotlist remove"
meta-h,meta-r = "/hotlist restore"
meta-home = "/window scroll_top"
meta-j,0,1 = "/buffer *1"
meta-j,0,2 = "/buffer *2"
meta-j,0,3 = "/buffer *3"
meta-j,0,4 = "/buffer *4"
meta-j,0,5 = "/buffer *5"
meta-j,0,6 = "/buffer *6"
meta-j,0,7 = "/buffer *7"
meta-j,0,8 = "/buffer *8"
meta-j,0,9 = "/buffer *9"
meta-j,1,0 = "/buffer *10"
meta-j,1,1 = "/buffer *11"
meta-j,1,2 = "/buffer *12"
meta-j,1,3 = "/buffer *13"
meta-j,1,4 = "/buffer *14"
meta-j,1,5 = "/buffer *15"
meta-j,1,6 = "/buffer *16"
meta-j,1,7 = "/buffer *17"
meta-j,1,8 = "/buffer *18"
meta-j,1,9 = "/buffer *19"
meta-j,2,0 = "/buffer *20"
meta-j,2,1 = "/buffer *21"
meta-j,2,2 = "/buffer *22"
meta-j,2,3 = "/buffer *23"
meta-j,2,4 = "/buffer *24"
meta-j,2,5 = "/buffer *25"
meta-j,2,6 = "/buffer *26"
meta-j,2,7 = "/buffer *27"
meta-j,2,8 = "/buffer *28"
meta-j,2,9 = "/buffer *29"
meta-j,3,0 = "/buffer *30"
meta-j,3,1 = "/buffer *31"
meta-j,3,2 = "/buffer *32"
meta-j,3,3 = "/buffer *33"
meta-j,3,4 = "/buffer *34"
meta-j,3,5 = "/buffer *35"
meta-j,3,6 = "/buffer *36"
meta-j,3,7 = "/buffer *37"
meta-j,3,8 = "/buffer *38"
meta-j,3,9 = "/buffer *39"
meta-j,4,0 = "/buffer *40"
meta-j,4,1 = "/buffer *41"
meta-j,4,2 = "/buffer *42"
meta-j,4,3 = "/buffer *43"
meta-j,4,4 = "/buffer *44"
meta-j,4,5 = "/buffer *45"
meta-j,4,6 = "/buffer *46"
meta-j,4,7 = "/buffer *47"
meta-j,4,8 = "/buffer *48"
meta-j,4,9 = "/buffer *49"
meta-j,5,0 = "/buffer *50"
meta-j,5,1 = "/buffer *51"
meta-j,5,2 = "/buffer *52"
meta-j,5,3 = "/buffer *53"
meta-j,5,4 = "/buffer *54"
meta-j,5,5 = "/buffer *55"
meta-j,5,6 = "/buffer *56"
meta-j,5,7 = "/buffer *57"
meta-j,5,8 = "/buffer *58"
meta-j,5,9 = "/buffer *59"
meta-j,6,0 = "/buffer *60"
meta-j,6,1 = "/buffer *61"
meta-j,6,2 = "/buffer *62"
meta-j,6,3 = "/buffer *63"
meta-j,6,4 = "/buffer *64"
meta-j,6,5 = "/buffer *65"
meta-j,6,6 = "/buffer *66"
meta-j,6,7 = "/buffer *67"
meta-j,6,8 = "/buffer *68"
meta-j,6,9 = "/buffer *69"
meta-j,7,0 = "/buffer *70"
meta-j,7,1 = "/buffer *71"
meta-j,7,2 = "/buffer *72"
meta-j,7,3 = "/buffer *73"
meta-j,7,4 = "/buffer *74"
meta-j,7,5 = "/buffer *75"
meta-j,7,6 = "/buffer *76"
meta-j,7,7 = "/buffer *77"
meta-j,7,8 = "/buffer *78"
meta-j,7,9 = "/buffer *79"
meta-j,8,0 = "/buffer *80"
meta-j,8,1 = "/buffer *81"
meta-j,8,2 = "/buffer *82"
meta-j,8,3 = "/buffer *83"
meta-j,8,4 = "/buffer *84"
meta-j,8,5 = "/buffer *85"
meta-j,8,6 = "/buffer *86"
meta-j,8,7 = "/buffer *87"
meta-j,8,8 = "/buffer *88"
meta-j,8,9 = "/buffer *89"
meta-j,9,0 = "/buffer *90"
meta-j,9,1 = "/buffer *91"
meta-j,9,2 = "/buffer *92"
meta-j,9,3 = "/buffer *93"
meta-j,9,4 = "/buffer *94"
meta-j,9,5 = "/buffer *95"
meta-j,9,6 = "/buffer *96"
meta-j,9,7 = "/buffer *97"
meta-j,9,8 = "/buffer *98"
meta-j,9,9 = "/buffer *99"
meta-j,meta-f = "/buffer -"
meta-j,meta-l = "/buffer +"
meta-j,meta-r = "/server raw"
meta-j,meta-s = "/server jump"
meta-k = "/input grab_key_command"
meta-l = "/window bare"
meta-left = "/buffer -1"
meta-m = "/mute mouse toggle"
meta-n = "/window scroll_next_highlight"
meta-p = "/window scroll_previous_highlight"
meta-pgdn = "/window scroll_down"
meta-pgup = "/window scroll_up"
meta-r = "/input delete_line"
meta-s = "/mute aspell toggle"
meta-return = "/input insert \n"
meta-right = "/buffer +1"
meta-s = "/mute spell toggle"
meta-u = "/window scroll_unread"
meta-wmeta-meta2-A = "/window up"
meta-wmeta-meta2-B = "/window down"
meta-wmeta-meta2-C = "/window right"
meta-wmeta-meta2-D = "/window left"
meta-wmeta2-1;3A = "/window up"
meta-wmeta2-1;3B = "/window down"
meta-wmeta2-1;3C = "/window right"
meta-wmeta2-1;3D = "/window left"
meta-wmeta-b = "/window balance"
meta-wmeta-s = "/window swap"
meta-x = "/input zoom_merged_buffer"
meta-up = "/buffer -1"
meta-w,meta-b = "/window balance"
meta-w,meta-down = "/window down"
meta-w,meta-left = "/window left"
meta-w,meta-right = "/window right"
meta-w,meta-s = "/window swap"
meta-w,meta-up = "/window up"
meta-x = "/buffer zoom"
meta-z = "/window zoom"
ctrl-_ = "/input undo"
pgdn = "/window page_down"
pgup = "/window page_up"
return = "/input return"
right = "/input move_next_char"
shift-down = "/input move_next_line"
shift-end = "/input move_end_of_input"
shift-home = "/input move_beginning_of_input"
shift-left = "/input move_previous_char"
shift-right = "/input move_next_char"
shift-tab = "/input complete_previous"
shift-up = "/input move_previous_line"
tab = "/input complete_next"
up = "/input history_previous"
[key_search]
ctrl-I = "/input search_switch_where"
ctrl-J = "/input search_stop_here"
ctrl-M = "/input search_stop_here"
ctrl-Q = "/input search_stop"
ctrl-R = "/input search_switch_regex"
meta2-A = "/input search_previous"
meta2-B = "/input search_next"
ctrl-q = "/input search_stop"
ctrl-r = "/input search_previous"
ctrl-s = "/input search_next"
ctrl-x = "/input search_switch_regex"
down = "/input search_next"
meta-c = "/input search_switch_case"
return = "/input search_stop_here"
tab = "/input search_switch_where"
up = "/input search_previous"
[key_histsearch]
ctrl-o = "/input history_use_get_next"
ctrl-q = "/input search_stop"
ctrl-r = "/input search_previous"
ctrl-s = "/input search_next"
ctrl-x = "/input search_switch_regex"
down = "/input search_next"
meta-c = "/input search_switch_case"
return = "/input search_stop_here"
tab = "/input search_switch_where"
up = "/input search_previous"
[key_cursor]
ctrl-J = "/cursor stop"
ctrl-M = "/cursor stop"
meta-meta2-A = "/cursor move area_up"
meta-meta2-B = "/cursor move area_down"
meta-meta2-C = "/cursor move area_right"
meta-meta2-D = "/cursor move area_left"
meta2-1;3A = "/cursor move area_up"
meta2-1;3B = "/cursor move area_down"
meta2-1;3C = "/cursor move area_right"
meta2-1;3D = "/cursor move area_left"
meta2-A = "/cursor move up"
meta2-B = "/cursor move down"
meta2-C = "/cursor move right"
meta2-D = "/cursor move left"
@chat:Q = "hsignal:chat_quote_time_prefix_message;/cursor stop"
@chat:l = "hsignal:chat_quote_focused_line;/cursor stop"
@chat:m = "hsignal:chat_quote_message;/cursor stop"
@chat:q = "hsignal:chat_quote_prefix_message;/cursor stop"
@item(buffer_nicklist):K = "/window ${_window_number};/kickban ${nick}"
@item(buffer_nicklist):b = "/window ${_window_number};/ban ${nick}"
@item(buffer_nicklist):k = "/window ${_window_number};/kick ${nick}"
@item(buffer_nicklist):q = "/window ${_window_number};/query ${nick};/cursor stop"
@item(buffer_nicklist):w = "/window ${_window_number};/whois ${nick}"
@chat:Q = "hsignal:chat_quote_time_prefix_message;/cursor stop"
@chat:m = "hsignal:chat_quote_message;/cursor stop"
@chat:q = "hsignal:chat_quote_prefix_message;/cursor stop"
down = "/cursor move down"
left = "/cursor move left"
meta-down = "/cursor move edge_bottom"
meta-end = "/cursor move bottom_right"
meta-home = "/cursor move top_left"
meta-left = "/cursor move edge_left"
meta-right = "/cursor move edge_right"
meta-shift-down = "/cursor move area_down"
meta-shift-left = "/cursor move area_left"
meta-shift-right = "/cursor move area_right"
meta-shift-up = "/cursor move area_up"
meta-up = "/cursor move edge_top"
return = "/cursor stop"
right = "/cursor move right"
up = "/cursor move up"
[key_mouse]
@*:button3 = "/cursor go ${_x},${_y}"
@bar(buflist):ctrl-wheeldown = "hsignal:buflist_mouse"
@bar(buflist):ctrl-wheelup = "hsignal:buflist_mouse"
@bar(input):button2 = "/input grab_mouse_area"
@ -625,14 +665,29 @@ meta2-D = "/cursor move left"
@bar(nicklist):button1-gesture-down-long = "/bar scroll nicklist ${_window_number} e"
@bar(nicklist):button1-gesture-up = "/bar scroll nicklist ${_window_number} -100%"
@bar(nicklist):button1-gesture-up-long = "/bar scroll nicklist ${_window_number} b"
@chat(fset.fset):button1 = "/window ${_window_number};/fset -go ${_chat_line_y}"
@bar:wheeldown = "/bar scroll ${_bar_name} ${_window_number} +20%"
@bar:wheelup = "/bar scroll ${_bar_name} ${_window_number} -20%"
@chat(fset.fset):button1 = "/window ${_window_number};/fset -go ${fset_option_index}"
@chat(fset.fset):button2* = "hsignal:fset_mouse"
@chat(fset.fset):wheeldown = "/fset -down 5"
@chat(fset.fset):wheelup = "/fset -up 5"
@chat(script.scripts):button1 = "/window ${_window_number};/script go ${_chat_line_y}"
@chat(script.scripts):button2 = "/window ${_window_number};/script go ${_chat_line_y};/script installremove -q ${script_name_with_extension}"
@chat(script.scripts):wheeldown = "/script down 5"
@chat(script.scripts):wheelup = "/script up 5"
@chat(irc.list_*):button1 = "/window ${_window_number};/list -go ${_chat_line_y}"
@chat(irc.list_*):button2* = "hsignal:irc_list_mouse"
@chat(irc.list_*):wheeldown = "/list -down 5"
@chat(irc.list_*):wheelup = "/list -up 5"
@chat(script.scripts):button1 = "/window ${_window_number};/script -go ${_chat_line_y}"
@chat(script.scripts):button2 = "/window ${_window_number};/script -go ${_chat_line_y};/script installremove -q ${script_name_with_extension}"
@chat(script.scripts):wheeldown = "/script -down 5"
@chat(script.scripts):wheelup = "/script -up 5"
@chat:button1 = "/window ${_window_number}"
@chat:button1-gesture-left = "/window ${_window_number};/buffer -1"
@chat:button1-gesture-left-long = "/window ${_window_number};/buffer 1"
@chat:button1-gesture-right = "/window ${_window_number};/buffer +1"
@chat:button1-gesture-right-long = "/window ${_window_number};/buffer +"
@chat:ctrl-wheeldown = "/window scroll_horiz -window ${_window_number} +10%"
@chat:ctrl-wheelup = "/window scroll_horiz -window ${_window_number} -10%"
@chat:wheeldown = "/window scroll_down -window ${_window_number}"
@chat:wheelup = "/window scroll_up -window ${_window_number}"
@item(buffer_nicklist):button1 = "/window ${_window_number};/query ${nick}"
@item(buffer_nicklist):button1-gesture-left = "/window ${_window_number};/kick ${nick}"
@item(buffer_nicklist):button1-gesture-left-long = "/window ${_window_number};/kickban ${nick}"
@ -644,15 +699,7 @@ meta2-D = "/cursor move left"
@item(buflist2):button2* = "hsignal:buflist_mouse"
@item(buflist3):button1* = "hsignal:buflist_mouse"
@item(buflist3):button2* = "hsignal:buflist_mouse"
@bar:wheeldown = "/bar scroll ${_bar_name} ${_window_number} +20%"
@bar:wheelup = "/bar scroll ${_bar_name} ${_window_number} -20%"
@chat:button1 = "/window ${_window_number}"
@chat:button1-gesture-left = "/window ${_window_number};/buffer -1"
@chat:button1-gesture-left-long = "/window ${_window_number};/buffer 1"
@chat:button1-gesture-right = "/window ${_window_number};/buffer +1"
@chat:button1-gesture-right-long = "/window ${_window_number};/input jump_last_buffer"
@chat:ctrl-wheeldown = "/window scroll_horiz -window ${_window_number} +10%"
@chat:ctrl-wheelup = "/window scroll_horiz -window ${_window_number} -10%"
@chat:wheeldown = "/window scroll_down -window ${_window_number}"
@chat:wheelup = "/window scroll_up -window ${_window_number}"
@*:button3 = "/cursor go ${_x},${_y}"
@item(buflist4):button1* = "hsignal:buflist_mouse"
@item(buflist4):button2* = "hsignal:buflist_mouse"
@item(buflist5):button1* = "hsignal:buflist_mouse"
@item(buflist5):button2* = "hsignal:buflist_mouse"

View File

@ -0,0 +1,49 @@
#
# weechat -- xfer.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use commands like /set or /fset to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/weechat/quickstart/
#
[look]
auto_open_buffer = on
progress_bar_size = 20
pv_tags = "notify_private"
[color]
status_aborted = lightred
status_active = lightblue
status_connecting = yellow
status_done = lightgreen
status_failed = lightred
status_waiting = lightcyan
text = default
text_bg = default
text_selected = white
[network]
blocksize = 65536
fast_send = on
own_ip = ""
port_range = ""
send_ack = on
speed_limit_recv = 0
speed_limit_send = 0
timeout = 300
[file]
auto_accept_chats = off
auto_accept_files = off
auto_accept_nicks = ""
auto_check_crc32 = off
auto_rename = on
auto_resume = on
convert_spaces = on
download_path = "${weechat_data_dir}/xfer"
download_temporary_suffix = ".part"
upload_path = "~"
use_nick_in_filename = on

View File

@ -1,719 +0,0 @@
# -*- coding: utf-8 -*-
#
# Project: weechat-notify-send
# Homepage: https://github.com/s3rvac/weechat-notify-send
# Description: Sends highlight and message notifications through notify-send.
# Requires libnotify.
# License: MIT (see below)
#
# Copyright (c) 2015 by Petr Zemek <s3rvac@gmail.com> and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
from __future__ import print_function
import os
import re
import subprocess
import sys
import time
# Ensure that we are running under WeeChat.
try:
import weechat
except ImportError:
sys.exit('This script has to run under WeeChat (https://weechat.org/).')
# Name of the script.
SCRIPT_NAME = 'notify_send'
# Author of the script.
SCRIPT_AUTHOR = 's3rvac'
# Version of the script.
SCRIPT_VERSION = '0.8'
# License under which the script is distributed.
SCRIPT_LICENSE = 'MIT'
# Description of the script.
SCRIPT_DESC = 'Sends highlight and message notifications through notify-send.'
# Name of a function to be called when the script is unloaded.
SCRIPT_SHUTDOWN_FUNC = ''
# Used character set (utf-8 by default).
SCRIPT_CHARSET = ''
# Script options.
OPTIONS = {
'notify_on_highlights': (
'on',
'Send notifications on highlights.'
),
'notify_on_privmsgs': (
'on',
'Send notifications on private messages.'
),
'notify_on_filtered_messages': (
'off',
'Send notifications also on filtered (hidden) messages.'
),
'notify_when_away': (
'on',
'Send also notifications when away.'
),
'notify_for_current_buffer': (
'on',
'Send also notifications for the currently active buffer.'
),
'notify_on_all_messages_in_buffers': (
'',
'A comma-separated list of buffers for which you want to receive '
'notifications on all messages that appear in them.'
),
'notify_on_all_messages_in_buffers_that_match': (
'',
'A comma-separated list of regex patterns of buffers for which you '
'want to receive notifications on all messages that appear in them.'
),
'notify_on_messages_that_match': (
'',
'A comma-separated list of regex patterns that you want to receive '
'notifications on when message body matches.'
),
'min_notification_delay': (
'500',
'A minimal delay between successive notifications from the same '
'buffer (in milliseconds; set to 0 to show all notifications).'
),
'ignore_messages_tagged_with': (
','.join([
'notify_none', # Buffer with line is not added to hotlist
'irc_join', # Joined IRC
'irc_quit', # Quit IRC
'irc_part', # Parted a channel
'irc_status', # Status messages
'irc_nick_back', # A nick is back on server
'irc_401', # No such nick/channel
'irc_402', # No such server
]),
'A comma-separated list of message tags for which no notifications '
'should be shown.'
),
'ignore_buffers': (
'',
'A comma-separated list of buffers from which no notifications should '
'be shown.'
),
'ignore_buffers_starting_with': (
'',
'A comma-separated list of buffer prefixes from which no '
'notifications should be shown.'
),
'ignore_nicks': (
'',
'A comma-separated list of nicks from which no notifications should '
'be shown.'
),
'ignore_nicks_starting_with': (
'',
'A comma-separated list of nick prefixes from which no '
'notifications should be shown.'
),
'nick_separator': (
': ',
'A separator between a nick and a message.'
),
'escape_html': (
'on',
"Escapes the '<', '>', and '&' characters in notification messages."
),
'max_length': (
'72',
'Maximal length of a notification (0 means no limit).'
),
'ellipsis': (
'[..]',
'Ellipsis to be used for notifications that are too long.'
),
'icon': (
'/usr/share/icons/hicolor/32x32/apps/weechat.png',
'Path to an icon to be shown in notifications.'
),
'timeout': (
'5000',
'Time after which the notification disappears (in milliseconds; '
'set to 0 to disable).'
),
'transient': (
'on',
'When a notification expires or is dismissed, remove it from the '
'notification bar.'
),
'urgency': (
'normal',
'Urgency (low, normal, critical).'
)
}
class Notification(object):
"""A representation of a notification."""
def __init__(self, source, message, icon, timeout, transient, urgency):
self.source = source
self.message = message
self.icon = icon
self.timeout = timeout
self.transient = transient
self.urgency = urgency
def default_value_of(option):
"""Returns the default value of the given option."""
return OPTIONS[option][0]
def add_default_value_to(description, default_value):
"""Adds the given default value to the given option description."""
# All descriptions end with a period, so do not add another period.
return '{} Default: {}.'.format(
description,
default_value if default_value else '""'
)
def nick_that_sent_message(tags, prefix):
"""Returns a nick that sent the message based on the given data passed to
the callback.
"""
# 'tags' is a comma-separated list of tags that WeeChat passed to the
# callback. It should contain a tag of the following form: nick_XYZ, where
# XYZ is the nick that sent the message.
for tag in tags:
if tag.startswith('nick_'):
return tag[5:]
# There is no nick in the tags, so check the prefix as a fallback.
# 'prefix' (str) is the prefix of the printed line with the message.
# Usually (but not always), it is a nick with an optional mode (e.g. on
# IRC, @ denotes an operator and + denotes a user with voice). We have to
# remove the mode (if any) before returning the nick.
# Strip also a space as some protocols (e.g. Matrix) may start prefixes
# with a space. It probably means that the nick has no mode set.
if prefix.startswith(('~', '&', '@', '%', '+', '-', ' ')):
return prefix[1:]
return prefix
def parse_tags(tags):
"""Parses the given "list" of tags (str) from WeeChat into a list."""
return tags.split(',')
def message_printed_callback(data, buffer, date, tags, is_displayed,
is_highlight, prefix, message):
"""A callback when a message is printed."""
is_displayed = int(is_displayed)
is_highlight = int(is_highlight)
tags = parse_tags(tags)
nick = nick_that_sent_message(tags, prefix)
if notification_should_be_sent(buffer, tags, nick, is_displayed, is_highlight, message):
notification = prepare_notification(buffer, nick, message)
send_notification(notification)
return weechat.WEECHAT_RC_OK
def notification_should_be_sent(buffer, tags, nick, is_displayed, is_highlight, message):
"""Should a notification be sent?"""
if notification_should_be_sent_disregarding_time(buffer, tags, nick,
is_displayed, is_highlight, message):
# The following function should be called only when the notification
# should be sent (it updates the last notification time).
if not is_below_min_notification_delay(buffer):
return True
return False
def notification_should_be_sent_disregarding_time(buffer, tags, nick,
is_displayed, is_highlight, message):
"""Should a notification be sent when not considering time?"""
if not nick:
# A nick is required to form a correct notification source/message.
return False
if i_am_author_of_message(buffer, nick):
return False
if not is_displayed:
if not notify_on_filtered_messages():
return False
if buffer == weechat.current_buffer():
if not notify_for_current_buffer():
return False
if is_away(buffer):
if not notify_when_away():
return False
if ignore_notifications_from_messages_tagged_with(tags):
return False
if ignore_notifications_from_nick(nick):
return False
if ignore_notifications_from_buffer(buffer):
return False
if is_private_message(buffer):
return notify_on_private_messages()
if is_highlight:
return notify_on_highlights()
if notify_on_messages_that_match(message):
return True
if notify_on_all_messages_in_buffer(buffer):
return True
return False
def is_below_min_notification_delay(buffer):
"""Is a notification in the given buffer below the minimal delay between
successive notifications from the same buffer?
When called, this function updates the time of the last notification.
"""
# We store the time of the last notification in a buffer-local variable to
# make it persistent over the lifetime of this script.
LAST_NOTIFICATION_TIME_VAR = 'notify_send_last_notification_time'
last_notification_time = buffer_get_float(
buffer,
'localvar_' + LAST_NOTIFICATION_TIME_VAR
)
min_notification_delay = weechat.config_get_plugin('min_notification_delay')
# min_notification_delay is in milliseconds (str). To compare it with
# last_notification_time (float in seconds), we have to convert it to
# seconds (float).
min_notification_delay = float(min_notification_delay) / 1000
current_time = time.time()
# We have to update the last notification time before returning the result.
buffer_set_float(
buffer,
'localvar_set_' + LAST_NOTIFICATION_TIME_VAR,
current_time
)
return (min_notification_delay > 0 and
current_time - last_notification_time < min_notification_delay)
def buffer_get_float(buffer, property):
"""A variant of weechat.buffer_get_x() for floats.
This variant is needed because WeeChat supports only buffer_get_string()
and buffer_get_int().
"""
value = weechat.buffer_get_string(buffer, property)
return float(value) if value else 0.0
def buffer_set_float(buffer, property, value):
"""A variant of weechat.buffer_set() for floats.
This variant is needed because WeeChat supports only integers and strings.
"""
weechat.buffer_set(buffer, property, str(value))
def names_for_buffer(buffer):
"""Returns a list of all names for the given buffer."""
# The 'buffer' parameter passed to our callback is actually the buffer's ID
# (e.g. '0x2719cf0'). We have to check its name (e.g. 'freenode.#weechat')
# and short name (e.g. '#weechat') because these are what users specify in
# their configs.
buffer_names = []
full_name = weechat.buffer_get_string(buffer, 'name')
if full_name:
buffer_names.append(full_name)
short_name = weechat.buffer_get_string(buffer, 'short_name')
if short_name:
buffer_names.append(short_name)
# Consider >channel and #channel to be equal buffer names. The reason
# is that the https://github.com/rawdigits/wee-slack script replaces
# '#' with '>' to indicate that someone in the buffer is typing. This
# fixes the behavior of several configuration options (e.g.
# 'notify_on_all_messages_in_buffers') when weechat_notify_send is used
# together with the wee_slack script.
#
# Note that this is only needed to be done for the short name. Indeed,
# the full name always stays unchanged.
if short_name.startswith('>'):
buffer_names.append('#' + short_name[1:])
return buffer_names
def notify_for_current_buffer():
"""Should we also send notifications for the current buffer?"""
return weechat.config_get_plugin('notify_for_current_buffer') == 'on'
def notify_on_highlights():
"""Should we send notifications on highlights?"""
return weechat.config_get_plugin('notify_on_highlights') == 'on'
def notify_on_private_messages():
"""Should we send notifications on private messages?"""
return weechat.config_get_plugin('notify_on_privmsgs') == 'on'
def notify_on_filtered_messages():
"""Should we also send notifications for filtered (hidden) messages?"""
return weechat.config_get_plugin('notify_on_filtered_messages') == 'on'
def notify_when_away():
"""Should we also send notifications when away?"""
return weechat.config_get_plugin('notify_when_away') == 'on'
def is_away(buffer):
"""Is the user away?"""
return weechat.buffer_get_string(buffer, 'localvar_away') != ''
def is_private_message(buffer):
"""Has a private message been sent?"""
return weechat.buffer_get_string(buffer, 'localvar_type') == 'private'
def i_am_author_of_message(buffer, nick):
"""Am I (the current WeeChat user) the author of the message?"""
return weechat.buffer_get_string(buffer, 'localvar_nick') == nick
def split_option_value(option, separator=','):
"""Splits the value of the given plugin option by the given separator and
returns the result in a list.
"""
values = weechat.config_get_plugin(option)
if not values:
# When there are no values, return the empty list instead of [''].
return []
return [value.strip() for value in values.split(separator)]
def ignore_notifications_from_messages_tagged_with(tags):
"""Should notifications be ignored for a message tagged with the given
tags?
"""
ignored_tags = split_option_value('ignore_messages_tagged_with')
for ignored_tag in ignored_tags:
for tag in tags:
if tag == ignored_tag:
return True
return False
def ignore_notifications_from_buffer(buffer):
"""Should notifications from the given buffer be ignored?"""
buffer_names = names_for_buffer(buffer)
for buffer_name in buffer_names:
if buffer_name and buffer_name in ignored_buffers():
return True
for buffer_name in buffer_names:
for prefix in ignored_buffer_prefixes():
if prefix and buffer_name and buffer_name.startswith(prefix):
return True
return False
def ignored_buffers():
"""A generator of buffers from which notifications should be ignored."""
for buffer in split_option_value('ignore_buffers'):
yield buffer
def ignored_buffer_prefixes():
"""A generator of buffer prefixes from which notifications should be
ignored.
"""
for prefix in split_option_value('ignore_buffers_starting_with'):
yield prefix
def ignore_notifications_from_nick(nick):
"""Should notifications from the given nick be ignored?"""
if nick in ignored_nicks():
return True
for prefix in ignored_nick_prefixes():
if prefix and nick.startswith(prefix):
return True
return False
def ignored_nicks():
"""A generator of nicks from which notifications should be ignored."""
for nick in split_option_value('ignore_nicks'):
yield nick
def ignored_nick_prefixes():
"""A generator of nick prefixes from which notifications should be
ignored.
"""
for prefix in split_option_value('ignore_nicks_starting_with'):
yield prefix
def notify_on_messages_that_match(message):
"""Should we send a notification for the given message, provided it matches
any of the requested patterns?
"""
message_patterns = split_option_value('notify_on_messages_that_match')
for pattern in message_patterns:
if re.search(pattern, message):
return True
return False
def buffers_to_notify_on_all_messages():
"""A generator of buffer names in which the user wants to be notified for
all messages.
"""
for buffer in split_option_value('notify_on_all_messages_in_buffers'):
yield buffer
def buffer_patterns_to_notify_on_all_messages():
"""A generator of buffer-name patterns in which the user wants to be
notifier for all messages.
"""
for pattern in split_option_value('notify_on_all_messages_in_buffers_that_match'):
yield pattern
def notify_on_all_messages_in_buffer(buffer):
"""Does the user want to be notified for all messages in the given buffer?
"""
buffer_names = names_for_buffer(buffer)
# Option notify_on_all_messages_in_buffers:
for buf in buffers_to_notify_on_all_messages():
if buf in buffer_names:
return True
# Option notify_on_all_messages_in_buffers_that_match:
for pattern in buffer_patterns_to_notify_on_all_messages():
for buf in buffer_names:
if re.search(pattern, buf):
return True
return False
def prepare_notification(buffer, nick, message):
"""Prepares a notification from the given data."""
if is_private_message(buffer):
source = nick
else:
source = (weechat.buffer_get_string(buffer, 'short_name') or
weechat.buffer_get_string(buffer, 'name'))
message = nick + nick_separator() + message
max_length = int(weechat.config_get_plugin('max_length'))
if max_length > 0:
ellipsis = weechat.config_get_plugin('ellipsis')
message = shorten_message(message, max_length, ellipsis)
if weechat.config_get_plugin('escape_html') == 'on':
message = escape_html(message)
message = escape_slashes(message)
icon = weechat.config_get_plugin('icon')
timeout = weechat.config_get_plugin('timeout')
transient = should_notifications_be_transient()
urgency = weechat.config_get_plugin('urgency')
return Notification(source, message, icon, timeout, transient, urgency)
def should_notifications_be_transient():
"""Should the sent notifications be transient, i.e. should they be removed
from the notification bar once they expire or are dismissed?
"""
return weechat.config_get_plugin('transient') == 'on'
def nick_separator():
"""Returns a nick separator to be used."""
separator = weechat.config_get_plugin('nick_separator')
return separator if separator else default_value_of('nick_separator')
def shorten_message(message, max_length, ellipsis):
"""Shortens the message to at most max_length characters by using the given
ellipsis.
"""
# In Python 2, we need to decode the message and ellipsis into Unicode to
# correctly (1) detect their length and (2) shorten the message. Failing to
# do that could make the shortened message invalid and cause notify-send to
# fail. For example, when we have bytes, we cannot guarantee that we do not
# split the message inside of a multibyte character.
if sys.version_info.major == 2:
try:
message = message.decode('utf-8')
ellipsis = ellipsis.decode('utf-8')
except UnicodeDecodeError:
# Either (or both) of the two cannot be decoded. Continue in a
# best-effort manner.
pass
message = shorten_unicode_message(message, max_length, ellipsis)
if sys.version_info.major == 2:
if not isinstance(message, str):
message = message.encode('utf-8')
return message
def shorten_unicode_message(message, max_length, ellipsis):
"""An internal specialized version of shorten_message() when the both the
message and ellipsis are str (in Python 3) or unicode (in Python 2).
"""
if max_length <= 0 or len(message) <= max_length:
# Nothing to shorten.
return message
if len(ellipsis) >= max_length:
# We cannot include any part of the message.
return ellipsis[:max_length]
return message[:max_length - len(ellipsis)] + ellipsis
def escape_html(message):
"""Escapes HTML characters in the given message."""
# Only the following characters need to be escaped
# (https://wiki.ubuntu.com/NotificationDevelopmentGuidelines).
message = message.replace('&', '&amp;')
message = message.replace('<', '&lt;')
message = message.replace('>', '&gt;')
return message
def escape_slashes(message):
"""Escapes slashes in the given message."""
# We need to escape backslashes to prevent notify-send from interpreting
# them, e.g. we do not want to print a newline when the message contains
# '\n'.
return message.replace('\\', r'\\')
def send_notification(notification):
"""Sends the given notification to the user."""
notify_cmd = ['notify-send', '--app-name', 'weechat']
if notification.icon:
notify_cmd += ['--icon', notification.icon]
if notification.timeout:
notify_cmd += ['--expire-time', str(notification.timeout)]
if notification.transient:
notify_cmd += ['--hint', 'int:transient:1']
if notification.urgency:
notify_cmd += ['--urgency', notification.urgency]
# We need to add '--' before the source and message to ensure that
# notify-send considers the remaining parameters as the source and the
# message. This prevents errors when a source or message starts with '--'.
notify_cmd += [
'--',
# notify-send fails with "No summary specified." when no source is
# specified, so ensure that there is always a non-empty source.
notification.source or '-',
notification.message
]
# Prevent notify-send from messing up the WeeChat screen when occasionally
# emitting assertion messages by redirecting the output to /dev/null (users
# would need to run /redraw to fix the screen).
# In Python < 3.3, there is no subprocess.DEVNULL, so we have to use a
# workaround.
with open(os.devnull, 'wb') as devnull:
try:
subprocess.check_call(
notify_cmd,
stderr=subprocess.STDOUT,
stdout=devnull,
)
except Exception as ex:
error_message = '{} (reason: {!r}). {}'.format(
'Failed to send the notification via notify-send',
'{}: {}'.format(ex.__class__.__name__, ex),
'Ensure that you have notify-send installed in your system.',
)
print(error_message, file=sys.stderr)
if __name__ == '__main__':
# Registration.
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESC,
SCRIPT_SHUTDOWN_FUNC,
SCRIPT_CHARSET
)
# Initialization.
for option, (default_value, description) in OPTIONS.items():
description = add_default_value_to(description, default_value)
weechat.config_set_desc_plugin(option, description)
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default_value)
# Catch all messages on all buffers and strip colors from them before
# passing them into the callback.
weechat.hook_print('', '', '', 1, 'message_printed_callback', '')

View File

@ -1,719 +0,0 @@
# -*- coding: utf-8 -*-
#
# Project: weechat-notify-send
# Homepage: https://github.com/s3rvac/weechat-notify-send
# Description: Sends highlight and message notifications through notify-send.
# Requires libnotify.
# License: MIT (see below)
#
# Copyright (c) 2015 by Petr Zemek <s3rvac@gmail.com> and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
from __future__ import print_function
import os
import re
import subprocess
import sys
import time
# Ensure that we are running under WeeChat.
try:
import weechat
except ImportError:
sys.exit('This script has to run under WeeChat (https://weechat.org/).')
# Name of the script.
SCRIPT_NAME = 'notify_send'
# Author of the script.
SCRIPT_AUTHOR = 's3rvac'
# Version of the script.
SCRIPT_VERSION = '0.8'
# License under which the script is distributed.
SCRIPT_LICENSE = 'MIT'
# Description of the script.
SCRIPT_DESC = 'Sends highlight and message notifications through notify-send.'
# Name of a function to be called when the script is unloaded.
SCRIPT_SHUTDOWN_FUNC = ''
# Used character set (utf-8 by default).
SCRIPT_CHARSET = ''
# Script options.
OPTIONS = {
'notify_on_highlights': (
'on',
'Send notifications on highlights.'
),
'notify_on_privmsgs': (
'on',
'Send notifications on private messages.'
),
'notify_on_filtered_messages': (
'off',
'Send notifications also on filtered (hidden) messages.'
),
'notify_when_away': (
'on',
'Send also notifications when away.'
),
'notify_for_current_buffer': (
'on',
'Send also notifications for the currently active buffer.'
),
'notify_on_all_messages_in_buffers': (
'',
'A comma-separated list of buffers for which you want to receive '
'notifications on all messages that appear in them.'
),
'notify_on_all_messages_in_buffers_that_match': (
'',
'A comma-separated list of regex patterns of buffers for which you '
'want to receive notifications on all messages that appear in them.'
),
'notify_on_messages_that_match': (
'',
'A comma-separated list of regex patterns that you want to receive '
'notifications on when message body matches.'
),
'min_notification_delay': (
'500',
'A minimal delay between successive notifications from the same '
'buffer (in milliseconds; set to 0 to show all notifications).'
),
'ignore_messages_tagged_with': (
','.join([
'notify_none', # Buffer with line is not added to hotlist
'irc_join', # Joined IRC
'irc_quit', # Quit IRC
'irc_part', # Parted a channel
'irc_status', # Status messages
'irc_nick_back', # A nick is back on server
'irc_401', # No such nick/channel
'irc_402', # No such server
]),
'A comma-separated list of message tags for which no notifications '
'should be shown.'
),
'ignore_buffers': (
'',
'A comma-separated list of buffers from which no notifications should '
'be shown.'
),
'ignore_buffers_starting_with': (
'',
'A comma-separated list of buffer prefixes from which no '
'notifications should be shown.'
),
'ignore_nicks': (
'',
'A comma-separated list of nicks from which no notifications should '
'be shown.'
),
'ignore_nicks_starting_with': (
'',
'A comma-separated list of nick prefixes from which no '
'notifications should be shown.'
),
'nick_separator': (
': ',
'A separator between a nick and a message.'
),
'escape_html': (
'on',
"Escapes the '<', '>', and '&' characters in notification messages."
),
'max_length': (
'72',
'Maximal length of a notification (0 means no limit).'
),
'ellipsis': (
'[..]',
'Ellipsis to be used for notifications that are too long.'
),
'icon': (
'/usr/share/icons/hicolor/32x32/apps/weechat.png',
'Path to an icon to be shown in notifications.'
),
'timeout': (
'5000',
'Time after which the notification disappears (in milliseconds; '
'set to 0 to disable).'
),
'transient': (
'on',
'When a notification expires or is dismissed, remove it from the '
'notification bar.'
),
'urgency': (
'normal',
'Urgency (low, normal, critical).'
)
}
class Notification(object):
"""A representation of a notification."""
def __init__(self, source, message, icon, timeout, transient, urgency):
self.source = source
self.message = message
self.icon = icon
self.timeout = timeout
self.transient = transient
self.urgency = urgency
def default_value_of(option):
"""Returns the default value of the given option."""
return OPTIONS[option][0]
def add_default_value_to(description, default_value):
"""Adds the given default value to the given option description."""
# All descriptions end with a period, so do not add another period.
return '{} Default: {}.'.format(
description,
default_value if default_value else '""'
)
def nick_that_sent_message(tags, prefix):
"""Returns a nick that sent the message based on the given data passed to
the callback.
"""
# 'tags' is a comma-separated list of tags that WeeChat passed to the
# callback. It should contain a tag of the following form: nick_XYZ, where
# XYZ is the nick that sent the message.
for tag in tags:
if tag.startswith('nick_'):
return tag[5:]
# There is no nick in the tags, so check the prefix as a fallback.
# 'prefix' (str) is the prefix of the printed line with the message.
# Usually (but not always), it is a nick with an optional mode (e.g. on
# IRC, @ denotes an operator and + denotes a user with voice). We have to
# remove the mode (if any) before returning the nick.
# Strip also a space as some protocols (e.g. Matrix) may start prefixes
# with a space. It probably means that the nick has no mode set.
if prefix.startswith(('~', '&', '@', '%', '+', '-', ' ')):
return prefix[1:]
return prefix
def parse_tags(tags):
"""Parses the given "list" of tags (str) from WeeChat into a list."""
return tags.split(',')
def message_printed_callback(data, buffer, date, tags, is_displayed,
is_highlight, prefix, message):
"""A callback when a message is printed."""
is_displayed = int(is_displayed)
is_highlight = int(is_highlight)
tags = parse_tags(tags)
nick = nick_that_sent_message(tags, prefix)
if notification_should_be_sent(buffer, tags, nick, is_displayed, is_highlight, message):
notification = prepare_notification(buffer, nick, message)
send_notification(notification)
return weechat.WEECHAT_RC_OK
def notification_should_be_sent(buffer, tags, nick, is_displayed, is_highlight, message):
"""Should a notification be sent?"""
if notification_should_be_sent_disregarding_time(buffer, tags, nick,
is_displayed, is_highlight, message):
# The following function should be called only when the notification
# should be sent (it updates the last notification time).
if not is_below_min_notification_delay(buffer):
return True
return False
def notification_should_be_sent_disregarding_time(buffer, tags, nick,
is_displayed, is_highlight, message):
"""Should a notification be sent when not considering time?"""
if not nick:
# A nick is required to form a correct notification source/message.
return False
if i_am_author_of_message(buffer, nick):
return False
if not is_displayed:
if not notify_on_filtered_messages():
return False
if buffer == weechat.current_buffer():
if not notify_for_current_buffer():
return False
if is_away(buffer):
if not notify_when_away():
return False
if ignore_notifications_from_messages_tagged_with(tags):
return False
if ignore_notifications_from_nick(nick):
return False
if ignore_notifications_from_buffer(buffer):
return False
if is_private_message(buffer):
return notify_on_private_messages()
if is_highlight:
return notify_on_highlights()
if notify_on_messages_that_match(message):
return True
if notify_on_all_messages_in_buffer(buffer):
return True
return False
def is_below_min_notification_delay(buffer):
"""Is a notification in the given buffer below the minimal delay between
successive notifications from the same buffer?
When called, this function updates the time of the last notification.
"""
# We store the time of the last notification in a buffer-local variable to
# make it persistent over the lifetime of this script.
LAST_NOTIFICATION_TIME_VAR = 'notify_send_last_notification_time'
last_notification_time = buffer_get_float(
buffer,
'localvar_' + LAST_NOTIFICATION_TIME_VAR
)
min_notification_delay = weechat.config_get_plugin('min_notification_delay')
# min_notification_delay is in milliseconds (str). To compare it with
# last_notification_time (float in seconds), we have to convert it to
# seconds (float).
min_notification_delay = float(min_notification_delay) / 1000
current_time = time.time()
# We have to update the last notification time before returning the result.
buffer_set_float(
buffer,
'localvar_set_' + LAST_NOTIFICATION_TIME_VAR,
current_time
)
return (min_notification_delay > 0 and
current_time - last_notification_time < min_notification_delay)
def buffer_get_float(buffer, property):
"""A variant of weechat.buffer_get_x() for floats.
This variant is needed because WeeChat supports only buffer_get_string()
and buffer_get_int().
"""
value = weechat.buffer_get_string(buffer, property)
return float(value) if value else 0.0
def buffer_set_float(buffer, property, value):
"""A variant of weechat.buffer_set() for floats.
This variant is needed because WeeChat supports only integers and strings.
"""
weechat.buffer_set(buffer, property, str(value))
def names_for_buffer(buffer):
"""Returns a list of all names for the given buffer."""
# The 'buffer' parameter passed to our callback is actually the buffer's ID
# (e.g. '0x2719cf0'). We have to check its name (e.g. 'freenode.#weechat')
# and short name (e.g. '#weechat') because these are what users specify in
# their configs.
buffer_names = []
full_name = weechat.buffer_get_string(buffer, 'name')
if full_name:
buffer_names.append(full_name)
short_name = weechat.buffer_get_string(buffer, 'short_name')
if short_name:
buffer_names.append(short_name)
# Consider >channel and #channel to be equal buffer names. The reason
# is that the https://github.com/rawdigits/wee-slack script replaces
# '#' with '>' to indicate that someone in the buffer is typing. This
# fixes the behavior of several configuration options (e.g.
# 'notify_on_all_messages_in_buffers') when weechat_notify_send is used
# together with the wee_slack script.
#
# Note that this is only needed to be done for the short name. Indeed,
# the full name always stays unchanged.
if short_name.startswith('>'):
buffer_names.append('#' + short_name[1:])
return buffer_names
def notify_for_current_buffer():
"""Should we also send notifications for the current buffer?"""
return weechat.config_get_plugin('notify_for_current_buffer') == 'on'
def notify_on_highlights():
"""Should we send notifications on highlights?"""
return weechat.config_get_plugin('notify_on_highlights') == 'on'
def notify_on_private_messages():
"""Should we send notifications on private messages?"""
return weechat.config_get_plugin('notify_on_privmsgs') == 'on'
def notify_on_filtered_messages():
"""Should we also send notifications for filtered (hidden) messages?"""
return weechat.config_get_plugin('notify_on_filtered_messages') == 'on'
def notify_when_away():
"""Should we also send notifications when away?"""
return weechat.config_get_plugin('notify_when_away') == 'on'
def is_away(buffer):
"""Is the user away?"""
return weechat.buffer_get_string(buffer, 'localvar_away') != ''
def is_private_message(buffer):
"""Has a private message been sent?"""
return weechat.buffer_get_string(buffer, 'localvar_type') == 'private'
def i_am_author_of_message(buffer, nick):
"""Am I (the current WeeChat user) the author of the message?"""
return weechat.buffer_get_string(buffer, 'localvar_nick') == nick
def split_option_value(option, separator=','):
"""Splits the value of the given plugin option by the given separator and
returns the result in a list.
"""
values = weechat.config_get_plugin(option)
if not values:
# When there are no values, return the empty list instead of [''].
return []
return [value.strip() for value in values.split(separator)]
def ignore_notifications_from_messages_tagged_with(tags):
"""Should notifications be ignored for a message tagged with the given
tags?
"""
ignored_tags = split_option_value('ignore_messages_tagged_with')
for ignored_tag in ignored_tags:
for tag in tags:
if tag == ignored_tag:
return True
return False
def ignore_notifications_from_buffer(buffer):
"""Should notifications from the given buffer be ignored?"""
buffer_names = names_for_buffer(buffer)
for buffer_name in buffer_names:
if buffer_name and buffer_name in ignored_buffers():
return True
for buffer_name in buffer_names:
for prefix in ignored_buffer_prefixes():
if prefix and buffer_name and buffer_name.startswith(prefix):
return True
return False
def ignored_buffers():
"""A generator of buffers from which notifications should be ignored."""
for buffer in split_option_value('ignore_buffers'):
yield buffer
def ignored_buffer_prefixes():
"""A generator of buffer prefixes from which notifications should be
ignored.
"""
for prefix in split_option_value('ignore_buffers_starting_with'):
yield prefix
def ignore_notifications_from_nick(nick):
"""Should notifications from the given nick be ignored?"""
if nick in ignored_nicks():
return True
for prefix in ignored_nick_prefixes():
if prefix and nick.startswith(prefix):
return True
return False
def ignored_nicks():
"""A generator of nicks from which notifications should be ignored."""
for nick in split_option_value('ignore_nicks'):
yield nick
def ignored_nick_prefixes():
"""A generator of nick prefixes from which notifications should be
ignored.
"""
for prefix in split_option_value('ignore_nicks_starting_with'):
yield prefix
def notify_on_messages_that_match(message):
"""Should we send a notification for the given message, provided it matches
any of the requested patterns?
"""
message_patterns = split_option_value('notify_on_messages_that_match')
for pattern in message_patterns:
if re.search(pattern, message):
return True
return False
def buffers_to_notify_on_all_messages():
"""A generator of buffer names in which the user wants to be notified for
all messages.
"""
for buffer in split_option_value('notify_on_all_messages_in_buffers'):
yield buffer
def buffer_patterns_to_notify_on_all_messages():
"""A generator of buffer-name patterns in which the user wants to be
notifier for all messages.
"""
for pattern in split_option_value('notify_on_all_messages_in_buffers_that_match'):
yield pattern
def notify_on_all_messages_in_buffer(buffer):
"""Does the user want to be notified for all messages in the given buffer?
"""
buffer_names = names_for_buffer(buffer)
# Option notify_on_all_messages_in_buffers:
for buf in buffers_to_notify_on_all_messages():
if buf in buffer_names:
return True
# Option notify_on_all_messages_in_buffers_that_match:
for pattern in buffer_patterns_to_notify_on_all_messages():
for buf in buffer_names:
if re.search(pattern, buf):
return True
return False
def prepare_notification(buffer, nick, message):
"""Prepares a notification from the given data."""
if is_private_message(buffer):
source = nick
else:
source = (weechat.buffer_get_string(buffer, 'short_name') or
weechat.buffer_get_string(buffer, 'name'))
message = nick + nick_separator() + message
max_length = int(weechat.config_get_plugin('max_length'))
if max_length > 0:
ellipsis = weechat.config_get_plugin('ellipsis')
message = shorten_message(message, max_length, ellipsis)
if weechat.config_get_plugin('escape_html') == 'on':
message = escape_html(message)
message = escape_slashes(message)
icon = weechat.config_get_plugin('icon')
timeout = weechat.config_get_plugin('timeout')
transient = should_notifications_be_transient()
urgency = weechat.config_get_plugin('urgency')
return Notification(source, message, icon, timeout, transient, urgency)
def should_notifications_be_transient():
"""Should the sent notifications be transient, i.e. should they be removed
from the notification bar once they expire or are dismissed?
"""
return weechat.config_get_plugin('transient') == 'on'
def nick_separator():
"""Returns a nick separator to be used."""
separator = weechat.config_get_plugin('nick_separator')
return separator if separator else default_value_of('nick_separator')
def shorten_message(message, max_length, ellipsis):
"""Shortens the message to at most max_length characters by using the given
ellipsis.
"""
# In Python 2, we need to decode the message and ellipsis into Unicode to
# correctly (1) detect their length and (2) shorten the message. Failing to
# do that could make the shortened message invalid and cause notify-send to
# fail. For example, when we have bytes, we cannot guarantee that we do not
# split the message inside of a multibyte character.
if sys.version_info.major == 2:
try:
message = message.decode('utf-8')
ellipsis = ellipsis.decode('utf-8')
except UnicodeDecodeError:
# Either (or both) of the two cannot be decoded. Continue in a
# best-effort manner.
pass
message = shorten_unicode_message(message, max_length, ellipsis)
if sys.version_info.major == 2:
if not isinstance(message, str):
message = message.encode('utf-8')
return message
def shorten_unicode_message(message, max_length, ellipsis):
"""An internal specialized version of shorten_message() when the both the
message and ellipsis are str (in Python 3) or unicode (in Python 2).
"""
if max_length <= 0 or len(message) <= max_length:
# Nothing to shorten.
return message
if len(ellipsis) >= max_length:
# We cannot include any part of the message.
return ellipsis[:max_length]
return message[:max_length - len(ellipsis)] + ellipsis
def escape_html(message):
"""Escapes HTML characters in the given message."""
# Only the following characters need to be escaped
# (https://wiki.ubuntu.com/NotificationDevelopmentGuidelines).
message = message.replace('&', '&amp;')
message = message.replace('<', '&lt;')
message = message.replace('>', '&gt;')
return message
def escape_slashes(message):
"""Escapes slashes in the given message."""
# We need to escape backslashes to prevent notify-send from interpreting
# them, e.g. we do not want to print a newline when the message contains
# '\n'.
return message.replace('\\', r'\\')
def send_notification(notification):
"""Sends the given notification to the user."""
notify_cmd = ['notify-send', '--app-name', 'weechat']
if notification.icon:
notify_cmd += ['--icon', notification.icon]
if notification.timeout:
notify_cmd += ['--expire-time', str(notification.timeout)]
if notification.transient:
notify_cmd += ['--hint', 'int:transient:1']
if notification.urgency:
notify_cmd += ['--urgency', notification.urgency]
# We need to add '--' before the source and message to ensure that
# notify-send considers the remaining parameters as the source and the
# message. This prevents errors when a source or message starts with '--'.
notify_cmd += [
'--',
# notify-send fails with "No summary specified." when no source is
# specified, so ensure that there is always a non-empty source.
notification.source or '-',
notification.message
]
# Prevent notify-send from messing up the WeeChat screen when occasionally
# emitting assertion messages by redirecting the output to /dev/null (users
# would need to run /redraw to fix the screen).
# In Python < 3.3, there is no subprocess.DEVNULL, so we have to use a
# workaround.
with open(os.devnull, 'wb') as devnull:
try:
subprocess.check_call(
notify_cmd,
stderr=subprocess.STDOUT,
stdout=devnull,
)
except Exception as ex:
error_message = '{} (reason: {!r}). {}'.format(
'Failed to send the notification via notify-send',
'{}: {}'.format(ex.__class__.__name__, ex),
'Ensure that you have notify-send installed in your system.',
)
print(error_message, file=sys.stderr)
if __name__ == '__main__':
# Registration.
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESC,
SCRIPT_SHUTDOWN_FUNC,
SCRIPT_CHARSET
)
# Initialization.
for option, (default_value, description) in OPTIONS.items():
description = add_default_value_to(description, default_value)
weechat.config_set_desc_plugin(option, description)
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default_value)
# Catch all messages on all buffers and strip colors from them before
# passing them into the callback.
weechat.hook_print('', '', '', 1, 'message_printed_callback', '')