1 /* See LICENSE file for copyright and license details.*/
7 static const Cpair cdir
= { 33, 0 };
8 static const Cpair cerr
= { 124, 0 };
9 static const Cpair cexec
= { 2, 0 };
10 static const Cpair cfile
= { 243, 0 };
11 static const Cpair cframe
= { 233, 233 };
12 static const Cpair cother
= { 3, 0 };
13 static const Cpair cpanell
= { 166, 233 };
14 static const Cpair cpanelr
= { 5, 233 };
15 static const Cpair cprompt
= { 33, 0 };
16 static const Cpair csearch
= { 255, 0 };
17 static const Cpair cstatus
= { 243, 0 };
20 static const char *rm_cmd
[] = { "rm", "-rf" }; /* delete */
21 static const char *cp_cmd
[] = { "cp", "-r" }; /* copy */
22 static const char *mv_cmd
[] = { "mv" }; /* move */
23 static const char delconf
[] = "yes";
25 static const size_t rm_cmd_len
= LEN(rm_cmd
);
26 static const size_t cp_cmd_len
= LEN(cp_cmd
);
27 static const size_t mv_cmd_len
= LEN(mv_cmd
);
28 static const size_t delconf_len
= LEN(delconf
);
31 static const char root
[] = "/";
34 static const char *mpv
[] = { "mpv", "--fullscreen" };
35 static const char *sxiv
[] = { "sxiv" };
36 static const char *surf
[] = { "surf" };
37 static const char *mupdf
[] = { "mupdf", "-I" };
38 static const char *libreoffice
[] = { "libreoffice" };
39 static const char *gimp
[] = { "gimp" };
40 static const char *r2
[] = { "r2", "-c", "vv" };
43 static const char *images
[] = { "bmp", "jpg", "jpeg", "png", "gif", "xpm" };
44 static const char *web
[] = { "htm", "html" };
45 static const char *pdf
[] = { "epub", "pdf" };
46 static const char *arts
[] = { "xcf" };
47 static const char *obj
[] = { "o", "a", "so" };
48 static const char *videos
[] = { "avi", "flv", "wav", "webm", "wma", "wmv",
49 "m2v", "m4a", "m4v", "mkv", "mov", "mp3",
50 "mp4", "mpeg", "mpg" };
51 static const char *documents
[] = { "odt", "doc", "docx", "xls", "xlsx", "odp",
52 "ods", "pptx", "odg" };
54 static Rule rules
[] = {
55 {videos
, LEN(videos
), mpv
, LEN(mpv
) },
56 {images
, LEN(images
), sxiv
, LEN(sxiv
) },
57 {web
, LEN(web
), surf
, LEN(surf
) },
58 {pdf
, LEN(pdf
), mupdf
, LEN(mupdf
) },
59 {documents
, LEN(documents
), libreoffice
, LEN(libreoffice
) },
60 {arts
, LEN(arts
), gimp
, LEN(gimp
) },
61 {obj
, LEN(obj
), r2
, LEN(r2
) },
65 static Key nkeys
[] = {
66 /* keyval function arg */
67 { {.ch
= 'j'}, mv_ver
, {.i
= -1} },
68 { {.key
= TB_KEY_ARROW_DOWN
}, mv_ver
, {.i
= -1} },
69 { {.ch
= 'k'}, mv_ver
, {.i
= +1} },
70 { {.key
= TB_KEY_ARROW_UP
}, mv_ver
, {.i
= +1} },
71 { {.key
= TB_KEY_CTRL_U
}, mv_ver
, {.i
= +3} },
72 { {.key
= TB_KEY_CTRL_D
}, mv_ver
, {.i
= -3} },
73 { {.ch
= 'l'}, mvfwd
, {.i
= 0} },
74 { {.key
= TB_KEY_ARROW_RIGHT
}, mvfwd
, {.i
= 0} },
75 { {.ch
= 'h'}, mvbk
, {.i
= 0} },
76 { {.key
= TB_KEY_ARROW_LEFT
}, mvbk
, {.i
= 0} },
77 { {.ch
= 'g'}, mvtop
, {.i
= 0} },
78 { {.ch
= 'G'}, mvbtm
, {.i
= 0} },
79 { {.ch
= 'M'}, mvmid
, {.i
= 0} },
80 { {.ch
= 'n'}, crnf
, {0} },
81 { {.ch
= 'N'}, crnd
, {0} },
82 { {.ch
= 'd'}, delent
, {0} },
83 { {.ch
= 'x'}, calcdir
, {0} },
84 { {.ch
= '/'}, start_filter
, {0} },
85 { {.ch
= 'q'}, quit
, {0} },
86 { {.ch
= 'v'}, start_vmode
, {0} },
87 { {.ch
= 'y'}, yank
, {0} },
88 { {.ch
= 'p'}, paste
, {0} },
89 { {.ch
= 'P'}, selmv
, {0} },
90 { {.ch
= 'c'}, rname
, {0} },
91 { {.key
= TB_KEY_SPACE
}, switch_pane
, {0} },
92 { {.ch
= '\\'}, bkmrk
, {.v
= root
} },
93 { {.ch
= '.'}, toggle_df
, {0} },
97 static Key vkeys
[] = {
98 /* keyval function arg */
99 { {.ch
= 'j'}, seldwn
, {.i
= -1} },
100 { {.key
= TB_KEY_ARROW_DOWN
}, seldwn
, {.i
= -1} },
101 { {.ch
= 'k'}, selup
, {.i
= +1} },
102 { {.key
= TB_KEY_ARROW_UP
}, selup
, {.i
= +1} },
103 { {.ch
= 'a'}, selall
, {0} },
104 { {.ch
= 'y'}, selynk
, {0} },
105 { {.ch
= 'd'}, seldel
, {.v
= delconf
} },
106 { {.ch
= 'q'}, exit_vmode
, {0} },
107 { {.ch
= 'v'}, exit_vmode
, {0} },
108 { {.key
= TB_KEY_ESC
}, exit_vmode
, {0} },
111 static const size_t nkeyslen
= LEN(nkeys
);
112 static const size_t vkeyslen
= LEN(vkeys
);
115 static const mode_t ndir_perm
= S_IRWXU
;
116 static const mode_t nf_perm
= S_IRUSR
| S_IWUSR
;
119 static int show_dotfiles
= 1;
122 static const char dtfmt
[] = "%F %R"; /* date time format */
125 #define u_hl 0x2500 /* ─ */
126 #define u_vl 0x2502 /* │ */
127 #define u_cnw 0x250C /* ┌ */
128 #define u_cne 0x2510 /* ┐ */
129 #define u_csw 0x2514 /* └ */
130 #define u_cse 0x2518 /* ┘ */
131 #define u_mn 0x252C /* ┬ */
132 #define u_ms 0x2534 /* ┴ */
134 #endif /* CONFIG_H */