Add tg config

Also fix `dict` (words.txt is in Windows format)
This commit is contained in:
Hoang Nguyen 2021-05-17 17:12:38 +03:00
parent 11d1adce49
commit 2ca7ebcb11
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
5 changed files with 48 additions and 2 deletions

View File

@ -118,6 +118,7 @@ cp -rfv ./home/.config/nvim/ ~/.config/nvim/
cp -rfv ./home/.config/pipe-viewer/ ~/.config/pipe-viewer/
cp -rfv ./home/.config/qutebrowser/ ~/.config/qutebrowser/
cp -rfv ./home/.config/ranger/ ~/.config/ranger/
cp -rfv ./home/.config/tg/ ~/.config/tg/
cp -rfv ./home/.config/tmux/ ~/.config/tmux/
cp -rfv ./home/.config/translate-shell/ ~/.config/translate-shell/
# cp -rfv ./home/.config/tridactyl/ ~/.config/tridactyl/

33
home/.config/tg/conf.py Normal file
View File

@ -0,0 +1,33 @@
import os
PHONE = ''
URL_VIEW = 'urlview'
KEEP_MEDIA = 7
FILE_PICKER_CMD = "nnn -p {file_path}"
# FILE_PICKER_CMD = "ranger --choosefile={file_path}"
DOWNLOAD_DIR = os.path.expanduser("~/Downloads/")
MAILCAP_FILE = os.path.expanduser("~/.config/tg/mailcap")
CHAT_FLAGS = {
"online": "",
"pinned": "P",
"muted": "M",
"unread": "U",
"unseen": "?",
"secret": "🔒",
"seen": "",
}
MSG_FLAGS = {
"selected": "*",
"forwarded": "F",
"new": "N",
"unseen": "U",
"edited": "E",
"pending": "...",
"failed": "💩",
"seen": "",
}
LOG_LEVEL = "DEBUG"
LOG_PATH = os.path.expanduser("~/.local/share/tg/")
VOICE_RECORD_CMD = "ffmpeg -f avfoundation -i ':0' -c:a libopus -b:a 32k {file_path}"
NOTIFY_CMD = "notify-send '{title}-{subtitle}' '{msg}' -i {icon_path}"
USERS_COLORS = tuple(range(2,16))

12
home/.config/tg/mailcap Normal file
View File

@ -0,0 +1,12 @@
# media
video/*; mpv "%s"
audio/ogg; mpv --speed 1.33 "%s"
audio/mpeg; mpv --no-video "%s"
image/*; qimgv "%s"
# text
text/html; qutebrowser "%s"
text/plain; less "%s"
# fallback to vim
text/*; nvim "%s"

View File

@ -7,7 +7,7 @@ underline=$(tput smul)
esc=$(tput sgr0)
if [ -z "$1" ]; then
sort ~/.local/share/words.txt | fzf --no-multi | xargs -r dict
fzf --no-multi < ~/.local/share/words.txt | tr -d '\r' | xargs -r dict
else
curl -s "dict://dict.org/d:$1" | sed -n -e '/^151.*/,/^\./p' | sed -e 's/^151.*//g' -e '/^\./D' -e '/^\s*1\./i\\' -e "s/{\([^{]*\)}/${esc}${bold}${underline}\1${esc}/g" -e "s/^\($1\)\(\W\)/${esc}${bold}${red}\1${esc}\2/gI" -e "s/^\(\s*\)\([0-9]\.\)/\1${esc}${bold}${cyan}\2${esc}/g" -e 's/--/—/g' -e 's/—\(\w\)/— \1/g'
fi

View File

@ -30,4 +30,4 @@ if [ "${answer}" = "y" ]; then
fi
# Not a script but whatever
curl -fL https://github.com/dwyl/english-words/raw/master/words.txt $HOME/.local/share/words.txt
curl -fL https://github.com/dwyl/english-words/raw/master/words_alpha.txt $HOME/.local/share/words.txt