@@ -72,6 +72,13 @@ const (
72
72
LeaderUser
73
73
)
74
74
75
+ type Timeline struct {
76
+ FeedType feed.FeedType
77
+ Subaction string
78
+ Name string
79
+ Key Key
80
+ }
81
+
75
82
type General struct {
76
83
Confirmation bool
77
84
DateTodayFormat string
@@ -94,6 +101,8 @@ type General struct {
94
101
LeaderKey rune
95
102
LeaderTimeout int64
96
103
LeaderActions []LeaderAction
104
+ TimelineName bool
105
+ Timelines []Timeline
97
106
}
98
107
99
108
type Style struct {
@@ -306,12 +315,13 @@ type Input struct {
306
315
GlobalBack Key
307
316
GlobalExit Key
308
317
309
- MainHome Key
310
- MainEnd Key
311
- MainPrevFeed Key
312
- MainNextFeed Key
313
- MainNotificationFocus Key
314
- MainCompose Key
318
+ MainHome Key
319
+ MainEnd Key
320
+ MainPrevFeed Key
321
+ MainNextFeed Key
322
+ MainPrevWindow Key
323
+ MainNextWindow Key
324
+ MainCompose Key
315
325
316
326
StatusAvatar Key
317
327
StatusBoost Key
@@ -328,14 +338,15 @@ type Input struct {
328
338
StatusYank Key
329
339
StatusToggleSpoiler Key
330
340
331
- UserAvatar Key
332
- UserBlock Key
333
- UserFollow Key
334
- UserMute Key
335
- UserLinks Key
336
- UserUser Key
337
- UserViewFocus Key
338
- UserYank Key
341
+ UserAvatar Key
342
+ UserBlock Key
343
+ UserFollow Key
344
+ UserFollowRequestDecide Key
345
+ UserMute Key
346
+ UserLinks Key
347
+ UserUser Key
348
+ UserViewFocus Key
349
+ UserYank Key
339
350
340
351
ListOpenFeed Key
341
352
@@ -599,6 +610,7 @@ func parseGeneral(cfg *ini.File) General {
599
610
parts := strings .Split (l , "," )
600
611
if len (parts ) != 2 {
601
612
fmt .Printf ("leader-action must consist of two parts seperated by a comma. Your value is: %s\n " , strings .Join (parts , "," ))
613
+ os .Exit (1 )
602
614
}
603
615
for i , p := range parts {
604
616
parts [i ] = strings .TrimSpace (p )
@@ -658,6 +670,81 @@ func parseGeneral(cfg *ini.File) General {
658
670
}
659
671
general .LeaderActions = las
660
672
}
673
+
674
+ general .TimelineName = cfg .Section ("general" ).Key ("timeline-show-name" ).MustBool (true )
675
+ var tls []Timeline
676
+ timelines := cfg .Section ("general" ).Key ("timelines" ).ValueWithShadows ()
677
+ for _ , l := range timelines {
678
+ parts := strings .Split (l , "," )
679
+ for i , p := range parts {
680
+ parts [i ] = strings .TrimSpace (p )
681
+ }
682
+ if len (parts ) == 0 {
683
+ fmt .Printf ("timelines must consist of atleast one part seperated by a comma. Your value is: %s\n " , strings .Join (parts , "," ))
684
+ os .Exit (1 )
685
+ }
686
+ if len (parts ) == 1 {
687
+ parts = append (parts , "" )
688
+ }
689
+ cmd := parts [0 ]
690
+ var subaction string
691
+ if strings .Contains (parts [0 ], " " ) {
692
+ p := strings .Split (cmd , " " )
693
+ cmd = p [0 ]
694
+ subaction = strings .Join (p [1 :], " " )
695
+ }
696
+ tl := Timeline {}
697
+ switch cmd {
698
+ case "home" :
699
+ tl .FeedType = feed .TimelineHome
700
+ case "direct" :
701
+ tl .FeedType = feed .Conversations
702
+ case "local" :
703
+ tl .FeedType = feed .TimelineLocal
704
+ case "federated" :
705
+ tl .FeedType = feed .TimelineFederated
706
+ case "bookmarks" :
707
+ tl .FeedType = feed .Saved
708
+ case "saved" :
709
+ tl .FeedType = feed .Saved
710
+ case "favorited" :
711
+ tl .FeedType = feed .Favorited
712
+ case "notifications" :
713
+ tl .FeedType = feed .Notification
714
+ case "lists" :
715
+ tl .FeedType = feed .Lists
716
+ case "tag" :
717
+ tl .FeedType = feed .Tag
718
+ tl .Subaction = subaction
719
+ default :
720
+ fmt .Printf ("timeline %s is invalid\n " , parts [0 ])
721
+ os .Exit (1 )
722
+ }
723
+ tl .Name = parts [1 ]
724
+ if len (parts ) > 2 {
725
+ vals := []string {"" }
726
+ vals = append (vals , parts [2 :]... )
727
+ tl .Key = inputStrOrErr (vals , false )
728
+ }
729
+ tls = append (tls , tl )
730
+ }
731
+ if len (tls ) == 0 {
732
+ tls = append (tls ,
733
+ Timeline {
734
+ FeedType : feed .TimelineHome ,
735
+ Name : "" ,
736
+ },
737
+ )
738
+ tls = append (tls ,
739
+ Timeline {
740
+ FeedType : feed .Notification ,
741
+ Name : "[N]otifications" ,
742
+ Key : inputStrOrErr ([]string {"" , "'n'" , "'N'" }, false ),
743
+ },
744
+ )
745
+ }
746
+ general .Timelines = tls
747
+
661
748
return general
662
749
}
663
750
@@ -893,12 +980,13 @@ func parseInput(cfg *ini.File) Input {
893
980
GlobalBack : inputStrOrErr ([]string {"\" [Esc]\" " , "\" Esc\" " }, false ),
894
981
GlobalExit : inputStrOrErr ([]string {"\" [Q]uit\" " , "'q'" , "'Q'" }, false ),
895
982
896
- MainHome : inputStrOrErr ([]string {"\" \" " , "'g'" , "\" Home\" " }, false ),
897
- MainEnd : inputStrOrErr ([]string {"\" \" " , "'G'" , "\" End\" " }, false ),
898
- MainPrevFeed : inputStrOrErr ([]string {"\" \" " , "'h'" , "'H'" , "\" Left\" " }, false ),
899
- MainNextFeed : inputStrOrErr ([]string {"\" \" " , "'l'" , "'L'" , "\" Right\" " }, false ),
900
- MainNotificationFocus : inputStrOrErr ([]string {"\" [N]otifications\" " , "'n'" , "'N'" }, false ),
901
- MainCompose : inputStrOrErr ([]string {"\" \" " , "'c'" , "'C'" }, false ),
983
+ MainHome : inputStrOrErr ([]string {"\" \" " , "'g'" , "\" Home\" " }, false ),
984
+ MainEnd : inputStrOrErr ([]string {"\" \" " , "'G'" , "\" End\" " }, false ),
985
+ MainPrevFeed : inputStrOrErr ([]string {"\" \" " , "'h'" , "'H'" , "\" Left\" " }, false ),
986
+ MainNextFeed : inputStrOrErr ([]string {"\" \" " , "'l'" , "'L'" , "\" Right\" " }, false ),
987
+ MainPrevWindow : inputStrOrErr ([]string {"\" \" " , "\" Backtab\" " }, false ),
988
+ MainNextWindow : inputStrOrErr ([]string {"\" \" " , "\" Tab\" " }, false ),
989
+ MainCompose : inputStrOrErr ([]string {"\" \" " , "'c'" , "'C'" }, false ),
902
990
903
991
StatusAvatar : inputStrOrErr ([]string {"\" [A]vatar\" " , "'a'" , "'A'" }, false ),
904
992
StatusBoost : inputStrOrErr ([]string {"\" [B]oost\" " , "\" Un[B]oost\" " , "'b'" , "'B'" }, true ),
@@ -915,14 +1003,15 @@ func parseInput(cfg *ini.File) Input {
915
1003
StatusYank : inputStrOrErr ([]string {"\" [Y]ank\" " , "'y'" , "'Y'" }, false ),
916
1004
StatusToggleSpoiler : inputStrOrErr ([]string {"\" Press [Z] to toggle spoiler\" " , "'z'" , "'Z'" }, false ),
917
1005
918
- UserAvatar : inputStrOrErr ([]string {"\" [A]vatar\" " , "'a'" , "'A'" }, false ),
919
- UserBlock : inputStrOrErr ([]string {"\" [B]lock\" " , "\" Un[B]lock\" " , "'b'" , "'B'" }, true ),
920
- UserFollow : inputStrOrErr ([]string {"\" [F]ollow\" " , "\" Un[F]ollow\" " , "'f'" , "'F'" }, true ),
921
- UserMute : inputStrOrErr ([]string {"\" [M]ute\" " , "\" Un[M]ute\" " , "'m'" , "'M'" }, true ),
922
- UserLinks : inputStrOrErr ([]string {"\" [O]pen\" " , "'o'" , "'O'" }, false ),
923
- UserUser : inputStrOrErr ([]string {"\" [U]ser\" " , "'u'" , "'U'" }, false ),
924
- UserViewFocus : inputStrOrErr ([]string {"\" [V]iew\" " , "'v'" , "'V'" }, false ),
925
- UserYank : inputStrOrErr ([]string {"\" [Y]ank\" " , "'y'" , "'Y'" }, false ),
1006
+ UserAvatar : inputStrOrErr ([]string {"\" [A]vatar\" " , "'a'" , "'A'" }, false ),
1007
+ UserBlock : inputStrOrErr ([]string {"\" [B]lock\" " , "\" Un[B]lock\" " , "'b'" , "'B'" }, true ),
1008
+ UserFollow : inputStrOrErr ([]string {"\" [F]ollow\" " , "\" Un[F]ollow\" " , "'f'" , "'F'" }, true ),
1009
+ UserFollowRequestDecide : inputStrOrErr ([]string {"\" Follow [R]equest\" " , "\" Follow [R]equest\" " , "'r'" , "'R'" }, true ),
1010
+ UserMute : inputStrOrErr ([]string {"\" [M]ute\" " , "\" Un[M]ute\" " , "'m'" , "'M'" }, true ),
1011
+ UserLinks : inputStrOrErr ([]string {"\" [O]pen\" " , "'o'" , "'O'" }, false ),
1012
+ UserUser : inputStrOrErr ([]string {"\" [U]ser\" " , "'u'" , "'U'" }, false ),
1013
+ UserViewFocus : inputStrOrErr ([]string {"\" [V]iew\" " , "'v'" , "'V'" }, false ),
1014
+ UserYank : inputStrOrErr ([]string {"\" [Y]ank\" " , "'y'" , "'Y'" }, false ),
926
1015
927
1016
ListOpenFeed : inputStrOrErr ([]string {"\" [O]pen\" " , "'o'" , "'O'" }, false ),
928
1017
@@ -954,7 +1043,6 @@ func parseInput(cfg *ini.File) Input {
954
1043
ic .MainEnd = inputOrErr (cfg , "main-end" , false , ic .MainEnd )
955
1044
ic .MainPrevFeed = inputOrErr (cfg , "main-prev-feed" , false , ic .MainPrevFeed )
956
1045
ic .MainNextFeed = inputOrErr (cfg , "main-next-feed" , false , ic .MainNextFeed )
957
- ic .MainNotificationFocus = inputOrErr (cfg , "main-notification-focus" , false , ic .MainNotificationFocus )
958
1046
ic .MainCompose = inputOrErr (cfg , "main-compose" , false , ic .MainCompose )
959
1047
960
1048
ic .StatusAvatar = inputOrErr (cfg , "status-avatar" , false , ic .StatusAvatar )
@@ -975,6 +1063,7 @@ func parseInput(cfg *ini.File) Input {
975
1063
ic .UserAvatar = inputOrErr (cfg , "user-avatar" , false , ic .UserAvatar )
976
1064
ic .UserBlock = inputOrErr (cfg , "user-block" , true , ic .UserBlock )
977
1065
ic .UserFollow = inputOrErr (cfg , "user-follow" , true , ic .UserFollow )
1066
+ ic .UserFollowRequestDecide = inputOrErr (cfg , "user-follow-request-decide" , true , ic .UserFollowRequestDecide )
978
1067
ic .UserMute = inputOrErr (cfg , "user-mute" , true , ic .UserMute )
979
1068
ic .UserLinks = inputOrErr (cfg , "user-links" , false , ic .UserLinks )
980
1069
ic .UserUser = inputOrErr (cfg , "user-user" , false , ic .UserUser )
0 commit comments