Added more config

Signed-off-by: Ari Archer <truncateddinosour@gmail.com>
This commit is contained in:
Ari Archer 2022-02-17 00:23:03 +02:00
parent 686501546a
commit d43375b143
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2
6 changed files with 45 additions and 6 deletions

View file

@ -85,6 +85,12 @@ cd arigram
./do local ./do local
``` ```
#### Optionally install the desktop entry
```sh
$ sudo ./do entry
```
And add this to `~/.bashrc` or whatever POSIX complient shell you use: And add this to `~/.bashrc` or whatever POSIX complient shell you use:
```sh ```sh
@ -281,6 +287,11 @@ EXTRA_TDLIB_HEADERS = {"disable_web_page_preview": True}
# Where to store your drafts # Where to store your drafts
DRAFTS_FILE = "/tmp/.drafts.json" DRAFTS_FILE = "/tmp/.drafts.json"
# This defines if stuff like \n (Unicode escapes)
# get interpreted literally (False) or get decoded
# into an escape and you get a newline (True)
DECODE_INPUT_ESCAPES = False
``` ```
### Mailcap file ### Mailcap file

4
TODO Normal file
View file

@ -0,0 +1,4 @@
- add a newline after every message except if it's from the same user
- implement [messageAnimatedEmoji]
- implement spoilers

13
arigram.desktop Normal file
View file

@ -0,0 +1,13 @@
[Desktop Entry]
Version=1.1
Name=Arigram
Comment=A fork of tg -- a hackable telegram TUI client
TryExec=arigram
Exec=arigram
Icon=arigram
Terminal=true
StartupWMClass=Arigram
Type=Application
Categories=Chat;Network;InstantMessaging;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;arigram;

View file

@ -80,6 +80,8 @@ CUSTOM_KEYBINDS: Dict[str, Dict[str, Any]] = {}
TRUNCATE_LIMIT: int = 15 TRUNCATE_LIMIT: int = 15
DECODE_INPUT_ESCAPES: bool = True
EXTRA_TDLIB_HEADEARS: Dict[Any, Any] = {} EXTRA_TDLIB_HEADEARS: Dict[Any, Any] = {}
if os.path.isfile(CONFIG_FILE): if os.path.isfile(CONFIG_FILE):

View file

@ -1,6 +1,7 @@
import curses import curses
import logging import logging
from datetime import datetime from datetime import datetime
from tempfile import TemporaryFile
from typing import Any, Dict, List, Optional, Tuple, Union, cast from typing import Any, Dict, List, Optional, Tuple, Union, cast
from _curses import window # type: ignore from _curses import window # type: ignore
@ -20,8 +21,10 @@ from arigram.msg import MsgProxy
from arigram.tdlib import ChatType, get_chat_type, is_group from arigram.tdlib import ChatType, get_chat_type, is_group
from arigram.utils import ( from arigram.utils import (
get_colour_by_str, get_colour_by_str,
is_yes,
num, num,
string_len_dwc, string_len_dwc,
suspend,
truncate_to_len, truncate_to_len,
) )
@ -169,7 +172,12 @@ class StatusView:
curses.cbreak() curses.cbreak()
curses.noecho() curses.noecho()
return buff.encode("raw_unicode_escape").decode("unicode_escape") if config.DECODE_INPUT_ESCAPES:
buff = buff.encode("raw_unicode_escape", errors="ignore").decode(
"unicode_escape", errors="ignore"
)
return buff
class ChatView: class ChatView:

11
do
View file

@ -30,10 +30,6 @@ main() {
;; ;;
local) local)
python3 -m poetry check
python3 -m poetry lock
python3 -m poetry install
python3 -m pip install --user --upgrade . python3 -m pip install --user --upgrade .
;; ;;
@ -46,10 +42,15 @@ main() {
check) check)
black . black .
isort arigram/*.py isort arigram/*.py
chmod a+rx ./check.sh chmod u+rx ./check.sh
./check.sh ./check.sh
;; ;;
entry)
mkdir -p /usr/share/applications
cp arigram.desktop /usr/share/applications
;;
*) *)
python3 -m arigram python3 -m arigram
;; ;;