Skip to content

Commit b77774c

Browse files
committed
finished tasks for r1
1 parent 5cb3210 commit b77774c

File tree

8 files changed

+70
-13
lines changed

8 files changed

+70
-13
lines changed

lastest_release/fm_r1_win.zip

256 KB
Binary file not shown.

source/config.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
exts_n_paths = [
1+
extention_app_pairs = [
22
'.txt', 'C:/windows/system32/notepad.exe',
33
'.v', 'C:/Users/PACHECON/Apps/vscodium/VSCodium.exe',
44
'.py', 'C:/Users/PACHECON/Apps/vscodium/VSCodium.exe',
55
'', 'C:/windows/system32/notepad.exe',
66
'.exe', '',
77
'else', 'start " "',
88
]
9+
910
favorite_folders = [
1011
'C:/Users/PACHECON/_cv',
1112
'C:/Users/PACHECON/Apps',
@@ -14,11 +15,12 @@ favorite_folders = [
1415
'C:/Users/PACHECON/_cv/file_manager'
1516
]
1617

18+
start_path = 'C:/Users/PACHECON/_cv'
1719
bg_color = [20, 10, 10]
1820
folder_highlight = [163, 81, 181]
1921
folder_font = [166, 202, 255]
2022
choice_highlight = [63, 81, 181]
2123
file_highlight = [63, 124, 181]
2224
fav_highlight = [145, 45, 45]
2325
search_highlight = [165, 25, 25]
24-
keybinds = [['g', 'start cmd /c lazygit'], ['i', '"C:/Users/PACHECON/Apps/vscodium/VSCodium.exe" .'], ['s', 'sort /+15 /r prof.txt /o prof.txt']]
26+
keybinds = [['g', 'lazygit'], ['i', '"C:/Users/PACHECON/Apps/vscodium/VSCodium.exe" .'], ['s', 'sort /+15 /r prof.txt /o prof.txt']]

source/error_logs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/file_manager
1+
/_cv

source/fm.exe

594 KB
Binary file not shown.

source/keybinds.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ c -> open the field to enter and execute a command
1414
ctrl c/x/v -> copy/cut/paste
1515
ctrl shift v -> overwrite
1616
space -> search bar
17-
? -> help
17+
? -> help
18+
1->9 -> jump to n files (alt to go backwards)

source/main.v

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ const (
1313
Can a tray app react to keyboard inputs ?
1414
TODO :
1515
R1:
16-
+ apparition dans un dossier choisi
17-
+ si ctrl + 1->9 jump au fichier dans x
18-
+ faire un release propre : -prod, tous les fichiers de config propres dans un zip
1916
2017
R2:
2118
. multiple file selection
@@ -39,7 +36,7 @@ R2:
3936
- progress bar search
4037
- progress bar paste folders
4138
- copy name of elem
42-
- config : colors
39+
- config : colors (colors of the selected 'window/panel')
4340
- zip
4441
- config : choose your own border chars
4542
- Launch programs (with extention name?) (avec truc comme l'autocomplétion sous la barre de recherche)
@@ -507,6 +504,26 @@ fn event(e &tui.Event, x voidptr) {
507504
spawn os.execute(app.key_binds[e.code.str()])
508505
app.refresh = true
509506
app.last_event = 'exec'
507+
}else {
508+
nb := match e.code.str() {
509+
"_1" {1}
510+
"_2" {2}
511+
"_3" {3}
512+
"_4" {4}
513+
"_5" {5}
514+
"_6" {6}
515+
"_7" {7}
516+
"_8" {8}
517+
"_9" {9}
518+
else {0}
519+
}
520+
if nb > 0 {
521+
if e.modifiers.has(.alt){
522+
app.jump_i(-nb)
523+
} else {
524+
app.jump_i(nb)
525+
}
526+
}
510527
}
511528
}
512529
}
@@ -564,7 +581,7 @@ fn (mut app App) render() {
564581
bottom_text := '${(if !app.search_results[app.search_i].is_dir() {space_nb(app.search_results[app.search_i].file_size().str()) + 'o'} else {'Directory'}):-15} | Modified the ${app.search_results[app.search_i].write_time().nice_time()} | Accessed the ${app.search_results[app.search_i].access_time().nice_time()} | Creatied the ${app.search_results[app.search_i].creation_time().nice_time()}'
565582
app.tui.draw_text(0, app.tui.window_height, if bottom_text.len > app.tui.window_width {bottom_text[0..app.tui.window_width]} else {bottom_text})
566583
}else{
567-
bottom_text := '${(if !app.dir_list[app.actual_i].is_dir() {space_nb(app.dir_list[app.actual_i].file_size().str()) + 'o'} else {'Directory'}):-15} | Modified the ${app.dir_list[app.actual_i].write_time().nice_time()} | Accessed the ${app.dir_list[app.actual_i].access_time().nice_time()} | Created the ${app.dir_list[app.actual_i].creation_time().nice_time()}'
584+
bottom_text := '${(if !app.dir_list[app.actual_i].is_dir() {space_nb(app.dir_list[app.actual_i].file_size().str()) + 'o'} else {'Directory'}):-15} | Modified the ${app.dir_list[app.actual_i].write_time().nice_time()} | Accessed the ${app.dir_list[app.actual_i].access_time().nice_time()} | Created the ${app.dir_list[app.actual_i].creation_time().nice_time()} ${app.actual_scroll}'
568585
app.tui.draw_text(0, app.tui.window_height, if bottom_text.len > app.tui.window_width {bottom_text[0..app.tui.window_width]} else {bottom_text})
569586
}
570587
}
@@ -716,18 +733,17 @@ fn (mut app App) initialisation() {
716733
app.tui.set_color(r: 255, g: 255, b: 255)
717734
app.update_dir_list()
718735
app.tui.set_bg_color(r: app.bg_color[0], g: app.bg_color[1], b: app.bg_color[2])
719-
//app.tui.draw_rect(0, 0, app.tui.window_width, app.tui.window_height)
720736
}
721737

722738
fn main() {
723739
mut app := &App{}
724740
config := toml.parse_file("config.toml") or {er("Config file error $err"); println("juujuj"); toml.Doc{}}
725-
if config.value('exts_n_paths') == toml.Any(toml.Null{}) {
741+
if config.value('extention_app_pairs') == toml.Any(toml.Null{}) {
726742
er("read config file error")
727743
}
728-
tmp_array := config.value('exts_n_paths').array().map(it.string())
744+
tmp_array := config.value('extention_app_pairs').array().map(it.string())
729745
if tmp_array.len%2 != 0 {
730-
eprintln("Error: elements in exts_n_paths (config.toml) should be in pairs")
746+
eprintln("Error: elements in extention_app_pairs (config.toml) should be in pairs")
731747
return
732748
}
733749
for i, elem in tmp_array{
@@ -753,6 +769,8 @@ fn main() {
753769
app.key_binds[pair[0]] = pair[1]
754770
}
755771

772+
app.actual_path = config.value('start_path').string()
773+
756774

757775
// os.ls()
758776
// os.abs_path()

source/source.exe

512 Bytes
Binary file not shown.

source/specifics.v

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@ module main
22

33
import os
44

5+
fn (mut app App) jump_i(nb int) {
6+
if nb>0{
7+
if app.dir_list != [] {
8+
app.actual_i = (app.actual_i + nb) % app.dir_list.len
9+
if app.dir_list.len > app.tui.window_height - 5 {
10+
if app.actual_i - app.actual_scroll > app.tui.window_height - 8 {
11+
app.actual_scroll = -app.tui.window_height + 8 + app.actual_i
12+
} else {
13+
app.actual_scroll = 0
14+
}
15+
}
16+
}
17+
}else if nb < 0{
18+
if app.dir_list != [] {
19+
if (app.actual_i + nb) < 0 {
20+
app.actual_i = app.dir_list.len + nb
21+
if app.dir_list.len > app.tui.window_height - 5 {
22+
app.actual_scroll = -app.tui.window_height + 8 + app.actual_i
23+
}
24+
} else {
25+
app.actual_i = app.actual_i + nb
26+
}
27+
if app.dir_list.len > app.tui.window_height - 5 {
28+
if app.actual_i - 3 < app.actual_scroll {
29+
if app.actual_scroll > -nb {
30+
app.actual_scroll += nb
31+
}else {
32+
app.actual_scroll = 0
33+
}
34+
}
35+
}
36+
}
37+
}
38+
app.last_event = 'jump'
39+
}
40+
541
fn (mut app App) go_in() {
642
if app.dir_list != [] {
743
if app.dir_list[app.actual_i].is_dir() {

0 commit comments

Comments
 (0)