-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
telega-customize.el
3279 lines (2816 loc) ยท 111 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 <[email protected]>
;; 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:
(require 'widget) ; `define-widget'
(require 'cus-edit) ; `custom-variable-type'
(require 'dired) ; `dired-dwim-target'
(require 'svg) ; `svg-embed-base-uri-image'
(require 'minibuffer) ; `completing-read-function', `completion-styles'
;; Types for readability
(define-widget 'telega-chat-temex 'lazy
"Temex to match a chat."
:tag "Chat Temex"
:type 'sexp)
(define-widget 'telega-user-temex 'lazy
"Temex to match a user."
:tag "User Temex"
:type 'sexp)
(define-widget 'telega-msg-temex 'lazy
"Temex to match a message."
:tag "Message Temex"
:type 'sexp)
(define-widget 'telega-sender-temex 'lazy
"Temex to match a message sender."
:tag "Message Sender Temex"
:type 'sexp)
(define-widget 'telega-topic-temex 'lazy
"Temex to match a topic."
:tag "Topic Temex"
:type 'sexp)
(define-widget 'telega-story-temex 'lazy
"Temex to match a story."
:tag "Story Temex"
:type 'sexp)
(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.
Set this variable before loading telega, because other variables
depends on `telega-directory' value."
:type 'directory
:group 'telega)
(defcustom telega-database-dir telega-directory
"*Directory for the TDLib's persistent database."
:type 'directory
:group 'telega)
(defcustom telega-cache-dir (expand-file-name "cache" telega-directory)
"*Directory for telegram downloads."
:type 'directory
:group 'telega)
(defcustom telega-temp-dir (expand-file-name "temp" telega-directory)
"*Directory for temporary files used by telega."
:type 'directory
:group 'telega)
(defcustom telega-accounts nil
"*List of the accounts to be used by telega.
Each element is a list in form:
(ACCOUNT-NAME CUSTOM-VAR1 VAL1 CUSTOM-VAR2 VAL2 ...).
At least `telega-database-dir' should be customized for each account."
:type 'sexp
: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"
:language_pack_id telega-language
:use_storage_optimizer :false
:ignore_file_names :false)
"*Plist of options to set.
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 '(choice (boolean :tag "On/Off")
(list (choice (const :tag "Add debug into IV" iv)
(const :tag "Add debug into info buffers" info))))
:group 'telega)
(defcustom telega-use-test-dc nil
"*Non-nil to use telegram's test environment instead of production."
:type 'boolean
:group 'telega)
(defcustom telega-use-file-database t
"Non-nil to save downloaded/uploaded files among restarts."
:type 'boolean
:group 'telega)
(defcustom telega-use-chat-info-database t
"Cache chats informations among restarts.
Implies `telega-use-file-database' set to non-nil."
:type 'boolean
: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 'boolean
:group 'telega)
(defcustom telega-proxies nil
"*List of proxies.
Format is:
(:server \"<ADDRESS>\" :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 '(repeat plist)
:group 'telega)
(defcustom telega-idle-delay 0.5
"*Delay before taking actions when Emacs gets idle."
:type 'number
: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-date-format-alist
'((today . "%H:%M")
(this-week . "%a")
(old . "%d.%m.%y")
(date . "%d.%m.%y")
(time . "%H:%M")
(date-time . "%d.%m.%y %a %H:%M")
(date-long . "%d %B %Y")
(date-break-bar . "%d %B %Y %a"))
"Alist of date and time formats.
Value is a format accepted by `format-time-string'."
:package-version '(telega . "0.8.240")
:type '(alist :key-type
(choice (const :tag "If date is today" today)
(const :tag "If date is on this week" this-week)
(const :tag "If date is older than this week" old)
(const :tag "Format for the date only" date)
(const :tag "Format for the time only" time)
(const :tag "Full date with time" date-time)
(const :tag "Long format for the date only" date-long)
(const :tag "Format for date break bar" date-break-bar))
:value-type string)
:group 'telega)
(defcustom telega-help-messages t
"*Non-nil to show sometime UI related messages."
:type 'boolean
: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-short-numbers t
"Non-nil to write numbers larger then 1000 in \"X.Yk\" form."
:package-version '(telega . "0.7.57")
:type 'boolean
:group 'telega)
(defcustom telega-use-tracking-for nil
"*Specifies Chat Temex for chats to be tracked with tracking.el.
Make sure you have tracking.el loaded if this option is used.
Only chats with corresponding opened chatbuf are tracked.
Tracking notifications for telega buffers will use the
`telega-tracking` face."
:package-version '(telega . "0.5.7")
:type 'telega-chat-temex
:options '((not (or saved-messages (type channel bot)))
(or unmuted mention))
:group 'telega)
(defcustom telega-chat-delete-skip-confirmation-for nil
"*Specifies Chat Temex for chats which can be deleted without
typing confirmation."
:package-version '(telega . "0.8.293")
:type 'telega-chat-temex
:group 'telega-chat)
(defcustom telega-image-transform-smoothing t
"Default value for the `:transform-smoothing' image property.
If nil, then smoothing is applied only for downscaled images, if image
is upscaled then nearest neighbor filter is used to show real pixels."
:package-version '(telega . "0.8.291")
:type 'boolean
:group 'telega)
(defcustom telega-use-images (or (and (fboundp 'image-transforms-p)
(funcall 'image-transforms-p))
(when (fboundp 'imagemagick-types)
'imagemagick))
"Non-nil to show images.
Explicitly set it to non-nil if using Emacs as a service and
want to create X frames to show images.
See https://zevlg.github.io/telega.el/#settings-for-emacs-as-daemon
Set to `imagemagick' to use ImageMagick to handle images (not recommended)."
:package-version '(telega . "0.8.256")
:type 'sexp
:group 'telega)
(defcustom telega-use-svg-base-uri (fboundp 'svg-embed-base-uri-image)
"Non-nil to use `:base-uri' SVG functionality."
:type 'boolean
:group 'telega)
(defcustom telega-use-one-line-preview-for (when telega-use-svg-base-uri 'all)
"Chat Temex for chats where to show one-line previews for photos/videos.
Used only if `telega-use-images' is non-nil.
Enable it only if you have `:base-uri' SVG functionality, otherwise
performance might suffer."
:package-version '(telega . "0.7.26")
:type 'telega-chat-temex
:group 'telega-chat)
;; See https://t.me/emacs_telega/12459
(defcustom telega-box-button-endings 'telega-box-button--endings-func
"*Characters to use as beginning/ending of the button.
Set to (\"[\" . \"]\") in nox-emacs setup.
Could be a function of one argument - LABEL, should return cons
cell of endings for the button with LABEL."
:type '(choice function (cons string string))
:group 'telega)
(defcustom telega-builtin-palettes-alist
;; Palettes for builtin colors:
;; red, orange, purple/voilet, green, cyan, blue, pink
'((light
((:outline "#990000") (:foreground "#aa0000") (:background "#d1c7c7"))
((:outline "#994c00") (:foreground "DarkOrange3") (:background "#d1ccc7"))
((:outline "#4e1781") (:foreground "purple3") (:background "#cdc7d1"))
((:outline "#006000") (:foreground "#007000") (:background "#c7d1c7"))
((:outline "#007070") (:foreground "cyan4") (:background "#cacfcf"))
((:outline "#003365") (:foreground "#014d98") (:background "#c6cbd1"))
((:outline "#5e0736") (:foreground "DeepPink3") (:background "#d1c7cb")))
(dark
((:outline "#ff0a0a") (:foreground "#dd0000") (:background "#3d2828"))
((:outline "#ff8d1e") (:foreground "DarkOrange2") (:background "#2c2620"))
((:outline "#f6c2f6") (:foreground "violet") (:background "#2e1e2e"))
((:outline "#0aff0a") (:foreground "#00dd00") (:background "#1e2e1e"))
((:outline "#00f5f6") (:foreground "cyan3") (:background "#234242"))
((:outline "#3e9efd") (:foreground "#168afd") (:background "#1e262e"))
((:outline "#fabddd") (:foreground "#f688c3") (:background "#470528"))
))
"Alist of builtin colors for light and dark themes."
:package-version '(telega . "0.8.292")
:type '(alist :key-type
(choice (const :tag "Colors for light theme" light)
(const :tag "Colors for dark theme" dark))
:value-type (repeat (list string)))
:group 'telega)
(defcustom telega-palette-context-ignore-list '(msg-header)
"List of `telega-palette-context' values to ignore."
:type '(list symbol)
:package-version '(telega . "0.8.292")
:group 'telega)
;;; ellit-org: inline-bot-options
;; - {{{user-option(telega-known-inline-bots,2)}}}
(defcustom telega-known-inline-bots '("@gif" "@youtube" "@pic")
"List of known bots for everyday use."
:type '(repeat string)
:group 'telega)
;;; ellit-org: inline-bot-options
;; - {{{user-option(telega-inline-query-window-select,2)}}}
(defcustom telega-inline-query-window-select t
"*Non-nil to select window with inline query results."
:type 'boolean
:group 'telega)
(defcustom telega-inline-login-url-action 'query-all
"Action to take on login url keyboard buttons."
:package-version '(telega . "0.6.30")
:type '(choice (const :tag "Ask user what to do" query-all)
(const :tag "Ask user to open url only" query-open)
(const :tag "Open url without query, but query user for login and write access" query-login-and-write-access)
(const :tag "Open url without query, but query user for login, without querying for write access" query-login-only)
(const :tag "Do not login, just open the url" nil))
: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 (get 'display-buffer-alist 'custom-type)
:group 'telega)
(defcustom telega-translate-to-language-by-default nil
"Default language code for messages translation.
If nil, then use language suggested by the server."
:package-version '(telega . "0.8.72")
:type '(choice (const :tag "Suggested by the server" nil)
string)
:group 'telega)
(defcustom telega-translate-replace-content nil
"Non-nil to replace message's content with the translated text.
Original message's content can be seen with
`\\<telega-chat-mode-map>\\[telega-describe-message]' command."
:package-version '(telega . "0.8.72")
:type 'boolean
:group 'telega)
(defconst telega-tdlib-network-type-alist
'((nil . (:@type "networkTypeNone"))
(mobile . (:@type "networkTypeMobile"))
(roaming-mobile . (:@type "networkTypeMobileRoaming"))
(wi-fi . (:@type "networkTypeWiFi"))
(other . (:@type "networkTypeOther")))
"Network types.")
(defcustom telega-network-type 'other
"Network type to use by default.
Use `M-x telega-set-network-type RET' to change it while telega is
running."
:type `(choice ,@(mapcar (lambda (nt)
(list 'const :tag
(substring (plist-get (cdr nt) :@type) 11)
(car nt)))
telega-tdlib-network-type-alist))
:group 'telega)
;;; Docker support
(defgroup telega-docker nil
"Customisation for docker support."
:prefix "telega-docker-"
:group 'telega)
(defcustom telega-use-docker nil
"*Non-nil to use \"docker\" to run various tools.
Including `telega-server'.
Could be a string denoting binary to use instead of \"docker\"."
:package-version '(telega . "0.7.40")
:type '(choice boolean
(string :tag "Docker binary"))
:options '("podman")
:group 'telega-docker)
(defcustom telega-docker-security-opt "apparmor=unconfined"
"security-opt option for the docker run command.
Set to \"apparmor=unconfined\" if you use `telega-appindicator-mode'."
:package-version '(telega . "0.7.40")
:type 'string
:group 'telega-docker)
;; NOTE: see https://t.me/emacs_telega/39721
;; for Debian 11 running telega-server under docker
(defcustom telega-docker-volumes '("/usr/share/X11/xkb")
"List of additional volumes to attach."
:package-version '(telega . "0.8.121")
:type '(repeat directory)
:group 'telega-docker)
;; To use something like: docker run --security-opt apparmor=unconfined -i -u %u -v %w:%w -v /tmp/.X11-unix:/tmp/.X11-unix -v $XAUTHORITY:$XAUTHORITY -v /var/run/dbus:/var/run/dbus -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY --net=host %i
(defcustom telega-docker-run-command nil
"Custom docker command to use to run `telega-server' in docker.
If nil, autogenerate the command according to all telega docker settings.
%u - substituted with current used UID:GID
%w - substituted with current Telegram account database directory.
%i - substituted with infered docker image name."
:package-version '(telega . "0.7.40")
:type '(choice (const :tag "Automatically generate" nil)
(string :tag "Custom docker command"))
:group 'telega-docker)
(defcustom telega-docker-run-arguments nil
"Additional arguments just after \"run\" command of the docker.
For podman setup you might want to use \"--userns=keep-id\" as value
for the `telega-docker-run-arguments'."
:package-version '(telega . "0.8.75")
:type '(choice (const :tag "No additional arguments" nil)
(string :tag "Custom docker run arguments"))
:group 'telega-docker)
(defgroup telega-emoji nil
"Customisation for telega emojis."
:prefix "telega-emoji-"
:group 'telega)
(defcustom telega-emoji-custom-alist nil
"*Alist of custom emojis to add along with `etc/emojis.alist'."
:type '(alist :key-type string :value-type string)
:group 'telega-emoji)
(defcustom telega-emoji-font-family
(let ((ffl (font-family-list)))
(or (car (member "Emoji One" ffl))
(car (member "Twemoji" ffl))
(car (member "Noto Color Emoji" ffl))))
"*Font to use for emoji image generation using `telega-emoji-create-svg'."
:type '(choice (const :tag "None" nil)
(string :tag "Font Name"))
:group 'telega-emoji)
(defcustom telega-emoji-use-images
(and telega-use-images (image-type-available-p 'svg) telega-emoji-font-family)
"*Non-nil to use images for emojis."
:type 'boolean
:group 'telega-emoji)
(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-emoji)
;; Stickers/Animations
(defcustom telega-sticker-size '(4 . 24)
"*Size for the sticker.
car is height in chars to use.
cdr is maximum width in chars to use."
:type '(cons (integer :tag "Height in chars")
(integer :tag "Maximum width in chars"))
:group 'telega)
(defcustom telega-sticker-favorite-background "cornflower blue"
"*Background color for the favorite stickers.
Can be nil, in this case favorite stickers are not outlined."
:type '(choice (const :tag "None" nil) color)
: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-cover telega-use-images
"*Non-nil to show sticker set cover when completing stickerset."
: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-sticker-animated-play
(and telega-use-images
(or (executable-find "tgs2png") telega-use-docker))
"Non-nil to play animated stickers inside Emacs.
Requires `tgs2png' program from https://github.com/zevlg/tgs2png"
:package-version '(telega . "0.7.30")
:type 'boolean
:group 'telega)
(defcustom telega-emoji-animated-play
(when telega-sticker-animated-play 'with-sound)
"Non-nil to play animated emoji as animated sticker.
Can be the `with-sound' symbol , in this case play animated emoji with sound."
:package-version '(telega . "0.7.81")
:type 'boolean
:group 'telega-emoji)
(defcustom telega-animation-height 5
"*Height in chars for animations."
:type 'integer
:group 'telega)
(defcustom telega-animation-play-inline 10
"*Non-nil to play animation inside telega.
If number, then play animation inline only if animation is shorter
then this number of seconds."
:package-version '(telega . "0.7.45")
:type '(choice boolean integer)
:group 'telega)
(defcustom telega-animation-download-saved nil
"*Non-nil to automatically download saved animations."
:type 'boolean
:group 'telega)
(defcustom telega-avatar-factors-alist
'((1 . (0.8 . 0.1))
(2 . (0.8 . 0.1)))
"*Alist of size coefficients used in avatar creation.
Each element is in form:
(CHEIGHT CIRCLE-FACTOR . MARGIN-FACTOR)
See `telega-avatar--create-image' for more info."
:package-version '(telega . "0.5.8")
:type '(alist :key-type (integer :tag "Height in chars")
:value-type (cons (number :tag "Circle factor")
(number :tag "Margin factar")))
:group 'telega)
(defcustom telega-avatar-workaround-gaps-for nil
"Chat temex for chats to enable workaround for gaps in the avatars."
:package-version '(telega . "0.8.215")
:type 'chat-temex
:options '((return t))
:group 'telega)
(defcustom telega-avatar-text-function #'telega-avatar-text-simple
"Function to be used to get text for the first slice of the avatar."
:package-version '(telega . "0.8.215")
:type 'function
:options '(telega-avatar-text-composed)
:group 'telega)
(defcustom telega-vvnote-waves-height-factor 0.8
"*Factor for waves svg height."
:package-version '(telega . "0.8.292")
:type 'float
:group 'telega)
(defcustom telega-video-note-height '(6 . 9)
"*Height in chars for video notes.
Can be also a cons cell, where car specifies height for video note
when note is not playing, and cdr specifies height for video note when
note is currently playing."
:package-version '(telega . "0.7.54")
:type '(choice integer (cons integer 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.
NOT USED."
:type 'boolean
:group 'telega)
(defcustom telega-video-play-incrementally t
"Non-nil to start playing video while still downloading the file."
:package-version '(telega . "0.7.40")
:type 'boolean
:group 'telega)
(defcustom telega-video-player-command
(cond ((executable-find "ffplay")
'(concat "ffplay -autoexit"
(when telega-ffplay-media-timestamp
(format " -ss %f" telega-ffplay-media-timestamp))))
((executable-find "mpv")
'(concat "mpv"
(when telega-ffplay-media-timestamp
(format " --start=%f" telega-ffplay-media-timestamp))))
((executable-find "mplayer")
'(concat "mplayer"
(when telega-ffplay-media-timestamp
(format " -ss %f" telega-ffplay-media-timestamp)))))
"Command used to play video files.
Can be a sexp to evaluate to get a command."
:package-version '(telega . "0.7.57")
:type '(choice string (list string))
:options '("mpv" "ffplay -autoexit -fs")
:group 'telega)
(defcustom telega-open-file-function #'find-file
"Function to use to open files associated with messages.
Called with single argument - filename to open.
Could be used to open files in external programs.
Set it to `org-open-file' to use Org mode to open files."
:package-version '(telega . "0.6.31")
:type 'function
:options '(org-open-file browse-url-xdg-open)
:group 'telega)
(defcustom telega-open-message-as-file nil
"List of message types to open as file using `telega-open-file-function'.
Supported message types are: `photo', `video', `audio',
`video-note', `voice-note', `animation'.
Document messages are always opens as file."
:package-version '(telega . "0.7.0")
:type '(repeat (choice (const :tag "Photo messages" photo)
(const :tag "Video messages" video)
(const :tag "Audio messages" audio)
(const :tag "Video Note messages" video-note)
(const :tag "Voice Note messages" voice-note)
(const :tag "Animation messages" animation)))
:group 'telega)
(defcustom telega-open-message-ffplay-args
'((audio . "-nodisp")
(voice-note . "-nodisp")
(animated-emoji . "-nodisp")
(animation . "-loop 0"))
"*Additional arguments to ffplay to play various type of messages.
Each element is a cons cell, where car is one of: `video', `audio',
`video-note', `voice-note', `animation', `animated-emoji' and cdr is
string with additional ffplay arguments.
Some useful ffplay arguments to consider:
- \"-volume 10\" to play with dimmed volume
- \"-fs\" for `video' messages, to start at fullscreen."
:package-version '(telega . "0.7.5")
:type '(alist :key-type symbol :value-type string)
:group 'telega)
(defcustom telega-browse-url-alist nil
"Alist of custom url browse functions.
Each element is in form: `(PREDICATE-OR-REGEX . FUNCTION)'."
:package-version '(telega . "0.7.8")
:type '(alist :key-type (choice function regexp)
:value-type function)
: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 latitude.
%E substituted with longitude."
:type 'string
:options '("https://yandex.ru/maps/?ll=%E,%N&pt=%E,%N&z=15")
:group 'telega)
(defcustom telega-my-location nil
"Set to non-nil to use this as location of me.
Plist in form (:latitude <LAT> :longitude <LONG>)
To publically expose this location set `:is_location_visible' to
non-nil in `telega-options-plist'.
Used to calculate distances from other peers to me."
:type 'plist
: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 integer integer)
: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]. Use 1."
:type 'number
:group 'telega)
(defcustom telega-location-show-me t
"*Non-nil to show me on location maps if it fits into the map thumbnail."
:package-version '(telega . "0.7.63")
:type 'boolean
:group 'telega)
(defcustom telega-location-live-tracks t
"*Non-nil to draw live location tracks."
:type 'boolean
: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.
It should be absolute path or binary file searchable in `exec-path'."
: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 'directory
: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 'file
: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 'integer
: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-default-view-function 'telega-view-default
"*Default view for the rootbuf."
:package-version '(telega . "0.6.23")
:type 'function
:group 'telega-root)
(defcustom telega-root-view-ewocs-delim
(propertize "\n" 'display '((height 0.25)))
"Delimiter for the root view ewocs."
:package-version '(telega . "0.6.23")
:type 'string
:group 'telega-root)
(defcustom telega-root-view-grouping-alist
'(("Important" . important))
"Alist of chat temexes for \"grouping\" root view.
Car is name of the chats group, cdr is a chat temex to match chats."
:package-version '(telega . "0.8.221")
:type 'alist
:group 'telega-root)
;;; ellit-org: folders-options
;; - {{{user-option(telega-root-view-grouping-folders, 2)}}}
(defcustom telega-root-view-grouping-folders 'append
"*Non-nil to add Chat Folders in the grouping root view.
Could be one of `prepend', `append' or nil."
:package-version '(telega . "0.8.221")
:type '(choice (const :tag "Prepend folders" prepend)
(const :tag "Append folders" append)
(const :tag "Do not add folders" nil))
:group 'telega-root)
(defcustom telega-root-view-grouping-other-chats t
"*Non-nil to show other chats in the \"grouping\" root view."
:package-version '(telega . "0.6.30")
:type 'boolean
:group 'telega-root)
(defcustom telega-root-view-top-categories
'(("Users" . 10)
("Groups" . 10)
("Channels" . 10)
("Bots" . 10)
("InlineBots" . 10)
("Calls" . 10)
("ForwardChats" . 10))
"List of top categories with limits."
:package-version '(telega . "0.6.23")
:type '(alist :key-type string :value-type integer)
:group 'telega-root)
(defcustom telega-root-view-files-exclude-subdirs
'((telega-file--downloaded-p "thumbnails" "profile_photos"))
"Alist specifying which subdirs to exclude when viewing files.
car of each element is predicate matching file, and rest is list of
subdirectories to ignore, i.e. if absolute file name contains any of
the subdirectory in list, then file is ignored.
Supported predicates: `telega-file--downloading-p',
`telega-file--uploading-p', `telega-file--downloaded-p',
`telega-file--uploaded-p', `telega-file--partially-downloaded-p',
`telega-file--partially-uploaded-p'"
:package-version '(telega . "0.7.6")
:type 'alist
:group 'telega-root)
(defcustom telega-root-keep-cursor 'track
"*Non-nil to keep cursor at current chat, even if chat's order changes.
Set to `track', to move cursor to corresponding chat button, when
chat buffers are switched, useful in side-by-side window setup
for rootbuf and chatbuf.
Consider setting `switch-to-buffer-preserve-window-point' to nil,
to make `telega-root-keep-cursor' always work as expected."
:type '(choice (const :tag "Track chat buffers" track)
(const :tag "Stick to chat at point" t))
:group 'telega-root)
(defcustom telega-root-show-avatars (and telega-use-images
(image-type-available-p 'svg))
"*Non-nil to show chat avatars in root buffer."
: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-root-aux-inserters nil
"List of additional inserters to show below Status in the rootbuf.
Can be used to display additional global data.
Insert MUST return non-nil if something has been inserted."
:package-version '(telega . "0.7.56")
:type '(repeat function)
:group 'telega-root)
;;; ellit-org: folders-options
;; - {{{user-option(telega-folder-icons-alist, 2)}}}
(defcustom telega-folder-icons-alist
(list (cons "All" "๐ฌ")
(cons "Unread" "โ
")
(cons "Unmuted" "๐")
(cons "Bots" "๐ค๏ธ")
(cons "Channels" "๐ข")
(cons "Groups" "๐ฅ")
(cons "Private" "๐ค")
;; NOTE: all folders has "Custom" icon name, to avoid icon
;; being displayed with folder name we exclude "Custom" from
;; the list
; (cons "Custom" "๐")
(cons "Setup" "๐")
(cons "Cat" "๐ฑ")
(cons "Crown" "๐")
(cons "Favorite" "โญ๏ธ")
(cons "Flower" "๐น")
(cons "Game" "๐ฎ")
(cons "Home" "๐ ")
(cons "Love" "โค๏ธ")
(cons "Mask" "๐ญ") ; or ๐ท
(cons "Party" "๐ธ")
(cons "Sport" "โฝ๏ธ") ; or ๐
(cons "Study" "๐")
(cons "Trade" "๐") ; or ๐
(cons "Travel" "๐ซ๏ธ") ; or โ๏ธ
(cons "Work" "๐ผ")
(cons "Airplane" "โ๏ธ๏ธ")
(cons "Book" "๐")
; (cons "Light")
(cons "Like" "๐")
(cons "Money" "๐ฐ")
(cons "Note" "๐๏ธ")
; (cons "Palette")
)
"Alist of symbols to be used as folder icons instead of `telega-symbol-folder'.
See list of all available icon names in `telega-folder-icon-names'."
:type 'alist
:group 'telega)
;;; ellit-org: folders-options
;; - {{{user-option(telega-chat-folders-insexp, 2)}}}
(defcustom telega-chat-folders-insexp 'telega-folders-insert-default
"Inserter sexp for chat folders prefixing chat's title.
While using this insexp `telega-chat-folders' is bound to the list of
folder names to be inserted."
:package-version '(telega . "0.8.255")
:type 'sexp
:group 'telega-chat)
;;; ellit-org: folders-options
;; - {{{user-option(telega-chat-folders-exclude, 2)}}}
(defcustom telega-chat-folders-exclude (list "Unread" "Personal")
"Exclude these folders from chat folders list to be displayed."
:package-version '(telega . "0.6.30")
:type '(repeat (string :tag "Folder"))
:group 'telega-chat)
(defcustom telega-chat-title-custom-for
(list (cons '(or saved-messages replies-messages)
(lambda (title) (propertize title 'face 'bold)))
)
"Alist of custom titles for chats.
Each element is a cons cell, where car is a Chat Temex and cdr
is a function accepting title string and returning string."
:package-version '(telega . "0.6.31")
:type '(alist :key-type telega-chat-temex
:value-type function)
:group 'telega-root)
(defcustom telega-chat-button-width '(0.35 15 48)
"*Width for the chat buttons in root buffer.
If integer, then use this number of chars.
If float in range (0..1), then occupy this percents of
`telega-root-fill-column' chars, but not less then 10 chars.
If list, where first element is float, then use 1 and 2 list values as
min and max values for a width calculation using
`telega-canonicalize-number'."
:package-version '(telega . "0.7.41")
:type '(choice number (list number))
:group 'telega-chat)
(defcustom telega-chat-button-format-plist
(list :with-folders-insexp 'telega-chat-folders-insexp
:with-unread-trail-p t
:with-status-icons-trail-p t)
"Plist specifies formatting for a chat button in the rootbuf.
Possible arguments:
`:with-folders-insexp' - Use inserter sexp for chat folders.
`:with-username-p' - To show username along with title.
Could be a face to be used for username.
`:with-title-faces-p' - To use chat specific colors for title.
`:with-unread-trail-p' - To show unread messages status inside brackets.
`:with-members-trail-p' - To show members trail inside brackets.
`:with-status-icons-trail-p' - To show status icons outside brackets."
:package-version '(telega . "0.8.121")
:type 'plist
:group 'telega-chat)
(defcustom telega-chat-format-plist-for-completion
(list ;:with-folders-insexp 'telega-chat-folders-insexp
:with-title-faces-p t
:with-username-p 'telega-username
:with-unread-trail-p t
:with-status-icons-trail-p t)
"Formatting for the chat button while performing read with completions.
Used in the `telega-msg-sender-title-for-completion' function."
:package-version '(telega . "0.8.255")
:type 'plist
:group 'telega-chat)
(defcustom telega-chat-button-format-temex nil
"Non-nil to use temex instead of `telega-chat-button-format-plist'.
This temex should return plist in the
`telega-chat-button-default-format' form as a result of matching. So
different chats could have different formatting."
:package-version '(telega . "0.8.121")
:type 'telega-chat-temex
:group 'telega-root)
(defcustom telega-topic-button-format-plist
(list :prefix-space " "
:with-unread-trail-p t
:with-status-icons-trail-p t)
"Plist specifies formatting for a chat button in the rootbuf.
Possible arguments:
`:prefix-space' - Prefix to use in the beginning of topic button.
`:with-brackets-p' - To show topic `telega-symbol-topic-brackets'.
`:with-title-faces-p' - To use topic specific colors for title.
`:with-unread-trail-p' - To show unread messages status inside brackets.
`:with-status-icons-trail-p' - To show status icons outside brackets."
:package-version '(telega . "0.8.121")
:type 'plist
:group 'telega-root)
(defcustom telega-topic-button-format-temex nil
"Non-nil to use this topic temex instead of `telega-topic-button-format-plist'.
This topic temex should return plist in the
`telega-topic-button-default-format' form as a result of matching. So
different topics could have different formatting."
:package-version '(telega . "0.8.121")
:type 'telega-topic-temex
:group 'telega-root)
(defcustom telega-topic-button-sort-by-recency t
"Non-nil to sort topic buttons in the rootbuf by last message recency."
:type 'boolean
:group 'telega-root)
(defcustom telega-brackets