This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
/
preferences.go
261 lines (253 loc) · 8.5 KB
/
preferences.go
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
package config
// Feature : 機能
type Feature struct {
// MainUser : メインで使用するユーザ
MainUser string `toml:"main_user"`
// LoadTweetsLimit : 1度に読み込むツイート数
LoadTweetsLimit int `toml:"load_tweets_limit"`
// AccmulateTweetsLimit : ツイートの最大蓄積数
AccmulateTweetsLimit int `toml:"accmulate_tweets_limit"`
// UseExternalEditor : ツイート編集に外部エディタを使用するか
UseExternalEditor bool `toml:"use_external_editor"`
// IsLocaleCJK : ロケールがCJKか
IsLocaleCJK bool `toml:"is_locale_cjk"`
// StartupCmds : 起動時に実行するコマンド
StartupCmds []string `toml:"startup_cmds"`
}
// Appearancene : 外観
type Appearancene struct {
// StyleFilePath : 配色テーマファイルのパス
StyleFilePath string `toml:"style_file"`
// DateFormat : 日付のフォーマット
DateFormat string `toml:"date_fmt"`
// TimeFormat : 時刻のフォーマット
TimeFormat string `toml:"time_fmt"`
// UserBIOMaxRow : ユーザBIOの最大表示行数
UserBIOMaxRow int `toml:"user_bio_max_row"`
// UserProfilePaddingX : ユーザプロフィールの左右パディング
UserProfilePaddingX int `toml:"user_profile_padding_x"`
// UserDetailSeparator : ユーザ詳細のセパレータ
UserDetailSeparator string `toml:"user_detail_separator"`
// HideTweetSeparator : ツイート間のセパレータを非表示
HideTweetSeparator bool `toml:"hide_tweet_separator"`
// HideQuoteTweetSeparator : 引用ツイートのセパレータを非表示
HideQuoteTweetSeparator bool `toml:"hide_quote_tweet_separator"`
// TweetSeparator : ツイートのセパレータ
TweetSeparator string `toml:"tweet_separator"`
// QuoteTweetSeparator : 引用ツイートのセパレータ
QuoteTweetSeparator string `toml:"quote_tweet_separator"`
// GraphChar : 投票グラフの表示に使用する文字
GraphChar string `toml:"graph_char"`
// GraphMaxWidth : 投票グラフの最大表示幅
GraphMaxWidth int `toml:"graph_max_width"`
// TabSeparator : タブのセパレータ
TabSeparator string `toml:"tab_separator"`
// TabMaxWidth : タブの最大表示幅
TabMaxWidth int `toml:"tab_max_width"`
}
// Layout : 表示レイアウト
type Layout struct {
// Tweet : ツイート
Tweet string `toml:"tweet"`
// TweetAnotation : ツイートアノテーション
TweetAnotation string `toml:"tweet_anotation"`
// TweetDetail : ツイート詳細
TweetDetail string `toml:"tweet_detail"`
// TweetPoll : 投票
TweetPoll string `toml:"tweet_poll"`
// TweetPollGraph : 投票グラフ
TweetPollGraph string `toml:"tweet_poll_graph"`
// TweetPollDetail : 投票詳細
TweetPollDetail string `toml:"tweet_poll_detail"`
// User : ユーザプロフィール
User string `toml:"user"`
// UserInfo : ユーザ情報
UserInfo string `toml:"user_info"`
}
// Text : 表示テキスト
type Text struct {
// Like : いいねの単位
Like string `toml:"like"`
// Retweet : リツイートの単位
Retweet string `toml:"retweet"`
// Loading : 読み込み中
Loading string `toml:"loading"`
// NoTweets : ツイート無し
NoTweets string `toml:"no_tweets"`
// TweetTextAreaHint : ツイートエリアのヒント
TweetTextAreaHint string `toml:"tweet_textarea_hint"`
// TabHome : ホームタブ
TabHome string `toml:"tab_home"`
// TabMention : メンションタブ
TabMention string `toml:"tab_mention"`
// TabList : リストタブ
TabList string `toml:"tab_list"`
// TabUser : ユーザタブ
TabUser string `toml:"tab_user"`
// TabSearch : 検索タブ
TabSearch string `toml:"tab_search"`
// TabLikes : いいねリストタブ
TabLikes string `toml:"tab_likes"`
// TabDocs : ドキュメントタブ
TabDocs string `toml:"tab_docs"`
}
// Icon : アイコン
type Icon struct {
// Geo : 位置情報
Geo string `toml:"geo"`
// Link : リンク
Link string `toml:"link"`
// Pinned : ピン留め
Pinned string `toml:"pinned"`
// Verified : 認証バッジ
Verified string `toml:"verified"`
// Private : 非公開バッジ
Private string `toml:"private"`
}
// Keybindings : キーバインド
type Keybindings struct {
// Global : アプリ全体のキーバインド
Global keybinding `toml:"global"`
// View : メインビューのキーバインド
View keybinding `toml:"view"`
// Page : ページ共通のキーバインド
Page keybinding `toml:"page"`
// HomeTimeline : ホームタイムラインページのキーバインド
HomeTimeline keybinding `toml:"home_timeline"`
// TweetView : ツイートビューのキーバインド
TweetView keybinding `toml:"tweet"`
}
// Preferences : 環境設定
type Preferences struct {
Feature Feature `toml:"feature"`
Confirm map[string]bool `toml:"comfirm"`
Appearance Appearancene `toml:"appearance"`
Layout Layout `toml:"layout"`
Text Text `toml:"text"`
Icon Icon `toml:"icon"`
Keybindings Keybindings `toml:"keybinding"`
}
// defaultPreferences : デフォルト設定
func defaultPreferences() *Preferences {
return &Preferences{
Feature: Feature{
MainUser: "",
LoadTweetsLimit: 25,
AccmulateTweetsLimit: 250,
UseExternalEditor: false,
IsLocaleCJK: true,
StartupCmds: []string{
"home",
"mention --unfocus",
},
},
Confirm: map[string]bool{
"like": true,
"unlike": true,
"retweet": true,
"unretweet": true,
"delete": true,
"follow": true,
"unfollow": true,
"block": true,
"unblock": true,
"mute": true,
"unmute": true,
"tweet": true,
"quit": true,
},
Appearance: Appearancene{
StyleFilePath: "style_default.toml",
DateFormat: "2006/01/02",
TimeFormat: "15:04:05",
UserBIOMaxRow: 3,
UserProfilePaddingX: 4,
UserDetailSeparator: " | ",
HideTweetSeparator: false,
HideQuoteTweetSeparator: false,
TweetSeparator: "─",
QuoteTweetSeparator: "-",
GraphChar: "\u2588",
GraphMaxWidth: 30,
TabSeparator: "|",
TabMaxWidth: 20,
},
Layout: Layout{
Tweet: "{annotation}\n{user_info}\n{text}\n{poll}\n{detail}",
TweetAnotation: "{text} {author_name} {author_username}",
TweetDetail: "{created_at} | via {via}\n{metrics}",
TweetPoll: "{graph}\n{detail}",
TweetPollGraph: "{label}\n{graph} {per} {votes}",
TweetPollDetail: "{status} | {all_votes} votes | ends on {end_date}",
User: "{user_info}\n{bio}\n{user_detail}",
UserInfo: "{name} {username} {badge}",
},
Text: Text{
Like: "Like",
Retweet: "RT",
Loading: "Loading...",
NoTweets: "No tweets ฅ^-ω-^ฅ",
TweetTextAreaHint: "What's happening?",
TabHome: "Home",
TabMention: "Mention",
TabList: "List: {name}",
TabUser: "User: @{name}",
TabSearch: "Search: {query}",
TabLikes: "Likes: @{name}",
TabDocs: "Docs: {name}",
},
Icon: Icon{
Geo: "📍",
Link: "🔗",
Pinned: "📌",
Verified: "✅",
Private: "🔒",
},
Keybindings: Keybindings{
Global: keybinding{
ActionQuit: {"ctrl+q"},
},
View: keybinding{
ActionSelectPrevTab: {"h", "Left"},
ActionSelectNextTab: {"l", "Right"},
ActionClosePage: {"ctrl+w"},
ActionRedraw: {"ctrl+l"},
ActionFocusCmdLine: {":"},
ActionShowHelp: {"?"},
},
Page: keybinding{
ActionReloadPage: {"."},
},
HomeTimeline: keybinding{
ActionStreamModeStart: {"s"},
ActionStreamModeStop: {"S"},
},
TweetView: keybinding{
ActionScrollUp: {"ctrl+j", "PageUp"},
ActionScrollDown: {"ctrl+k", "PageDown"},
ActionCursorUp: {"k", "Up"},
ActionCursorDown: {"j", "Down"},
ActionCursorTop: {"g", "Home"},
ActionCursorBottom: {"G", "End"},
ActionTweetLike: {"f"},
ActionTweetUnlike: {"F"},
ActionTweetRetweet: {"t"},
ActionTweetUnretweet: {"T"},
ActionTweetDelete: {"D"},
ActionUserFollow: {"w"},
ActionUserUnfollow: {"W"},
ActionUserBlock: {"x"},
ActionUserUnblock: {"X"},
ActionUserMute: {"u"},
ActionUserUnmute: {"U"},
ActionOpenUserPage: {"i"},
ActionOpenUserLikes: {"I"},
ActionTweet: {"n"},
ActionQuote: {"q"},
ActionReply: {"r"},
ActionOpenBrowser: {"o"},
ActionCopyUrl: {"c"},
},
},
}
}