forked from zevlg/telega.el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtelega-customize.el
1368 lines (1121 loc) ยท 38.8 KB
/
telega-customize.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; telega-customize.el --- Customization for telega -*- lexical-binding:t -*-
;; Copyright (C) 2018 by Zajcev Evgeny.
;; Author: Zajcev Evgeny <zevlg@yandex.ru>
;; Created: Mon Apr 23 18:11:45 2018
;; Keywords:
;; telega is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; telega is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with telega. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(defgroup telega nil
"Telegram client."
:prefix "telega-"
:group 'applications
:link '(url-link :tag "Github" "https://github.com/zevlg/telega.el"))
(defcustom telega-directory (expand-file-name "~/.telega")
"Directory for telega runtime files."
:type 'string
:group 'telega)
(defcustom telega-cache-dir (expand-file-name "cache" telega-directory)
"*Directory for telegram downloads."
:type 'string
:group 'telega)
(defcustom telega-temp-dir (expand-file-name "temp" telega-directory)
"*Directory for temporary files used by telega."
:type 'string
:group 'telega)
(defcustom telega-language "en"
"*IETF language tag of the user's language."
:type 'string
:group 'telega)
(defcustom telega-options-plist
(list :online t :localization_target "tdesktop")
"*Plist of options to set.
To use custom language pack (from \"tdesktop\" localization target),
add `:language_pack_id' option.
Only writable options can be set. See: https://core.telegram.org/tdlib/options"
:type 'plist
:group 'telega)
(defcustom telega-debug nil
"*Non-nil to enable telega debugging buffer."
:type 'boolean
:group 'telega)
(defcustom telega-use-test-dc nil
"*Non-nil to use telegram's test environment instead of production."
:type 'bool
:group 'telega)
(defcustom telega-use-file-database t
"Non-nil to save downloaded/uploaded files among restarts."
:type 'bool
:group 'telega)
(defcustom telega-use-chat-info-database t
"Cache chats informations among restarts.
Implies `telega-use-file-database' set to non-nil."
:type 'bool
:group 'telega)
(defcustom telega-use-message-database t
"Cache chats and messages among restarts.
Implies `telega-use-chat-info-database' set to non-nil."
:type 'bool
:group 'telega)
(defcustom telega-proxies nil
"*List of proxies.
Format is:
(:server \"<SERVER>\" :port <PORT> :enable <BOOL> :type <PROXY-TYPE>)
where PROXY-TYPE is one of:
(:@type \"proxyTypeSocks5\" :username <USER> :password <PASSWORD>)
(:@type \"proxyTypeHttp\" :username <USER> :password <PASSWORD>
:http_only <BOOL>)
(:@type \"proxyTypeMtproto\" :secret <SECRET-STRING>)
<BOOL> is either t or `:false', nil is not valid value."
:type 'list
:group 'telega)
(defcustom telega-week-start-day 1
"*The day of the week on which a week in the calendar begins.
0 means Sunday, 1 means Monday (default), and so on."
:type 'integer
:group 'telega)
(defcustom telega-week-day-names
'("Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat")
"*Week day names to use when printing times."
:type 'list
:group 'telega)
(defcustom telega-use-short-filenames t
"*Non-nil to cut /home/user/.telega/cache from filenames."
:type 'boolean
:group 'telega)
(defcustom telega-use-tracking nil
"*Non-nil to enable builtin tracking.el support.
Make sure you have tracking.el loaded if this option is enabled."
:type 'boolean
:group 'telega)
(defcustom telega-use-images (fboundp 'imagemagick-types)
"Non-nil to show images."
:type 'boolean
:group 'telega
:set (lambda (option value)
(if (fboundp 'imagemagick-types)
(set-default option value)
(set-default option nil)
(when value
(warn "No ImageMagick support, so images can't be displayed in telega")))))
(defcustom telega-known-inline-bots '("@gif" "@youtube" "@pic")
"List of known bots for everyday use."
:type 'list
:group 'telega)
(defcustom telega-chat--display-buffer-action
'((display-buffer-reuse-window display-buffer-same-window))
"Action value when poping to chatbuffer.
See docstring for `display-buffer' for the values."
:type 'cons
:group 'telega)
(defcustom telega-emoji-company-backend 'telega-company-emoji
"Company backend to use for emoji completions."
:type 'symbol
:group 'telega
:options '(telega-company-telegram-emoji))
(defcustom telega-emoji-fuzzy-match t
"*Non-nil to use fuzzy prefix matching.
For example without fuzzy matches, prefix `:jo' will match only
`:joy:', `:joy-cat:' and `:joystick:'. With fuzzy matching
enabled it will match also `:flag-jo:' and `:black-jocker:'."
:type 'boolean
:group 'telega)
(defcustom telega-emoji-custom-alist nil
"*Alist of custom emojis to add along with `etc/emojis.alist'."
:type 'alist
:group 'telega)
(defcustom telega-emoji-font-family
(let ((ffl (font-family-list)))
(or (car (member "Emoji One" ffl))
(car (member "Noto Color Emoji" ffl))))
"*Font to use for emoji image generation using `telega-emoji-create-svg'."
:type 'string
:group 'telega)
(defcustom telega-emoji-use-images (when telega-emoji-font-family t)
"*Non-nil to use images for emojis.
Value is ignored if `telega-use-images' is nil."
:type 'boolean
:group 'telega)
(defcustom telega-emoji-large-height 2
"*Vertical size in characters for emoji only messages.
Used only if `telega-emoji-use-images' is non-nil."
:type 'integer
:group 'telega)
(defcustom telega-sticker-size '(3 . 24)
"*Size for the sticker.
car is height in chars to use.
cdr is maximum width in chars to use."
:type 'cons
:group 'telega)
(defcustom telega-sticker-favorite-background "cornflower blue"
"*Background color for the favorite stickers."
:type 'string
:group 'telega)
(defcustom telega-sticker-set-download nil
"*Non-nil to automatically download known sticker sets."
:type 'boolean
:group 'telega)
(defcustom telega-sticker-set-show-emoji nil
"*Non-nil to show emoji along with sticker in sticker set help win."
:type 'boolean
:group 'telega)
(defcustom telega-animation-height 5
"*Height of animations in char heights."
:type 'integer
:group 'telega)
(defcustom telega-animation-play-inline t
"*Non-nil to play animation inside telega."
:type 'boolean
:group 'telega)
(defcustom telega-animation-download-saved nil
"*Non-nil to automatically download saved animations."
:type 'boolean
:group 'telega)
(defcustom telega-avatar-factors '(0.6 . 0.1)
"*Factors for avatar generation.
car is factor for circle
cdr is factor for margin.
See `telega-avatar--create-img' for more info."
:type 'cons
:group 'telega)
(defcustom telega-vvnote-waves-height-factor 0.75
"*Factor for waves svg height.
There is a restriction to its value:
`(* (telega-chars-xheight 1) telega-vvnote-waves-height-factor)' must be > 8."
:type 'float
:group 'telega)
(defcustom telega-video-note-height 6
"*Height in chars for video notes."
:type 'integer
:group 'telega)
(defcustom telega-video-note-play-inline t
"*Non-nil to play video notes inside chatbuffer."
:type 'boolean
:group 'telega)
(defcustom telega-video-play-inline nil
"*Non-nil to play video files inside telega."
:type 'boolean
:group 'telega)
(defcustom telega-video-ffplay-args nil
"*Additional arguments to ffplay to play video messages.
To play in fullscreen, set `telega-video-ffplay-args' to '(\"-fs\")."
:type 'list
:group 'telega)
;; Locations
(defcustom telega-location-url-format
"http://maps.google.com/?q=%N,%E&ll=%N,%E&z=15"
"*URL format used to open location messages.
%N substituted with lattitude.
%E substituted with longitude."
:type 'string
:group 'telega)
(defcustom telega-location-size (cons 10 40)
"*Size for location image in char height/width.
In pixels height and width should be in range [16..1024]."
:type 'cons
:group 'telega)
(defcustom telega-location-zoom 15
"*Zoom for location image.
In range [13..20]"
:type 'integer
:group 'telega)
(defcustom telega-location-scale 1
"*Scale for location image.
In range [1..3]"
:type 'number
:group 'telega)
(defcustom telega-poll-result-color "#000066"
"Color used to draw poll results in poll messages."
:type 'cons
:group 'telega)
(defgroup telega-server nil
"Customisation for telega-server."
:prefix "telega-server-"
:group 'telega)
(defcustom telega-server-command "telega-server"
"Command to run as telega server."
:type 'string
:group 'telega-server)
(defcustom telega-server-libs-prefix "/usr/local"
"*Prefix where tdlib and tgvoip libraries are installed.
TELEGA-SERVER-LIBS-PREFIX/include is used for headers files.
TELEGA-SERVER-LIBS-PREFIX/lib is used for library files."
:type 'string
:group 'telega-server)
(defcustom telega-server-logfile
(expand-file-name "telega-server.log" telega-directory)
"*Write server logs to this file.
Set it to nil to disable telega-server logging."
:type 'string
:group 'telega-server)
(defcustom telega-server-verbosity (if telega-debug 5 3)
"*Verbosity level for server process.
Verbosity levels are from 0 (disabled) to 5 (debug)."
:type 'number
:group 'telega-server)
(defcustom telega-server-call-timeout 1.0
"*Timeout for `telega-server--call'."
:type 'number
:group 'telega-server)
(defgroup telega-root nil
"Customization for telega-root-mode"
:prefix "telega-root-"
:group 'telega)
(defcustom telega-root-compact-view t
"*Non-nil for compact view (no newline delims) in root buffer."
:type 'boolean
:group 'telega-root)
(defcustom telega-root-keep-cursor t
"*Non-nil to keep cursor at current chat even if chat's order changes."
:type 'boolean
:group 'telega-root)
(defcustom telega-root-buffer-name "*Telega Root*"
"*Buffer name for telega root buffer."
:type 'string
:group 'telega-root)
(defcustom telega-root-fill-column fill-column
"*Maximum width to use in root buffer to display active filters and chats."
:type 'integer
:group 'telega-root)
(defcustom telega-chat-button-width 28
"*Width for the chat buttons in root buffer.."
:type 'integer
:group 'telega-root)
(defcustom telega-chat-button-brackets
'(((type private) "{" "}")
((type basicgroup) "(" ")")
((type supergroup) "[" "]")
((type channel) "<" ">")
(all "[" "]"))
"Brackets to use for chat button."
:type 'list
:group 'telega-root)
(defcustom telega-chat-me-custom-title (propertize "Saved Messages" 'face 'bold)
"*Custom title for the chat with myself.
Set it to nil to use your user name instead of default \"Saved Messages\"."
:type 'string
:group 'telega-root)
(defcustom telega-chat-label-format "%L | "
"*Non-nil to prefix chat's title with custom label.
%L - replaced with chat's label.
See `telega-chat-custom-label' for details.
`telega-chat-label' face is added to formatted string."
:type 'string
:group 'telega-root)
(defcustom telega-status-animate-interval 0.5
"Dots animation interval for telega status shown in root buffer."
:type 'number
:group 'telega-root)
(defcustom telega-offline-status-interval 3
"Interval in seconds before going offline when emacs looses focus."
:type 'number
:group 'telega)
(defcustom telega-online-status-interval 0.1
"Interval in seconds before going online when emacs gets focus."
:type 'number
:group 'telega)
(defgroup telega-filter nil
"Customize chats filtration."
:prefix "telega-filter-"
:group 'telega)
(defcustom telega-filter-default 'all
"*Default chats filter to apply.
For example:
`(any pin unread)' - to show pinned or chats with unread messages."
:type 'list
:group 'telega-filter)
(defcustom telega-filters-custom
'(("All" . all)
("Secrets" . (type secret))
("Bots" . (type bot))
("Groups" . (type basicgroup supergroup))
("Private" . (type private))
("Channels" . (type channel))
("Contacts" . (contact out))
("Unmuted" . unmuted)
("Unread" . unread))
"*Alist of custom filters for chats.
In form (NAME . FILTER-SPEC)."
:type 'alist
:group 'telega-filter)
(defcustom telega-filter-custom-expand t
"*Non-nil to expand custom filter when adding to active filters."
:type 'boolean
:group 'telega-filter)
(defcustom telega-filter-button-width 20
"*Width of the custom filter buttons."
:type 'integer
:group 'telega-filter)
(defgroup telega-inserter nil
"Group to customize inserters used by telega for formatting."
:group 'telega
:prefix "telega-inserter-")
(defcustom telega-inserter-for-filter-button 'telega-ins--filter
"Inserter for the custom filter buttons."
:type 'function
:group 'telega-inserters)
(defcustom telega-inserter-for-chat-button 'telega-ins--chat-full
"Inserter for the chat button in root buffer."
:type 'function
:group 'telega-inserters)
(defcustom telega-inserter-for-msg-button 'telega-ins--message
"Inserter for message button in chat buffer.
Accepts at least two arguments - MSG and NO-HEADER-P.
See `telega-ins--message' for NO-HEADER argument."
:type 'function
:group 'telega-inserter)
(defcustom telega-inserter-for-msg-notification 'telega-ins--msg-notification
"*Inserter used to form body for notification bubble."
:type 'function
:group 'telega-inserter)
(defgroup telega-webpage nil
"Customization for instant view webpage rendering."
:group 'telega)
(defcustom telega-webpage-fill-column fill-column
"*Fill column to use for webpage rendering."
:type 'integer
:group 'telega-webpage)
(defcustom telega-webpage-history-max 100
"*Maximum number of viewed webpages to remember in history."
:type 'number
:group 'telega-webpage)
(defcustom telega-webpage-header-line-format
'(" " (:eval (concat telega-webpage--sitename
(and telega-webpage--sitename ": ")
telega-webpage--url
" "
(format "History: %d/%d"
(1+ telega-webpage-history--index)
(length telega-webpage-history))
)))
"Header line format for instant webpage."
:type 'list
:group 'telega-webpage)
(defcustom telega-webpage-photo-maxsize (cons telega-webpage-fill-column 20)
"*Limit displayed image size to this (WIDTH . HEIGHT) characters."
:type '(cons integer integer)
:group 'telega-webpage)
(defgroup telega-user nil
"Customization for users."
:group 'telega)
(defcustom telega-user-use-avatars (image-type-available-p 'svg)
"Non-nil to use avatars for the users."
:type 'boolean
:group 'telega-user)
(defcustom telega-user-photo-maxsize '(10 . 10)
"*Limit displayed profile photos size to this (WIDTH . HEIGHT) characters."
:type '(cons integer integer)
:group 'telega-user)
(defgroup telega-chat nil
"Customization for chat buffer."
:group 'telega)
(defcustom telega-chat-input-prompt ">>> "
"*Prompt for the chat buffers."
:type 'string
:group 'telega-chat)
(defcustom telega-chat-reply-prompt telega-chat-input-prompt
"*Prompt to use when replying to message."
:type 'string
:group 'telega-chat)
(defcustom telega-chat-edit-prompt telega-chat-input-prompt
"*Prompt to use when replying to message."
:type 'string
:group 'telega)
(defcustom telega-chat-fwd-prompt telega-chat-input-prompt
"*Prompt to use when forwarding message."
:type 'string
:group 'telega)
(defcustom telega-chat-input-ring-size 50
"*Size of the chat input history."
:type 'integer
:group 'telega-chat)
(defcustom telega-chat-fill-column fill-column
"*Column to fill chat messages to."
:type 'integer
:group 'telega-chat)
(defcustom telega-chat-history-limit 20
"Number of messages to fetch on history requests."
:type 'integer
:group 'telega-chat)
(defcustom telega-chat-insert-date-breaks t
"*Non-nil to insert breaks inbetween messages of different days.
NOT YET IMPLEMENTED"
:type 'boolean
:group 'telega-chat)
(defcustom telega-chat-use-markdown-formatting nil
"*Non-nil to use markdown formatting for outgoing messages."
:type 'boolean
:group 'telega-chat)
(defcustom telega-chat-upload-attaches-ahead t
"*Non-nil to upload attachements ahead, before message actually sent.
Having this non-nil \"speedups\" uploading, its like files uploads instantly."
:type 'boolean
:group 'telega-chat)
(defcustom telega-chat-group-messages-for '(not (or saved-messages (type channel bot)))
"*If this filter returns non-nil for chat, then messages are grouped by sender."
:type 'list
:group 'telega-chat)
(defcustom telega-chat-mode-line-format
'((:eval (telega-chatbuf-mode-line-unread))
(:eval (telega-chatbuf-mode-line-members 'use-icons)))
"Additional mode line format for chat buffer identification.
See `mode-line-buffer-identification'."
:type 'sexp
:group 'telega-chat)
;; VoIP
(defgroup telega-voip nil
"VOIP settings."
:group 'telega)
(defcustom telega-voip-logfile
(expand-file-name "telega-voip.log" telega-directory)
"*Write VoIP logs to this file.
Set it to nil to disable VoIP logging."
:type 'string
:group 'telega-voip)
(defcustom telega-voip-allow-p2p nil
"*Non-nil to allow P2P connections for calls."
:type 'boolean
:group 'telega-voip)
(defcustom telega-voip-busy-if-active t
"*Reply with busy status to any incoming calls if have active call."
:type 'boolean
:group 'telega-voip)
(defcustom telega-voip-help-echo t
"*Non-nil to show help messages in echo area on call activation."
:type 'boolean
:group 'telega-voip)
(defcustom telega-voip-use-sounds nil
"*Non-nil to play sounds (using ffplay) for call status changes."
:type 'boolean
:group 'telega-voip)
;; Notifications
(defgroup telega-notifications nil
"Setup for D-Bus notifications."
:group 'telega)
(defcustom telega-notifications-delay 0.5
"*Delay in seconds for notifications.
This delay is taken before making decision show or not the
message in notification.
Taking pause before showing notification is wise, because another
telegram may be active with the chat opened, you don't want the
notification to be shown for already read message.
Set it to 0, for no delay notifications."
:type 'float
:group 'telega-notifications)
(defcustom telega-notifications-timeout 4.0
"*How long to show notification in seconds."
:type 'float
:group 'telega-notifications)
;; NOTE: standard values for :sound-name
;; http://0pointer.de/public/sound-naming-spec.html
(defcustom telega-notifications-msg-args
(list :sound-name "message-new-instant")
"*Additional arguments to `notifications-notify' on chat messages."
:type 'list
:group 'telega-notifications)
(defcustom telega-notifications-call-args
(list :sound-name "phone-incoming-call")
"*Additional arguments to `notifications-notify' on incoming calls."
:type 'list
:group 'telega-notifications)
;; See https://github.com/zevlg/telega.el/issues/32
(defcustom telega-notifications-msg-body-limit 100
"*Limit for the message body length.
Used by `telega-ins--msg-notification'."
:type 'integer
:group 'telega-notifications)
(defcustom telega-notifications-defaults nil
"Cons cell with notifications settings.
car for private/secret chats
cdr for any groups including channels
For example:
(cons
(list :mute_for 0 :show_preview t)
(list :mute_for 599695961 :show_preview t))"
:type 'cons
:group 'telega-notifications)
(defgroup telega-msg nil
"Customization for telega messages formatting."
:prefix "telega-msg-"
:group 'telega)
(defcustom telega-msg-show-sender-status nil
"*Non-nil to show message sender status.
Such as admin, creator, etc
DO NOT USE. TODO: sender statuses need to be cached."
:type 'boolean
:group 'telega-msg)
(defcustom telega-msg-rainbow-title t
"*Non-nil to display user names in chatbuf with their assigned color."
:type 'boolean
:group 'telega-msg)
(defcustom telega-msg-heading-whole-line nil
"*Non-nil to spread `telega-msg-heading' face to full line width.
Also applies to `telega-msg-inline-reply' face."
:type 'boolean
:group 'telega-msg)
(defcustom telega-msg-photo-types '("w" "d" "y" "c" "x" "b" "m" "s" "a")
"*Size types to use for full size photos."
:type 'list
:group 'telega-msg)
(defcustom telega-photo-maxsize '(40 . 10)
"*Limit displayed image size to this (WIDTH . HEIGHT) characters."
:type '(cons integer integer)
:group 'telega)
;; (defcustom telega-msg-photo-props
;; '(:scale 1.0 :max-height 432 :max-width 960 :ascent 100)
;; "*Properties to apply when image is created for the photos."
;; :type 'plist
;; :group 'telega-msg)
(defcustom telega-auto-download
'((photo all)
(video opened)
(file opened)
(voice-message opened)
(video-message opened)
(web-page opened)
(instant-view opened))
"*Alist in form (KIND . FILTER-SPEC).
To denote for which chats to automatically download media content.
KIND is one of `photo', `video', `file', `voice-message',
`video-message', `web-page', `instant-view'.
Used by `telega-msg-autodownload-media'."
:type 'boolean
:group 'telega)
(defcustom telega-ignored-messages-ring-size 100
"*Maximum number of ignored messages in `telega--ignored-messages-ring'.
Message is ignored if its `:ignore' option is set to non-nil."
:type 'number
:group 'telega-chat)
(defcustom telega-completing-read-function 'ido-completing-read
"Completing read function to use."
:type 'function
:group 'telega)
(defcustom telega-screenshot-function
(if (executable-find "flameshot")
'telega-screenshot-with-flameshot
'telega-screenshot-with-import)
"*Function to use to make screenshot.
Function should take two arguments - TOFILE and REGION-P."
:type 'function
:group 'telega)
;; special symbols
(defgroup telega-symbol nil
"Group to customize special symbols used by telega."
:group 'telega)
(defcustom telega-symbol-telegram (propertize "โ" 'face '(italic telega-blue))
"*String used as telegram logo."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-eliding "..."
"*String used for eliding long string in formats.
Nice looking middle dots can be done by setting
`telega-symbol-eliding' to `(make-string 3 #x00b7)'
or set it to \"\\u2026\" or \"\\u22ef\" to use unicode char for
ellipsis."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-eye "๐" ;\U0001F441
"String to use as eye symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-pin "๐" ;\U0001F4CC
"*String to use as pin symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-custom-order (cons "โ" "โ")
"Symbols used to emphasize custom order for the chat.
car is used if custom order is less then real chat's order.
cdr is used if custom order is greater then real chat's order."
:type 'cons
:group 'telega-symbol)
(defcustom telega-symbol-lock "๐" ;\U0001F512
"*String to use as lock symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-attachment "๐" ;\U0001F4CE
"*String to use as attachement symbol.
\"๐\" is also good candidate."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-photo "๐ท" ;\U0001F4F7
"*String to use as photo symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-audio "๐ถ" ;\U0001F3B6
"*String to use as audio symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-video "๐น" ;\U0001F4F9
"*String to use as video symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-game "๐ฎ" ;\U0001F3AE
"*String to use as video game symbol."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-pending "โ" ;\u231B
"Symbol to use for pending outgoing messages."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-checkmark "โ" ;\u2713
"Symbol for simple check mark."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-heavy-checkmark "โ" ;\u2714
"Symbol for heavy check mark."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-failed "โ" ;\u26D4
"Mark messages that have sending state failed."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-vertical-bar "|\u00A0"
"Symbol used to form vertical lines."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-underline-bar "_"
"Symbol used to draw underline bar.
\"\uFF3F\" is also good candidate for underline bar."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-draft (propertize "Draft" 'face 'error)
"Symbol used for draft formatting."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-unread "โ"
"Symbol used for chats marked as unread.
Good candidates also are ๐ or โฌค."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-verified (propertize "๐
ฅ" 'face 'telega-blue)
"Symbol used to emphasize verified users/groups."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-star (propertize "โ
" 'face 'error)
"Symbol used to emphasize stared chats."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-thunder "๐ฒ"
"Symbol used inside INSTANT VIEW buttons."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-location "๐"
"Symbol used for location."
:type 'string
:options '("๐")
:group 'telega-symbol)
(defcustom telega-symbol-phone "๐"
"Symbol used as phone."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-square "โ "
"Symbol used for large squares."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-ballout-empty "โ"
"Symbol used for empty ballout."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-ballout-check "โ"
"Symbol used for checked ballout."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-contact "๐น"
"Symbol used for contacts."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-play "โถ"
"Symbol used for playing."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-pause "โธ"
"Symbol used for pause."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-invoice "๐"
"Symbol used in invoice messages."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-poll "๐"
"Symbol used in poll messages."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-poll-options (cons "โ" "โ")
"Symbols used to display poll options.
car is for non-selected option, cdr is for selected option."
:type 'cons
:group 'telega-symbol)
(defcustom telega-symbol-attach-brackets (cons "โฌ" "โญ")
"Symbols used to emphasize attachement in chat buffer input."
:type 'cons
:group 'telega-symbol)
(defcustom telega-symbol-webpage-details (cons "โผ" "โฒ")
"Symbols used to display `pageBlockDetails' webpage block."
:type 'cons
:group 'telega-symbol)
(defcustom telega-symbol-online-status (propertize "*" 'face 'success)
"Symbol used to display user's online status in root buffer.
If nil, then user's online status is not displayed."
:type 'string-or-null-p
:group 'telega-symbol)
(defcustom telega-symbol-blocked (propertize "โ" 'face 'error)
"Symbol used to mark blacklisted users."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-inline "โฎ"
"Symbol used to mark attachements with inline result from bot."
:type 'string
:group 'telega-symbol)
(defcustom telega-symbol-widths
(list
(list 1
telega-symbol-contact)
(list 2
telega-symbol-telegram
telega-symbol-eye
telega-symbol-unread
telega-symbol-verified
telega-symbol-thunder
telega-symbol-checkmark
telega-symbol-heavy-checkmark
telega-symbol-ballout-empty
telega-symbol-ballout-check
telega-symbol-play
(car telega-symbol-poll-options)
(cdr telega-symbol-poll-options)
telega-symbol-blocked
))
"*Custom widths for some symbols, used for correct formatting.
Use `telega-symbol-set-width' to install symbol's width.
Install all symbol widths inside `telega-load-hook'."
:type 'list
:group 'telega-symbol)
;;; Faces
(defgroup telega-faces nil
"Group to customize faces used by telega."
:group 'telega)
(defface telega-link
'((t :inherit link :underline nil))
"Face to display various links."
:group 'telega-faces)
(defface telega-button
'((((class color) (min-colors 88) (background light))
:foreground "RoyalBlue3"
:box (:line-width -2 :color "RoyalBlue3" :style nil))
(((class color) (min-colors 88) (background dark))
:foreground "cyan1"
:box (:line-width -2 :color "cyan1" :style nil))
(t :inherit highlight))
"Face used for telega buttons."