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
|
/// Configuration folder path
pub const CONFIG_FOLDER: &str = "~/.config/fm";
/// Configuration file path
pub const CONFIG_PATH: &str = "~/.config/fm/config.yaml";
/// Filepath of the opener config file
pub const OPENER_PATH: &str = "~/.config/fm/opener.yaml";
/// Filepath of the TUIS configuration file
pub const TUIS_PATH: &str = "~/.config/fm/tuis.yaml";
/// Filepath of the LOG configuration file
pub const LOG_CONFIG_PATH: &str = "~/.config/fm/logging_config.yaml";
/// Path to the action log file
pub const ACTION_LOG_PATH: &str = "~/.config/fm/log/action_logger.log";
/// Path to the trash folder files
pub const TRASH_FOLDER_FILES: &str = "~/.local/share/Trash/files";
/// Path to the trash folder info file
pub const TRASH_FOLDER_INFO: &str = "~/.local/share/Trash/info";
/// Trash info files extension. Watchout it includes the final '.'
pub const TRASH_INFO_EXTENSION: &str = ".trashinfo";
/// File where marks are stored.
pub const MARKS_FILEPATH: &str = "~/.config/fm/marks.cfg";
/// Temporary folder used when bulkrenaming files
pub const TMP_FOLDER_PATH: &str = "/tmp";
/// nohup
pub const NOHUP: &str = "nohup";
/// Default terminal application used when openening a program in shell or starting a new shell
pub const DEFAULT_TERMINAL_APPLICATION: &str = "st";
/// Opener used to play audio files. Does it require a terminal ?
pub const OPENER_AUDIO: (&str, bool) = ("mocp", true);
/// Program used to to display images. Does it require a terminal ?
pub const OPENER_IMAGE: (&str, bool) = ("viewnior", false);
/// Program used to open "office" documents (word, libreoffice etc). Does it require a terminal ?
pub const OPENER_OFFICE: (&str, bool) = ("libreoffice", false);
/// Program used to open readable documents (pdf, ebooks). Does it require a terminal ?
pub const OPENER_READABLE: (&str, bool) = ("zathura", false);
/// Program used to open text files. Does it require a terminal ?
pub const OPENER_TEXT: (&str, bool) = ("nvim", true);
/// Program used to open unknown files. Does it require a terminal ?
pub const OPENER_DEFAULT: (&str, bool) = ("xdg-open", false);
/// Program used to open vectorial images. Does it require a terminal ?
pub const OPENER_VECT: (&str, bool) = ("inkscape", false);
/// Program used to open videos. Does it require a terminal ?
pub const OPENER_VIDEO: (&str, bool) = ("mpv", false);
/// Array of text representation of a file permissions.
/// The index of each string gives a correct representation.
pub const PERMISSIONS_STR: [&str; 8] = ["---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"];
/// Description of the application.
pub const HELP_FIRST_SENTENCE: &str = " fm: a dired / ranger like file manager. ";
/// Description of the content below, aka the help itself.
pub const HELP_SECOND_SENTENCE: &str = " Keybindings ";
/// Description of the content below, aka the action log file
pub const LOG_FIRST_SENTENCE: &str = " Logs: ";
/// Description of the content below, aka what is logged there.
pub const LOG_SECOND_SENTENCE: &str = " Last actions affecting the file tree";
/// Ueberzug image thumbnails
pub const THUMBNAIL_PATH: &str = "/tmp/fm_thumbnail.png";
/// Libreoffice pdf output
pub const CALC_PDF_PATH: &str = "/tmp/fm_calc.pdf";
/// Array of hardcoded shortcuts with standard *nix paths.
pub const HARDCODED_SHORTCUTS: [&str; 9] = [
"/",
"/dev",
"/etc",
"/mnt",
"/opt",
"/run/media",
"/tmp",
"/usr",
"/var",
];
pub const BAT_EXECUTABLE: &str = "bat {} --color=always";
pub const CAT_EXECUTABLE: &str = "cat {}";
pub const RG_EXECUTABLE: &str = "rg --line-number \"{}\"";
pub const GREP_EXECUTABLE: &str = "grep -rI --line-number \"{}\"";
pub const SSHFS_EXECUTABLE: &str = "sshfs";
pub const NOTIFY_EXECUTABLE: &str = "notity-send";
/// Encrypted devices bind description
pub const ENCRYPTED_DEVICE_BINDS: &str = "m: mount -- u: unmount -- g: go to mount point";
/// Sort presentation for the second window
pub const SORT_LINES: [&str; 7] = [
"k: by kind (default)",
"n: by name",
"m: by modification time",
"s: by size",
"e: by extension",
"",
"r: reverse current sort",
];
pub const REMOTE_LINES: [&str; 4] = [
"Mount a directory with sshfs",
"Type the arguments as below, separated by a space",
"",
"username hostname remote_path",
];
/// Chmod presentation for the second window
pub const CHMOD_LINES: [&str; 5] = [
"Type an octal mode like 754.",
"",
"4: read",
"2: write",
"1: execute",
];
/// Filter presentation for the second window
pub const FILTER_LINES: [&str; 6] = [
"Type the initial of the filter and an expression if needed",
"",
"n {name}: by name",
"e {extension}: by extension",
"d: only directories",
"a: reset",
];
/// Password input presentation for the second window
pub const PASSWORD_LINES_SUDO: [&str; 2] = [
"Type your sudo password.",
"It will be forgotten immediatly after use.",
];
pub const PASSWORD_LINES_DEVICE: [&str; 2] = [
"Type the device passkey.",
"It will be forgotten immediatly after use.",
];
/// Shell presentation for the second window
pub const SHELL_LINES: [&str; 11] = [
"Type a shell command",
"",
"`sudo` commands are supported.",
"Pipes, redirections ( | < > >> ) and shell specific syntax (*) aren't supported.",
"",
"Some expression can be expanded:",
"%d: current directory",
"%e: selected file extension",
"%f: flagged files",
"%n: selected filename",
"%s: selected filepath",
];
/// Nvim address setter presentation for second window
pub const NVIM_ADDRESS_LINES: [&str; 4] = [
"Type the Neovim RPC address.",
"",
"You can get it from Neovim with :",
"`:echo v:servername`",
];
/// Regex matcher presentation for second window
pub const REGEX_LINES: [&str; 3] = [
"Type a regular expression",
"",
"Flag every file in current directory matching the typed regex",
];
/// Newdir presentation for second window
pub const NEWDIR_LINES: [&str; 3] = [
"mkdir a new directory",
"",
"Nothing is done if the directory already exists",
];
/// New file presentation for second window
pub const NEWFILE_LINES: [&str; 3] = [
"touch a new file",
"",
"Nothing is done if the file already exists",
];
/// Rename presentation for second window
pub const RENAME_LINES: [&str; 3] = [
"rename the selected file",
"",
"Nothing is done if the file already exists",
];
pub const TRASH_CONFIRM_LINE: &str = "Enter: restore the selected file -- x: delete permanently";
/// Executable commands whose output is a text to be displayed in terminal
pub const CLI_INFO: [(&str, &str); 9] = [
("drag and drop", "dragon-drop %s"),
("set wallpaper", "nitrogen --set-zoom-fill --save %s"),
("man page ", "man %s"),
("space used ", "duf"),
("system info ", "inxi -S -I -D -i -J -M --color"),
("system info ", "neofetch"),
("list usb ", "lsusb"),
("media tags ", "mediainfo %s"),
("diff 2 files ", "diff %f"),
];
/// Mediainfo (used to preview media files) executable
pub const MEDIAINFO: &str = "mediainfo";
/// ueberzug (used to preview images, videos & fonts)
pub const UEBERZUG: &str = "ueberzug";
/// fontimage (used to preview fonts)
pub const FONTIMAGE: &str = "fontimage";
/// ffmpeg (used to preview video thumbnail)
pub const FFMPEG: &str = "ffmpeg";
/// rsvg-convert (used to preview svg files)
pub const RSVG_CONVERT: &str = "rsvg-convert";
/// jupyter. used to preview notebooks (.ipynb)
pub const JUPYTER: &str = "jupyter";
/// pandoc. used to preview .doc & .odb documents
pub const PANDOC: &str = "pandoc";
/// diff. used to preview diff between files
pub const DIFF: &str = "diff";
/// isoinfo. used to preview iso file content
pub const ISOINFO: &str = "isoinfo";
/// socket file explorer
pub const SS: &str = "ss";
/// lsblk is used to get mountpoints, info about encrypted drives
pub const LSBLK: &str = "lsblk";
/// cryptsetup is used to mount encrypted drives
pub const CRYPTSETUP: &str = "cryptsetup";
/// gio is used to mount removable devices
pub const GIO: &str = "gio";
/// used to get information about fifo files
pub const LSOF: &str = "lsof";
/// neovim executable
pub const NVIM: &str = "nvim";
/// tar executable
pub const TAR: &str = "tar";
/// libreoffice executable
pub const LIBREOFFICE: &str = "libreoffice";
/// lazygit
pub const LAZYGIT: &str = "lazygit";
/// duf
pub const NCDU: &str = "ncdu";
|