dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit d7ed10a61c45da4860b43f7c7edc883843aa19db
parent 676942a3a8fb3534b60a86e18d2d4a12739ba57a
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sat, 23 Dec 2017 13:15:26 -0500

Add IRSSI, newsboat configs

Diffstat:
A.irssi/apprentice.theme | 294+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/config | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/default.theme | 294+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/login | 2++
A.irssi/scripts/autorun/keyring.pl | 90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/scripts/autorun/nicklist.pl | 611+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.newsboat/bookmark-pinboard.sh | 26++++++++++++++++++++++++++
A.newsboat/config | 17+++++++++++++++++
8 files changed, 1729 insertions(+), 0 deletions(-)

diff --git a/.irssi/apprentice.theme b/.irssi/apprentice.theme @@ -0,0 +1,294 @@ +# When testing changes, the easiest way to reload the theme is with /RELOAD. +# This reloads the configuration file too, so if you did any changes remember +# to /SAVE it first. Remember also that /SAVE overwrites the theme file with +# old data so keep backups :) + +# TEMPLATES: + +# The real text formats that irssi uses are the ones you can find with +# /FORMAT command. Back in the old days all the colors and texts were mixed +# up in those formats, and it was really hard to change the colors since you +# might have had to change them in tens of different places. So, then came +# this templating system. + +# Now the /FORMATs don't have any colors in them, and they also have very +# little other styling. Most of the stuff you need to change is in this +# theme file. If you can't change something here, you can always go back +# to change the /FORMATs directly, they're also saved in these .theme files. + +# So .. the templates. They're those {blahblah} parts you see all over the +# /FORMATs and here. Their usage is simply {name parameter1 parameter2}. +# When irssi sees this kind of text, it goes to find "name" from abstracts +# block below and sets "parameter1" into $0 and "parameter2" into $1 (you +# can have more parameters of course). Templates can have subtemplates. +# Here's a small example: +# /FORMAT format hello {colorify {underline world}} +# abstracts = { colorify = "%Z87af87$0-%Zbcbcbc"; underline = "%U$0-%U"; } +# When irssi expands the templates in "format", the final string would be: +# hello %Z87af87%Uworld%U%Zbcbcbc +# ie. underlined bright green "world" text. +# and why "$0-", why not "$0"? $0 would only mean the first parameter, +# $0- means all the parameters. With {underline hello world} you'd really +# want to underline both of the words, not just the hello (and world would +# actually be removed entirely). + +# COLORS: + +# You can find definitions for the color format codes in docs/formats.txt. + +# There's one difference here though. %Zbcbcbc format. Normally it means the +# default color of the terminal (white mostly), but here it means the +# "reset color back to the one it was in higher template". For example +# if there was /FORMAT test %Z87af87{foo}bar, and foo = "%Y$0%Zbcbcbc", irssi would +# print yellow "foo" (as set with %Y) but "bar" would be green, which was +# set at the beginning before the {foo} template. If there wasn't the %Z87af87 +# at start, the normal behaviour of %Zbcbcbc would occur. If you _really_ want +# to use the terminal's default color, use %Zbcbcbc. + +############################################################################# + +# default foreground color (%Zbcbcbc) - -1 is the "default terminal color" +default_color = "-1"; + +# print timestamp/servertag at the end of line, not at beginning +info_eol = "false"; + +# these characters are automatically replaced with specified color +# (dark grey by default) +replaces = { "[]=" = "%Z6c6c6c$*%Zbcbcbc"; }; + +abstracts = { + ## + ## generic + ## + + # text to insert at the beginning of each non-message line + line_start = "%Z5f87af-%Zbcbcbc!%Z5f87af-%Zbcbcbc "; + + # timestamp styling, nothing by default + timestamp = "%Zbcbcbc$*"; + + # any kind of text that needs hilighting, default is to bold + hilight = "%Zffffff$*%Zbcbcbc"; + + # any kind of error message, default is bright red + error = "%Zff8700$*%Zbcbcbc"; + + # channel name is printed + channel = "%Zffffff$*%Zbcbcbc"; + + # nick is printed + nick = "%Zffffff$*%Zbcbcbc"; + + # nick host is printed + nickhost = "%Zbcbcbc[$*]"; + + # server name is printed + server = "%Zffffff$*%Zbcbcbc"; + + # some kind of comment is printed + comment = "%Zbcbcbc[$*]"; + + # reason for something is printed (part, quit, kick, ..) + reason = "{comment $*}"; + + # mode change is printed ([+o nick]) + mode = "{comment $*}"; + + ## + ## channel specific messages + ## + + # highlighted nick/host is printed (joins) + channick_hilight = "%Z87af87$*%Zbcbcbc"; + chanhost_hilight = "{nickhost %Z87af87$*%Zbcbcbc}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%Z8787af$*%Zbcbcbc"; + chanhost = "{nickhost %Z8787af$*}"; + + # highlighted channel name is printed + channelhilight = "%Z8787af$*%Zbcbcbc"; + + # ban/ban exception/invite list mask is printed + ban = "%Z87af87$*%Zbcbcbc"; + + ## + ## messages + ## + + # the basic styling of how to print message, $0 = nick mode, $1 = nick + msgnick = "%Z87af87<%Zbcbcbc$0$1-%Z87af87>%Zbcbcbc %|"; + + # message from you is printed. "ownnick" specifies the styling of the + # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the + # whole line. + + # Example1: You want the message text to be green: + # ownmsgnick = "{msgnick $0 $1-}%Z87af87"; + # Example2.1: You want < and > chars to be yellow: + # ownmsgnick = "%Y{msgnick $0 $1-%Y}%Zbcbcbc"; + # (you'll also have to remove <> from replaces list above) + # Example2.2: But you still want to keep <> grey for other messages: + # pubmsgnick = "%Z87af87{msgnick $0 $1-%Z87af87}%Zbcbcbc"; + # pubmsgmenick = "%Z87af87{msgnick $0 $1-%Z87af87}%Zbcbcbc"; + # pubmsghinick = "%Z87af87{msgnick $1 $0$2-%Zbcbcbc%Z87af87}%Zbcbcbc"; + # ownprivmsgnick = "%Z87af87{msgnick $*%Z87af87}%Zbcbcbc"; + # privmsgnick = "%Z87af87{msgnick %Zff8700$*%Z87af87}%Zbcbcbc"; + + # $0 = nick mode, $1 = nick + ownmsgnick = "{msgnick $0 $1-}"; + ownnick = "%Zffffff$*%Zbcbcbc"; + + # public message in channel, $0 = nick mode, $1 = nick + pubmsgnick = "{msgnick $0 $1-}"; + pubnick = "%Zbcbcbc$*%Zbcbcbc"; + + # public message in channel meant for me, $0 = nick mode, $1 = nick + pubmsgmenick = "{msgnick $0 $1-}"; + menick = "%Zffffaf$*%Zbcbcbc"; + + # public highlighted message in channel + # $0 = highlight color, $1 = nick mode, $2 = nick + pubmsghinick = "{msgnick $1 $0$2-%Zbcbcbc}"; + + # channel name is printed with message + msgchannel = "%Z87af87:%Z5f5f87$*%Zbcbcbc"; + + # private message, $0 = nick, $1 = host + privmsg = "[%Zff8700$0%Z87af87(%Zaf5f5f$1-%Z87af87)%Zbcbcbc] "; + + # private message from you, $0 = "msg", $1 = target nick + ownprivmsg = "[%Zaf5f5f$0%Z87af87(%Zff8700$1-%Z87af87)%Zbcbcbc] "; + + # own private message in query + ownprivmsgnick = "{msgnick $*}"; + ownprivnick = "%Zffffff$*%Zbcbcbc"; + + # private message in query + privmsgnick = "{msgnick %Zff8700$*%Zbcbcbc}"; + + ## + ## Actions (/ME stuff) + ## + + # used internally by this theme + action_core = "%Zffffff * $*%Zbcbcbc"; + + # generic one that's used by most actions + action = "{action_core $*} "; + + # own action, both private/public + ownaction = "{action $*}"; + + # own action with target, both private/public + ownaction_target = "{action_core $0}%Z87af87:%Z5f5f87$1%Zbcbcbc "; + + # private action sent by others + pvtaction = "%Zffffff (*) $*%Zbcbcbc "; + pvtaction_query = "{action $*}"; + + # public action sent by others + pubaction = "{action $*}"; + + + ## + ## other IRC events + ## + + # whois + whois = "%# $[8]0 : $1-"; + + # notices + ownnotice = "[%Zaf5f5f$0%Z87af87(%Zff8700$1-%Z87af87)]%Zbcbcbc "; + notice = "%Z87af87-%Z5fafaf$*%Z87af87-%Zbcbcbc "; + pubnotice_channel = "%Z87af87:%Z5fafaf$*"; + pvtnotice_host = "%Z87af87(%Z5fafaf$*%Z87af87)"; + servernotice = "%Z87af87!$*%Zbcbcbc "; + + # CTCPs + ownctcp = "[%Zaf5f5f$0%Z87af87(%Zff8700$1-%Z87af87)] "; + ctcp = "%Z87af87$*%Zbcbcbc"; + + # wallops + wallop = "%Zffffff$*%Zbcbcbc: "; + wallop_nick = "%Zbcbcbc$*"; + wallop_action = "%Zffffff * $*%Zbcbcbc "; + + # netsplits + netsplit = "%Zff8700$*%Zbcbcbc"; + netjoin = "%Z8787af$*%Zbcbcbc"; + + # /names list + names_prefix = ""; + names_nick = "[%_$0%_$1-] "; + names_nick_op = "{names_nick $*}"; + names_nick_halfop = "{names_nick $*}"; + names_nick_voice = "{names_nick $*}"; + names_users = "[%Z87af87$*%Zbcbcbc]"; + names_channel = "%Z87af87$*%Zbcbcbc"; + + # DCC + dcc = "%$*%Zbcbcbc"; + dccfile = "%Zffffff$*%Zbcbcbc"; + + # DCC chat, own msg/action + dccownmsg = "[%Zaf5f5f$0%Z87af87($1-%Z87af87)%Zbcbcbc] "; + dccownnick = "%Zff8700$*%Zbcbcbc"; + dccownquerynick = "%Zffffff$*%Zbcbcbc"; + dccownaction = "{action $*}"; + dccownaction_target = "{action_core $0}%Z87af87:%Z5f5f87$1%Zbcbcbc "; + + # DCC chat, others + dccmsg = "[%Z87af87$1-%Z87af87(%Z87af87$0%Z87af87)%Zbcbcbc] "; + dccquerynick = "%Z87af87$*%Zbcbcbc"; + dccaction = "%Zffffff (*dcc*) $*%Zbcbcbc %|"; + + ## + ## statusbar + ## + + # default background for all statusbars. You can also give + # the default foreground color for statusbar items. + sb_background = "%z87875f%Z262626"; + + # default backround for "default" statusbar group + #sb_default_bg = "%4"; + # background for prompt / input line + sb_prompt_bg = "%Zbcbcbc"; + # background for info statusbar + sb_info_bg = "%Z585858"; + # background for topicbar (same default) + #sb_topic_bg = "%4"; + + # text at the beginning of statusbars. sb-item already puts + # space there,so we don't use anything by default. + sbstart = ""; + # text at the end of statusbars. Use space so that it's never + # used for anything. + sbend = " "; + + topicsbstart = "{sbstart $*}"; + topicsbend = "{sbend $*}"; + + prompt = "[$*] "; + + sb = " %Z262626[$*]"; + sbmode = "%Z262626(+$*)"; + sbaway = " %Z262626(zZzZ)"; + sbservertag = ":$0 (change with ^X)"; + sbnickmode = "$0"; + + # activity in statusbar + + # ',' separator + sb_act_sep = "%Z262626$*"; + # normal text + sb_act_text = "%Z262626$*"; + # public message + sb_act_msg = "%Zbcbcbc$*"; + # hilight + sb_act_hilight = "%Zff8700$*"; + # hilight with specified color, $0 = color, $1 = text + sb_act_hilight_color = "$0$1-%Z262626"; +}; diff --git a/.irssi/config b/.irssi/config @@ -0,0 +1,395 @@ +servers = ( + { + address = "chat.freenode.net"; + chatnet = "Freenode"; + port = "7000"; + use_tls = "yes"; + tls_verify = "yes"; + }, + { + address = "irc.mozilla.org"; + chatnet = "Mozilla"; + port = "6697"; + use_tls = "yes"; + tls_verify = "yes"; + } +); + +chatnets = { + Freenode = { + type = "IRC"; + max_kicks = "1"; + max_msgs = "4"; + max_whois = "1"; + }; + Mozilla = { + type = "IRC"; + max_kicks = "1"; + max_msgs = "4"; + max_whois = "1"; + }; +}; + +channels = ( + { name = "#irssi"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#keybase"; chatnet = "Freenode"; autojoin = "No"; }, + { name = "#tmux"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#firefox"; chatnet = "Mozilla"; autojoin = "Yes"; }, + { + name = "#archlinux-offtopic"; + chatnet = "Freenode"; + autojoin = "Yes"; + }, + { name = "#vim"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#archlinux"; chatnet = "freenode"; autojoin = "yes"; } +); + +aliases = { + ATAG = "WINDOW SERVER"; + ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}"; + B = "BAN"; + BACK = "AWAY"; + BANS = "BAN"; + BYE = "QUIT"; + C = "CLEAR"; + CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi"; + CHAT = "DCC CHAT"; + CUBES = "SCRIPT EXEC Irssi::active_win->print(\"%_bases\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x0\\${_}0\\$_\" } '0'..'9','A'..'F' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_cubes\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { my \\$y = \\$_*6 \\; join '', map { my \\$x = \\$_ \\; map { \"%x\\$x\\$_\\$x\\$_\" } @{['0'..'9','A'..'Z']}[\\$y .. \\$y+5] } 1..6 }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) for 0..5 \\; Irssi::active_win->print(\"%_grays\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x7\\${_}7\\$_\" } 'A'..'X' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_mIRC extended colours\", MSGLEVEL_CLIENTCRAP) \\; my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 0..15 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; for my \\$z (0..6) { my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 16+(\\$z*12)..16+(\\$z*12)+11 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) }"; + DATE = "TIME"; + DEHIGHLIGHT = "DEHILIGHT"; + DESCRIBE = "ACTION"; + DHL = "DEHILIGHT"; + EXEMPTLIST = "MODE $C +e"; + EXIT = "QUIT"; + GOTO = "SCROLLBACK GOTO"; + HIGHLIGHT = "HILIGHT"; + HL = "HILIGHT"; + HOST = "USERHOST"; + INVITELIST = "MODE $C +I"; + J = "JOIN"; + K = "KICK"; + KB = "KICKBAN"; + KN = "KNOCKOUT"; + LAST = "LASTLOG"; + LEAVE = "PART"; + M = "MSG"; + MUB = "UNBAN *"; + N = "NAMES"; + NMSG = "^MSG"; + P = "PART"; + Q = "QUERY"; + RESET = "SET -default"; + RUN = "SCRIPT LOAD"; + SAY = "MSG *"; + SB = "SCROLLBACK"; + SBAR = "STATUSBAR"; + SIGNOFF = "QUIT"; + SV = "MSG * Irssi $J ($V) - http://www.irssi.org"; + T = "TOPIC"; + UB = "UNBAN"; + UMODE = "MODE $N"; + UNSET = "SET -clear"; + W = "WHO"; + WC = "WINDOW CLOSE"; + WG = "WINDOW GOTO"; + WJOIN = "JOIN -window"; + WI = "WHOIS"; + WII = "WHOIS $0 $0"; + WL = "WINDOW LIST"; + WN = "WINDOW NEW HIDDEN"; + WQUERY = "QUERY -window"; + WW = "WHOWAS"; + 1 = "WINDOW GOTO 1"; + 2 = "WINDOW GOTO 2"; + 3 = "WINDOW GOTO 3"; + 4 = "WINDOW GOTO 4"; + 5 = "WINDOW GOTO 5"; + 6 = "WINDOW GOTO 6"; + 7 = "WINDOW GOTO 7"; + 8 = "WINDOW GOTO 8"; + 9 = "WINDOW GOTO 9"; + 10 = "WINDOW GOTO 10"; + 11 = "WINDOW GOTO 11"; + 12 = "WINDOW GOTO 12"; + 13 = "WINDOW GOTO 13"; + 14 = "WINDOW GOTO 14"; + 15 = "WINDOW GOTO 15"; + 16 = "WINDOW GOTO 16"; + 17 = "WINDOW GOTO 17"; + 18 = "WINDOW GOTO 18"; + 19 = "WINDOW GOTO 19"; + 20 = "WINDOW GOTO 20"; + 21 = "WINDOW GOTO 21"; + 22 = "WINDOW GOTO 22"; + 23 = "WINDOW GOTO 23"; + 24 = "WINDOW GOTO 24"; + 25 = "WINDOW GOTO 25"; + 26 = "WINDOW GOTO 26"; + 27 = "WINDOW GOTO 27"; + 28 = "WINDOW GOTO 28"; + 29 = "WINDOW GOTO 29"; + 30 = "WINDOW GOTO 30"; + 31 = "WINDOW GOTO 31"; + 32 = "WINDOW GOTO 32"; + 33 = "WINDOW GOTO 33"; + 34 = "WINDOW GOTO 34"; + 35 = "WINDOW GOTO 35"; + 36 = "WINDOW GOTO 36"; + 37 = "WINDOW GOTO 37"; + 38 = "WINDOW GOTO 38"; + 39 = "WINDOW GOTO 39"; + 40 = "WINDOW GOTO 40"; + 41 = "WINDOW GOTO 41"; + 42 = "WINDOW GOTO 42"; + 43 = "WINDOW GOTO 43"; + 44 = "WINDOW GOTO 44"; + 45 = "WINDOW GOTO 45"; + 46 = "WINDOW GOTO 46"; + 47 = "WINDOW GOTO 47"; + 48 = "WINDOW GOTO 48"; + 49 = "WINDOW GOTO 49"; + 50 = "WINDOW GOTO 50"; + 51 = "WINDOW GOTO 51"; + 52 = "WINDOW GOTO 52"; + 53 = "WINDOW GOTO 53"; + 54 = "WINDOW GOTO 54"; + 55 = "WINDOW GOTO 55"; + 56 = "WINDOW GOTO 56"; + 57 = "WINDOW GOTO 57"; + 58 = "WINDOW GOTO 58"; + 59 = "WINDOW GOTO 59"; + 60 = "WINDOW GOTO 60"; + 61 = "WINDOW GOTO 61"; + 62 = "WINDOW GOTO 62"; + 63 = "WINDOW GOTO 63"; + 64 = "WINDOW GOTO 64"; + 65 = "WINDOW GOTO 65"; + 66 = "WINDOW GOTO 66"; + 67 = "WINDOW GOTO 67"; + 68 = "WINDOW GOTO 68"; + 69 = "WINDOW GOTO 69"; + 70 = "WINDOW GOTO 70"; + 71 = "WINDOW GOTO 71"; + 72 = "WINDOW GOTO 72"; + 73 = "WINDOW GOTO 73"; + 74 = "WINDOW GOTO 74"; + 75 = "WINDOW GOTO 75"; + 76 = "WINDOW GOTO 76"; + 77 = "WINDOW GOTO 77"; + 78 = "WINDOW GOTO 78"; + 79 = "WINDOW GOTO 79"; + 80 = "WINDOW GOTO 80"; + 81 = "WINDOW GOTO 81"; + 82 = "WINDOW GOTO 82"; + 83 = "WINDOW GOTO 83"; + 84 = "WINDOW GOTO 84"; + 85 = "WINDOW GOTO 85"; + 86 = "WINDOW GOTO 86"; + 87 = "WINDOW GOTO 87"; + 88 = "WINDOW GOTO 88"; + 89 = "WINDOW GOTO 89"; + 90 = "WINDOW GOTO 90"; + 91 = "WINDOW GOTO 91"; + 92 = "WINDOW GOTO 92"; + 93 = "WINDOW GOTO 93"; + 94 = "WINDOW GOTO 94"; + 95 = "WINDOW GOTO 95"; + 96 = "WINDOW GOTO 96"; + 97 = "WINDOW GOTO 97"; + 98 = "WINDOW GOTO 98"; + 99 = "WINDOW GOTO 99"; +}; + +statusbar = { + + items = { + + barstart = "{sbstart}"; + barend = "{sbend}"; + + topicbarstart = "{topicsbstart}"; + topicbarend = "{topicsbend}"; + + time = "{sb $Z}"; + user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}"; + + window = "{sb $winref:$tag/$itemname{sbmode $M}}"; + window_empty = "{sb $winref{sbservertag $tag}}"; + + prompt = "{prompt $[.15]itemname}"; + prompt_empty = "{prompt $winname}"; + + topic = " $topic"; + topic_empty = " Irssi v$J - http://www.irssi.org"; + + lag = "{sb Lag: $0-}"; + act = "{sb Act: $0-}"; + more = "-- more --"; + }; + + default = { + + window = { + + disabled = "no"; + type = "window"; + placement = "bottom"; + position = "1"; + visible = "active"; + + items = { + barstart = { priority = "100"; }; + time = { }; + user = { }; + window = { }; + window_empty = { }; + lag = { priority = "-1"; }; + act = { priority = "10"; }; + more = { priority = "-1"; alignment = "right"; }; + barend = { priority = "100"; alignment = "right"; }; + }; + }; + + window_inact = { + + type = "window"; + placement = "bottom"; + position = "1"; + visible = "inactive"; + + items = { + barstart = { priority = "100"; }; + window = { }; + window_empty = { }; + more = { priority = "-1"; alignment = "right"; }; + barend = { priority = "100"; alignment = "right"; }; + }; + }; + + prompt = { + + type = "root"; + placement = "bottom"; + position = "100"; + visible = "always"; + + items = { + prompt = { priority = "-1"; }; + prompt_empty = { priority = "-1"; }; + input = { priority = "10"; }; + }; + }; + + topic = { + + type = "root"; + placement = "top"; + position = "1"; + visible = "always"; + + items = { + topicbarstart = { priority = "100"; }; + topic = { }; + topic_empty = { }; + topicbarend = { priority = "100"; alignment = "right"; }; + }; + }; + }; +}; +settings = { + core = { + real_name = "Daniel Moch"; + user_name = "djmoch"; + nick = "djmoch"; + }; + "fe-text" = { actlist_sort = "refnum"; }; + "fe-common/core" = { + hilight_nick_matches_everywhere = "yes"; + use_status_window = "yes"; + theme = "apprentice"; + }; + "perl/core/scripts" = { nicklist_height = "55"; nicklist_width = "29"; }; +}; +keyboard = ( + { key = "meta-d"; id = "command"; data = "nicklist scroll +55"; }, + { key = "meta-u"; id = "command"; data = "nicklist scroll -55"; } +); +windows = { + 1 = { immortal = "yes"; name = "(status)"; level = "ALL"; }; + 2 = { + items = ( + { + type = "CHANNEL"; + chat_type = "IRC"; + name = "#vim"; + tag = "Freenode"; + } + ); + sticky = "yes"; + }; + 3 = { + items = ( + { + type = "CHANNEL"; + chat_type = "IRC"; + name = "#tmux"; + tag = "Freenode"; + } + ); + sticky = "yes"; + parent = "2"; + }; + 4 = { + items = ( + { + type = "CHANNEL"; + chat_type = "IRC"; + name = "#irssi"; + tag = "Freenode"; + } + ); + sticky = "yes"; + parent = "2"; + }; + 5 = { + items = ( + { + type = "CHANNEL"; + chat_type = "IRC"; + name = "#firefox"; + tag = "Mozilla"; + } + ); + sticky = "yes"; + parent = "2"; + }; + 6 = { + items = ( + { + type = "CHANNEL"; + chat_type = "IRC"; + name = "#archlinux-offtopic"; + tag = "Freenode"; + } + ); + sticky = "yes"; + parent = "2"; + }; + 7 = { + items = ( + { + type = "CHANNEL"; + chat_type = "IRC"; + name = "#archlinux"; + tag = "Freenode"; + } + ); + sticky = "yes"; + parent = "2"; + }; +}; +mainwindows = { + 1 = { first_line = "43"; lines = "11"; }; + 2 = { first_line = "1"; lines = "42"; }; +}; +logs = { }; diff --git a/.irssi/default.theme b/.irssi/default.theme @@ -0,0 +1,294 @@ +# When testing changes, the easiest way to reload the theme is with /RELOAD. +# This reloads the configuration file too, so if you did any changes remember +# to /SAVE it first. Remember also that /SAVE overwrites the theme file with +# old data so keep backups :) + +# TEMPLATES: + +# The real text formats that irssi uses are the ones you can find with +# /FORMAT command. Back in the old days all the colors and texts were mixed +# up in those formats, and it was really hard to change the colors since you +# might have had to change them in tens of different places. So, then came +# this templating system. + +# Now the /FORMATs don't have any colors in them, and they also have very +# little other styling. Most of the stuff you need to change is in this +# theme file. If you can't change something here, you can always go back +# to change the /FORMATs directly, they're also saved in these .theme files. + +# So .. the templates. They're those {blahblah} parts you see all over the +# /FORMATs and here. Their usage is simply {name parameter1 parameter2}. +# When irssi sees this kind of text, it goes to find "name" from abstracts +# block below and sets "parameter1" into $0 and "parameter2" into $1 (you +# can have more parameters of course). Templates can have subtemplates. +# Here's a small example: +# /FORMAT format hello {colorify {underline world}} +# abstracts = { colorify = "%G$0-%n"; underline = "%U$0-%U"; } +# When irssi expands the templates in "format", the final string would be: +# hello %G%Uworld%U%n +# ie. underlined bright green "world" text. +# and why "$0-", why not "$0"? $0 would only mean the first parameter, +# $0- means all the parameters. With {underline hello world} you'd really +# want to underline both of the words, not just the hello (and world would +# actually be removed entirely). + +# COLORS: + +# You can find definitions for the color format codes in docs/formats.txt. + +# There's one difference here though. %n format. Normally it means the +# default color of the terminal (white mostly), but here it means the +# "reset color back to the one it was in higher template". For example +# if there was /FORMAT test %g{foo}bar, and foo = "%Y$0%n", irssi would +# print yellow "foo" (as set with %Y) but "bar" would be green, which was +# set at the beginning before the {foo} template. If there wasn't the %g +# at start, the normal behaviour of %n would occur. If you _really_ want +# to use the terminal's default color, use %N. + +############################################################################# + +# default foreground color (%N) - -1 is the "default terminal color" +default_color = "-1"; + +# print timestamp/servertag at the end of line, not at beginning +info_eol = "false"; + +# these characters are automatically replaced with specified color +# (dark grey by default) +replaces = { "[]=" = "%K$*%n"; }; + +abstracts = { + ## + ## generic + ## + + # text to insert at the beginning of each non-message line + line_start = "%B-%n!%B-%n "; + + # timestamp styling, nothing by default + timestamp = "$*"; + + # any kind of text that needs hilighting, default is to bold + hilight = "%_$*%_"; + + # any kind of error message, default is bright red + error = "%R$*%n"; + + # channel name is printed + channel = "%_$*%_"; + + # nick is printed + nick = "%_$*%_"; + + # nick host is printed + nickhost = "[$*]"; + + # server name is printed + server = "%_$*%_"; + + # some kind of comment is printed + comment = "[$*]"; + + # reason for something is printed (part, quit, kick, ..) + reason = "{comment $*}"; + + # mode change is printed ([+o nick]) + mode = "{comment $*}"; + + ## + ## channel specific messages + ## + + # highlighted nick/host is printed (joins) + channick_hilight = "%C$*%n"; + chanhost_hilight = "{nickhost %c$*%n}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%c$*%n"; + chanhost = "{nickhost $*}"; + + # highlighted channel name is printed + channelhilight = "%c$*%n"; + + # ban/ban exception/invite list mask is printed + ban = "%c$*%n"; + + ## + ## messages + ## + + # the basic styling of how to print message, $0 = nick mode, $1 = nick + msgnick = "%K<%n$0$1-%K>%n %|"; + + # message from you is printed. "ownnick" specifies the styling of the + # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the + # whole line. + + # Example1: You want the message text to be green: + # ownmsgnick = "{msgnick $0 $1-}%g"; + # Example2.1: You want < and > chars to be yellow: + # ownmsgnick = "%Y{msgnick $0 $1-%Y}%n"; + # (you'll also have to remove <> from replaces list above) + # Example2.2: But you still want to keep <> grey for other messages: + # pubmsgnick = "%K{msgnick $0 $1-%K}%n"; + # pubmsgmenick = "%K{msgnick $0 $1-%K}%n"; + # pubmsghinick = "%K{msgnick $1 $0$2-%n%K}%n"; + # ownprivmsgnick = "%K{msgnick $*%K}%n"; + # privmsgnick = "%K{msgnick %R$*%K}%n"; + + # $0 = nick mode, $1 = nick + ownmsgnick = "{msgnick $0 $1-}"; + ownnick = "%_$*%n"; + + # public message in channel, $0 = nick mode, $1 = nick + pubmsgnick = "{msgnick $0 $1-}"; + pubnick = "%N$*%n"; + + # public message in channel meant for me, $0 = nick mode, $1 = nick + pubmsgmenick = "{msgnick $0 $1-}"; + menick = "%Y$*%n"; + + # public highlighted message in channel + # $0 = highlight color, $1 = nick mode, $2 = nick + pubmsghinick = "{msgnick $1 $0$2-%n}"; + + # channel name is printed with message + msgchannel = "%K:%c$*%n"; + + # private message, $0 = nick, $1 = host + privmsg = "[%R$0%K(%r$1-%K)%n] "; + + # private message from you, $0 = "msg", $1 = target nick + ownprivmsg = "[%r$0%K(%R$1-%K)%n] "; + + # own private message in query + ownprivmsgnick = "{msgnick $*}"; + ownprivnick = "%_$*%n"; + + # private message in query + privmsgnick = "{msgnick %R$*%n}"; + + ## + ## Actions (/ME stuff) + ## + + # used internally by this theme + action_core = "%_ * $*%n"; + + # generic one that's used by most actions + action = "{action_core $*} "; + + # own action, both private/public + ownaction = "{action $*}"; + + # own action with target, both private/public + ownaction_target = "{action_core $0}%K:%c$1%n "; + + # private action sent by others + pvtaction = "%_ (*) $*%n "; + pvtaction_query = "{action $*}"; + + # public action sent by others + pubaction = "{action $*}"; + + + ## + ## other IRC events + ## + + # whois + whois = "%# $[8]0 : $1-"; + + # notices + ownnotice = "[%r$0%K(%R$1-%K)]%n "; + notice = "%K-%M$*%K-%n "; + pubnotice_channel = "%K:%m$*"; + pvtnotice_host = "%K(%m$*%K)"; + servernotice = "%g!$*%n "; + + # CTCPs + ownctcp = "[%r$0%K(%R$1-%K)] "; + ctcp = "%g$*%n"; + + # wallops + wallop = "%_$*%n: "; + wallop_nick = "%n$*"; + wallop_action = "%_ * $*%n "; + + # netsplits + netsplit = "%R$*%n"; + netjoin = "%C$*%n"; + + # /names list + names_prefix = ""; + names_nick = "[%_$0%_$1-] "; + names_nick_op = "{names_nick $*}"; + names_nick_halfop = "{names_nick $*}"; + names_nick_voice = "{names_nick $*}"; + names_users = "[%g$*%n]"; + names_channel = "%G$*%n"; + + # DCC + dcc = "%g$*%n"; + dccfile = "%_$*%_"; + + # DCC chat, own msg/action + dccownmsg = "[%r$0%K($1-%K)%n] "; + dccownnick = "%R$*%n"; + dccownquerynick = "%_$*%n"; + dccownaction = "{action $*}"; + dccownaction_target = "{action_core $0}%K:%c$1%n "; + + # DCC chat, others + dccmsg = "[%G$1-%K(%g$0%K)%n] "; + dccquerynick = "%G$*%n"; + dccaction = "%_ (*dcc*) $*%n %|"; + + ## + ## statusbar + ## + + # default background for all statusbars. You can also give + # the default foreground color for statusbar items. + sb_background = "%4%w"; + + # default backround for "default" statusbar group + #sb_default_bg = "%4"; + # background for prompt / input line + sb_prompt_bg = "%n"; + # background for info statusbar + sb_info_bg = "%8"; + # background for topicbar (same default) + #sb_topic_bg = "%4"; + + # text at the beginning of statusbars. sb-item already puts + # space there,so we don't use anything by default. + sbstart = ""; + # text at the end of statusbars. Use space so that it's never + # used for anything. + sbend = " "; + + topicsbstart = "{sbstart $*}"; + topicsbend = "{sbend $*}"; + + prompt = "[$*] "; + + sb = " %c[%n$*%c]%n"; + sbmode = "(%c+%n$*)"; + sbaway = " (%GzZzZ%n)"; + sbservertag = ":$0 (change with ^X)"; + sbnickmode = "$0"; + + # activity in statusbar + + # ',' separator + sb_act_sep = "%c$*"; + # normal text + sb_act_text = "%c$*"; + # public message + sb_act_msg = "%W$*"; + # hilight + sb_act_hilight = "%M$*"; + # hilight with specified color, $0 = color, $1 = text + sb_act_hilight_color = "$0$1-%n"; +}; diff --git a/.irssi/login b/.irssi/login @@ -0,0 +1,2 @@ +connect freenode 7000 <password:account@djmoch@service@net.freenode.chat> djmoch +connect mozilla 6697 <password:account@djmoch@service@org.mozilla.irc> djmoch diff --git a/.irssi/scripts/autorun/keyring.pl b/.irssi/scripts/autorun/keyring.pl @@ -0,0 +1,90 @@ +# This script lightly modified from the original, found at: +# https://github.com/ervandew/keyring/blob/master/irssi/scripts/keyring.pl +use strict; + +use IPC::Open3; +use Irssi; +use Symbol; + +Irssi::command_bind keyring => sub { + my ($account) = @_; + + open(LOGIN, "$ENV{HOME}/.irssi/login"); + while (<LOGIN>) { + chomp; + my $command = $_; + my @parts = split(/\s/, $command); + my $username; + my $chatnet; + my $nick; + my $username_alt; + if ($parts[0] eq 'connect'){ + if (scalar(@parts) >= 5){ + $chatnet = "$parts[1]"; + $nick = "$parts[4]"; + $username = "$parts[4]\@$parts[1]"; + } + }else{ + next; + } + + # handle alternate username + if ($command =~ m/.*<password:([^>]*)>.*/){ + $username_alt = $1; + $username_alt =~ s/@/ /g; + } + + # handle reset command + if ($account eq 'reset'){ + Irssi::command("network modify -sasl_mechanism '' -sasl_username '' -sasl_password '' $chatnet"); + next + } + + # just print available account names + if ($account eq 'names') { + if ($username){ + print $username; + }elsif ($username_alt){ + print $username_alt; + } + next; + } + + if ($account && $account ne $username && $account ne $username_alt){ + next; + } + + if (!$username && !$username_alt){ + next; + } + + my ($stdin, $stdout, $stderr); + $stderr = gensym(); + if ($username_alt){ + $username = $username_alt; + } + my $pid = open3($stdin, $stdout, $stderr, "secret-tool lookup $username"); + waitpid($pid, 0); + + my $status = $? >> 8; + if ($status == 0){ + my $password = join('', <$stdout>); + chomp($password); + if ($parts[0] eq 'set'){ + print "keyring: setting $username"; + Irssi::settings_set_str($username, $password); + }else{ + print "keyring: connecting $username"; + $command =~ s/<password(:[^>]*)?>/$password/; + Irssi::command("network modify -sasl_mechanism PLAIN -sasl_username $nick -sasl_password $password $chatnet"); + Irssi::command("connect $chatnet"); + } + }else{ + my $error = join('', <$stderr>); + die "Error reading data from stderr: $!" if !eof($stderr); + chomp($error); + print "keyring: Error invoking keyring command: $error"; + } + } + close(LOGIN); +}; diff --git a/.irssi/scripts/autorun/nicklist.pl b/.irssi/scripts/autorun/nicklist.pl @@ -0,0 +1,611 @@ +# for documentation: see http://wouter.coekaerts.be/site/irssi/nicklist + +use Irssi; +use strict; +use IO::Handle; # for (auto)flush +use Fcntl; # for sysopen +use vars qw($VERSION %IRSSI); +$VERSION = '0.4.6'; +%IRSSI = ( + authors => 'Wouter Coekaerts', + contact => 'coekie@irssi.org', + name => 'nicklist', + description => 'draws a nicklist to another terminal, or at the right of your irssi in the same terminal', + license => 'GPLv2', + url => 'http://wouter.coekaerts.be/irssi', + changed => '29/06/2004' +); + +sub cmd_help { + print ( <<EOF +Commands: +NICKLIST HELP +NICKLIST SCROLL <nr of lines> +NICKLIST SCREEN +NICKLIST FIFO +NICKLIST OFF +NICKLIST UPDATE + +For help see: http://wouter.coekaerts.be/site/irssi/nicklist + +in short: + +1. FIFO MODE +- in irssi: /NICKLIST FIFO (only the first time, to create the fifo) +- in a shell, in a window where you want the nicklist: cat ~/.irssi/nicklistfifo +- back in irssi: + /SET nicklist_heigth <height of nicklist> + /SET nicklist_width <width of nicklist> + /NICKLIST FIFO + +2. SCREEN MODE +- start irssi inside screen ("screen irssi") +- /NICKLIST SCREEN +EOF + ); +} + +my $prev_lines = 0; # number of lines in previous written nicklist +my $scroll_pos = 0; # scrolling position +my $cursor_line; # line the cursor is currently on +my ($OFF, $SCREEN, $FIFO) = (0,1,2); # modes +my $mode = $OFF; # current mode +my $need_redraw = 0; # nicklist needs redrawing +my $screen_resizing = 0; # terminal is being resized +my $active_channel; # (REC) + +my @nicklist=(); # array of hashes, containing the internal nicklist of the active channel + # nick => realnick + # mode => + my ($MODE_OP, $MODE_HALFOP, $MODE_VOICE, $MODE_NORMAL) = (0,1,2,3); + # status => + my ($STATUS_NORMAL, $STATUS_JOINING, $STATUS_PARTING, $STATUS_QUITING, $STATUS_KICKED, $STATUS_SPLIT) = (0,1,2,3,4,5); + # text => text to be printed + # cmp => text used to compare (sort) nicks + + +# 'cached' settings +my ($screen_prefix, $irssi_width, @prefix_mode, @prefix_status, $height, $nicklist_width); + +sub read_settings { + ($screen_prefix = Irssi::settings_get_str('nicklist_screen_prefix')) =~ s/\\e/\033/g; + + ($prefix_mode[$MODE_OP] = Irssi::settings_get_str('nicklist_prefix_mode_op')) =~ s/\\e/\033/g; + ($prefix_mode[$MODE_HALFOP] = Irssi::settings_get_str('nicklist_prefix_mode_halfop')) =~ s/\\e/\033/g; + ($prefix_mode[$MODE_VOICE] = Irssi::settings_get_str('nicklist_prefix_mode_voice')) =~ s/\\e/\033/g; + ($prefix_mode[$MODE_NORMAL] = Irssi::settings_get_str('nicklist_prefix_mode_normal')) =~ s/\\e/\033/g; + + if ($mode != $SCREEN) { + $height = Irssi::settings_get_int('nicklist_height'); + } + my $new_nicklist_width = Irssi::settings_get_int('nicklist_width'); + if ($new_nicklist_width != $nicklist_width && $mode == $SCREEN) { + sig_terminal_resized(); + } + $nicklist_width = $new_nicklist_width; +} + +sub update { + read_settings(); + make_nicklist(); +} + +################## +##### OUTPUT ##### +################## + +### off ### + +sub cmd_off { + if ($mode == $SCREEN) { + screen_stop(); + } elsif ($mode == $FIFO) { + fifo_stop(); + } +} + +### fifo ### + +sub cmd_fifo_start { + read_settings(); + my $path = Irssi::settings_get_str('nicklist_fifo_path'); + unless (-p $path) { # not a pipe + if (-e _) { # but a something else + die "$0: $path exists and is not a pipe, please remove it\n"; + } else { + require POSIX; + POSIX::mkfifo($path, 0666) or die "can\'t mkfifo $path: $!"; + Irssi::print("Fifo created. Start reading it (\"cat $path\") and try again."); + return; + } + } + if (!sysopen(FIFO, $path, O_WRONLY | O_NONBLOCK)) { # or die "can't write $path: $!"; + Irssi::print("Couldn\'t write to the fifo ($!). Please start reading the fifo (\"cat $path\") and try again."); + return; + } + FIFO->autoflush(1); + print FIFO "\033[2J\033[1;1H"; # erase screen & jump to 0,0 + $cursor_line = 0; + if ($mode == $SCREEN) { + screen_stop(); + } + $mode = $FIFO; + make_nicklist(); +} + +sub fifo_stop { + close FIFO; + $mode = $OFF; + Irssi::print("Fifo closed."); +} + +### screen ### + +sub cmd_screen_start { + if (!defined($ENV{'STY'})) { + Irssi::print 'screen not detected, screen mode only works inside screen'; + return; + } + read_settings(); + if ($mode == $SCREEN) {return;} + if ($mode == $FIFO) { + fifo_stop(); + } + $mode = $SCREEN; + Irssi::signal_add_last('gui print text finished', \&sig_gui_print_text_finished); + Irssi::signal_add_last('gui page scrolled', \&sig_page_scrolled); + Irssi::signal_add('terminal resized', \&sig_terminal_resized); + screen_size(); + make_nicklist(); +} + +sub screen_stop { + $mode = $OFF; + Irssi::signal_remove('gui print text finished', \&sig_gui_print_text_finished); + Irssi::signal_remove('gui page scrolled', \&sig_page_scrolled); + Irssi::signal_remove('terminal resized', \&sig_terminal_resized); + system 'screen -x '.$ENV{'STY'}.' -X fit'; +} + +sub screen_size { + if ($mode != $SCREEN) { + return; + } + $screen_resizing = 1; + # fit screen + system 'screen -x '.$ENV{'STY'}.' -X fit'; + # get size (from perldoc -q size) + my ($winsize, $row, $col, $xpixel, $ypixel); + eval 'use Term::ReadKey; ($col, $row, $xpixel, $ypixel) = GetTerminalSize'; + # require Term::ReadKey 'GetTerminalSize'; + # ($col, $row, $xpixel, $ypixel) = Term::ReadKey::GetTerminalSize; + #}; + if ($@) { # no Term::ReadKey, try the ugly way + eval { + require 'sys/ioctl.ph'; + # without this reloading doesn't work. workaround for some unknown bug + do 'asm/ioctls.ph'; + }; + + # ugly way not working, let's try something uglier, the dg-hack(tm) (constant for linux only?) + if($@) { no strict 'refs'; *TIOCGWINSZ = sub { return 0x5413 } } + + unless (defined &TIOCGWINSZ) { + die "Term::ReadKey not found, and ioctl 'workaround' failed. Install the Term::ReadKey perl module to use screen mode.\n"; + } + open(TTY, "+</dev/tty") or die "No tty: $!"; + unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) { + die "Term::ReadKey not found, and ioctl 'workaround' failed ($!). Install the Term::ReadKey perl module to use screen mode.\n"; + } + close(TTY); + ($row, $col, $xpixel, $ypixel) = unpack('S4', $winsize); + } + + # set screen width + $irssi_width = $col-$nicklist_width-1; + $height = $row-1; + + # on some recent systems, "screen -X fit; screen -X width -w 50" doesn't work, needs a sleep in between the 2 commands + # so we wait a second before setting the width + Irssi::timeout_add_once(1000, sub { + my ($new_irssi_width) = @_; + system 'screen -x '.$ENV{'STY'}.' -X width -w ' . $new_irssi_width; + # and then we wait another second for the resizing, and then redraw. + Irssi::timeout_add_once(1000,sub {$screen_resizing = 0; redraw()}, []); + }, $irssi_width); +} + +sub sig_terminal_resized { + if ($screen_resizing) { + return; + } + $screen_resizing = 1; + Irssi::timeout_add_once(1000,\&screen_size,[]); +} + + +### both ### + +sub nicklist_write_start { + if ($mode == $SCREEN) { + print STDERR "\033P\033[s\033\\"; # save cursor + } +} + +sub nicklist_write_end { + if ($mode == $SCREEN) { + print STDERR "\033P\033[u\033\\"; # restore cursor + } +} + +sub nicklist_write_line { + my ($line, $data) = @_; + if ($mode == $SCREEN) { + print STDERR "\033P\033[" . ($line+1) . ';'. ($irssi_width+1) .'H'. $screen_prefix . $data . "\033\\"; + } elsif ($mode == $FIFO) { + $data = "\033[m$data"; # reset color + if ($line == $cursor_line+1) { + $data = "\n$data"; # next line + } elsif ($line == $cursor_line) { + $data = "\033[1G".$data; # back to beginning of line + } else { + $data = "\033[".($line+1).";0H".$data; # jump + } + $cursor_line=$line; + print(FIFO $data) or fifo_stop(); + } +} + +# recalc the text of the nicklist item +sub calc_text { + my ($nick) = @_; + my $tmp = $nicklist_width-3; + (my $text = $nick->{'nick'}) =~ s/^(.{$tmp})..+$/$1\033[34m~\033[m/; + $nick->{'text'} = $prefix_mode[$nick->{'mode'}] . $text . (' ' x ($nicklist_width-length($nick->{'nick'})-1)); + $nick->{'cmp'} = $nick->{'mode'}.lc($nick->{'nick'}); +} + +# redraw the given nick (nr) if it is visible +sub redraw_nick_nr { + my ($nr) = @_; + my $line = $nr - $scroll_pos; + if ($line >= 0 && $line < $height) { + nicklist_write_line($line, $nicklist[$nr]->{'text'}); + } +} + +# nick was inserted, redraw area if necessary +sub draw_insert_nick_nr { + my ($nr) = @_; + my $line = $nr - $scroll_pos; + if ($line < 0) { # nick is inserted above visible area + $scroll_pos++; # 'scroll' down :) + } elsif ($line < $height) { # line is visible + if ($mode == $SCREEN) { + need_redraw(); + } elsif ($mode == $FIFO) { + my $data = "\033[m\033[L". $nicklist[$nr]->{'text'}; # reset color & insert line & write nick + if ($line == $cursor_line) { + $data = "\033[1G".$data; # back to beginning of line + } else { + $data = "\033[".($line+1).";1H".$data; # jump + } + $cursor_line=$line; + print(FIFO $data) or fifo_stop(); + if ($prev_lines < $height) { + $prev_lines++; # the nicklist has one line more + } + } + } +} + +sub draw_remove_nick_nr { + my ($nr) = @_; + my $line = $nr - $scroll_pos; + if ($line < 0) { # nick removed above visible area + $scroll_pos--; # 'scroll' up :) + } elsif ($line < $height) { # line is visible + if ($mode == $SCREEN) { + need_redraw(); + } elsif ($mode == $FIFO) { + #my $data = "\033[m\033[L[i$line]". $nicklist[$nr]->{'text'}; # reset color & insert line & write nick + my $data = "\033[M"; # delete line + if ($line != $cursor_line) { + $data = "\033[".($line+1)."d".$data; # jump + } + $cursor_line=$line; + print(FIFO $data) or fifo_stop(); + if (@nicklist-$scroll_pos >= $height) { + redraw_nick_nr($scroll_pos+$height-1); + } + } + } +} + +# redraw the whole nicklist +sub redraw { + $need_redraw = 0; + #make_nicklist(); + nicklist_write_start(); + my $line = 0; + ### draw nicklist ### + for (my $i=$scroll_pos;$line < $height && $i < @nicklist; $i++) { + nicklist_write_line($line++, $nicklist[$i]->{'text'}); + } + + ### clean up other lines ### + my $real_lines = $line; + while($line < $prev_lines) { + nicklist_write_line($line++,' ' x $nicklist_width); + } + $prev_lines = $real_lines; + nicklist_write_end(); +} + +# redraw (with little delay to avoid redrawing to much) +sub need_redraw { + if(!$need_redraw) { + $need_redraw = 1; + Irssi::timeout_add_once(10,\&redraw,[]); + } +} + +sub sig_page_scrolled { + $prev_lines = $height; # we'll need to redraw everything if he scrolled up + need_redraw; +} + +# redraw (with delay) if the window is visible (only in screen mode) +sub sig_gui_print_text_finished { + if ($need_redraw) { # there's already a redraw 'queued' + return; + } + my $window = @_[0]; + if ($window->{'refnum'} == Irssi::active_win->{'refnum'} || Irssi::settings_get_str('nicklist_screen_split_windows') eq '*') { + need_redraw; + return; + } + foreach my $win (split(/[ ,]/, Irssi::settings_get_str('nicklist_screen_split_windows'))) { + if ($window->{'refnum'} == $win || $window->{'name'} eq $win) { + need_redraw; + return; + } + } +} + +#################### +##### NICKLIST ##### +#################### + +# returns the position of the given nick(as string) in the (internal) nicklist +sub find_nick { + my ($nick) = @_; + for (my $i=0;$i < @nicklist; $i++) { + if ($nicklist[$i]->{'nick'} eq $nick) { + return $i; + } + } + return -1; +} + +# find position where nick should be inserted into the list +sub find_insert_pos { + my ($cmp)= @_; + for (my $i=0;$i < @nicklist; $i++) { + if ($nicklist[$i]->{'cmp'} gt $cmp) { + return $i; + } + } + return scalar(@nicklist); #last +} + +# make the (internal) nicklist (@nicklist) +sub make_nicklist { + @nicklist = (); + $scroll_pos = 0; + + ### get & check channel ### + my $channel = Irssi::active_win->{active}; + + if (!$channel || (ref($channel) ne 'Irssi::Irc::Channel' && ref($channel) ne 'Irssi::Silc::Channel' && ref($channel) ne 'Irssi::Xmpp::Channel') || $channel->{'type'} ne 'CHANNEL' || ($channel->{chat_type} ne 'SILC' && !$channel->{'names_got'}) ) { + $active_channel = undef; + # no nicklist + } else { + $active_channel = $channel; + ### make nicklist ### + my $thisnick; + foreach my $nick (sort {(($a->{'op'}?'1':$a->{'halfop'}?'2':$a->{'voice'}?'3':'4').lc($a->{'nick'})) + cmp (($b->{'op'}?'1':$b->{'halfop'}?'2':$b->{'voice'}?'3':'4').lc($b->{'nick'}))} $channel->nicks()) { + $thisnick = {'nick' => $nick->{'nick'}, 'mode' => ($nick->{'op'}?$MODE_OP:$nick->{'halfop'}?$MODE_HALFOP:$nick->{'voice'}?$MODE_VOICE:$MODE_NORMAL)}; + calc_text($thisnick); + push @nicklist, $thisnick; + } + } + need_redraw(); +} + +# insert nick(as hash) into nicklist +# pre: cmp has to be calculated +sub insert_nick { + my ($nick) = @_; + my $nr = find_insert_pos($nick->{'cmp'}); + splice @nicklist, $nr, 0, $nick; + draw_insert_nick_nr($nr); +} + +# remove nick(as nr) from nicklist +sub remove_nick { + my ($nr) = @_; + splice @nicklist, $nr, 1; + draw_remove_nick_nr($nr); +} + +################### +##### ACTIONS ##### +################### + +# scroll the nicklist, arg = number of lines to scroll, positive = down, negative = up +sub cmd_scroll { + if (!$active_channel) { # not a channel active + return; + } + my @nicks=Irssi::active_win->{active}->nicks; + my $nick_count = scalar(@nicks)+0; + my $channel = Irssi::active_win->{active}; + if (!$channel || $channel->{type} ne 'CHANNEL' || !$channel->{names_got} || $nick_count <= Irssi::settings_get_int('nicklist_height')) { + return; + } + $scroll_pos += @_[0]; + + if ($scroll_pos > $nick_count - $height) { + $scroll_pos = $nick_count - $height; + } + if ($scroll_pos <= 0) { + $scroll_pos = 0; + } + need_redraw(); +} + +sub is_active_channel { + my ($server,$channel) = @_; # (channel as string) + return ($server && $server->{'tag'} eq $active_channel->{'server'}->{'tag'} && $server->channel_find($channel) && $active_channel && $server->channel_find($channel)->{'name'} eq $active_channel->{'name'}); +} + +sub sig_channel_wholist { # this is actualy a little late, when the names are received would be better + my ($channel) = @_; + if (Irssi::active_win->{'active'} && Irssi::active_win->{'active'}->{'name'} eq $channel->{'name'}) { # the channel joined is active + make_nicklist + } +} + +sub sig_join { + my ($server,$channel,$nick,$address) = @_; + if (!is_active_channel($server,$channel)) { + return; + } + my $newnick = {'nick' => $nick, 'mode' => $MODE_NORMAL}; + calc_text($newnick); + insert_nick($newnick); +} + +sub sig_kick { + my ($server, $channel, $nick, $kicker, $address, $reason) = @_; + if (!is_active_channel($server,$channel)) { + return; + } + my $nr = find_nick($nick); + if ($nr == -1) { + Irssi::print("nicklist warning: $nick was kicked from $channel, but not found in nicklist"); + } else { + remove_nick($nr); + } +} + +sub sig_part { + my ($server,$channel,$nick,$address, $reason) = @_; + if (!is_active_channel($server,$channel)) { + return; + } + my $nr = find_nick($nick); + if ($nr == -1) { + Irssi::print("nicklist warning: $nick has parted $channel, but was not found in nicklist"); + } else { + remove_nick($nr); + } + +} + +sub sig_quit { + my ($server,$nick,$address, $reason) = @_; + if ($server->{'tag'} ne $active_channel->{'server'}->{'tag'}) { + return; + } + my $nr = find_nick($nick); + if ($nr != -1) { + remove_nick($nr); + } +} + +sub sig_nick { + my ($server, $newnick, $oldnick, $address) = @_; + if ($server->{'tag'} ne $active_channel->{'server'}->{'tag'}) { + return; + } + my $nr = find_nick($oldnick); + if ($nr != -1) { # if nick was found (nickchange is in current channel) + my $nick = $nicklist[$nr]; + remove_nick($nr); + $nick->{'nick'} = $newnick; + calc_text($nick); + insert_nick($nick); + } +} + +sub sig_mode { + my ($channel, $nick, $setby, $mode, $type) = @_; # (nick and channel as rec) + if ($channel->{'server'}->{'tag'} ne $active_channel->{'server'}->{'tag'} || $channel->{'name'} ne $active_channel->{'name'}) { + return; + } + my $nr = find_nick($nick->{'nick'}); + if ($nr == -1) { + Irssi::print("nicklist warning: $nick->{'nick'} had mode set on $channel->{'name'}, but was not found in nicklist"); + } else { + my $nicklist_item = $nicklist[$nr]; + remove_nick($nr); + $nicklist_item->{'mode'} = ($nick->{'op'}?$MODE_OP:$nick->{'halfop'}?$MODE_HALFOP:$nick->{'voice'}?$MODE_VOICE:$MODE_NORMAL); + calc_text($nicklist_item); + insert_nick($nicklist_item); + } +} + +##### command binds ##### +Irssi::command_bind 'nicklist' => sub { + my ( $data, $server, $item ) = @_; + $data =~ s/\s+$//g; + Irssi::command_runsub ('nicklist', $data, $server, $item ) ; +}; +Irssi::signal_add_first 'default command nicklist' => sub { + # gets triggered if called with unknown subcommand + cmd_help(); +}; +Irssi::command_bind('nicklist update',\&update); +Irssi::command_bind('nicklist help',\&cmd_help); +Irssi::command_bind('nicklist scroll',\&cmd_scroll); +Irssi::command_bind('nicklist fifo',\&cmd_fifo_start); +Irssi::command_bind('nicklist screen',\&cmd_screen_start); +Irssi::command_bind('nicklist screensize',\&screen_size); +Irssi::command_bind('nicklist off',\&cmd_off); + +##### signals ##### +Irssi::signal_add_last('window item changed', \&make_nicklist); +Irssi::signal_add_last('window changed', \&make_nicklist); +Irssi::signal_add_last('channel wholist', \&sig_channel_wholist); +Irssi::signal_add_first('message join', \&sig_join); # first, to be before ignores +Irssi::signal_add_first('message part', \&sig_part); +Irssi::signal_add_first('message kick', \&sig_kick); +Irssi::signal_add_first('message quit', \&sig_quit); +Irssi::signal_add_first('message nick', \&sig_nick); +Irssi::signal_add_first('message own_nick', \&sig_nick); +Irssi::signal_add_first('nick mode changed', \&sig_mode); + +Irssi::signal_add('setup changed', \&read_settings); + +##### settings ##### +Irssi::settings_add_str('nicklist', 'nicklist_screen_prefix', '\e[m '); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_op', '\e[32m@\e[39m'); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_halfop', '\e[34m%\e[39m'); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_voice', '\e[33m+\e[39m'); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_normal', ' '); + +Irssi::settings_add_int('nicklist', 'nicklist_width',11); +Irssi::settings_add_int('nicklist', 'nicklist_height',24); +Irssi::settings_add_str('nicklist', 'nicklist_fifo_path', Irssi::get_irssi_dir . '/nicklistfifo'); +Irssi::settings_add_str('nicklist', 'nicklist_screen_split_windows', ''); +Irssi::settings_add_str('nicklist', 'nicklist_automode', ''); + +read_settings(); +if (uc(Irssi::settings_get_str('nicklist_automode')) eq 'SCREEN') { + cmd_screen_start(); +} elsif (uc(Irssi::settings_get_str('nicklist_automode')) eq 'FIFO') { + cmd_fifo_start(); +} diff --git a/.newsboat/bookmark-pinboard.sh b/.newsboat/bookmark-pinboard.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# newsbeuter bookmarking plugin for pinboard +# (c) 2007 Andreas Krennmair +# documentation: https://pinboard.in/api + +username="djmoch" +password="$(secret-tool lookup account djmoch service in.pinboard)" + +# You can enter up to 100 tags here, space delimited, or leave blank for no tag +tags="via:newsbeuter" + +# Leave as 'yes' to bookmark as to be read, enter 'no' to mark as read +toread="yes" + +url="$1" +title="$2" +desc="$3" + +pinboard_url="https://api.pinboard.in/v1/posts/add?url=${url}&description=${title}&extended=${desc}&tags="${tags}"&toread=${toread}" + +output=`wget --http-user=$username --http-passwd=$password -O - "$pinboard_url" 2> /dev/null` +output=`echo $output | sed 's/^.*code="\([^"]*\)".*$/\1/'` + +if [ "$output" != "done" ] ; then + echo "$output" +fi diff --git a/.newsboat/config b/.newsboat/config @@ -0,0 +1,17 @@ +browser "w3m %u" +auto-reload yes +macro o set browser "open %u" ; open-in-browser ; set browser "w3m %u" +feedhq-flag-share "s" +feedhq-flag-star "x" +feedhq-login "djmoch" +feedhq-passwordeval "secret-tool lookup account djmoch service org.feedhq" +urls-source "feedhq" +bookmark-cmd "~/.newsboat/bookmark-pinboard.sh" + +color background color250 color235 +color listnormal color242 color235 +color listfocus color235 color110 +color listnormal_unread color250 color235 +color listfocus_unread color235 color110 +color info color235 color101 +color article color250 color235