diff options
-rw-r--r-- | c_exec.go | 9 | ||||
-rw-r--r-- | c_hardflip.go | 4 | ||||
-rw-r--r-- | c_init.go | 2 | ||||
-rw-r--r-- | i_events.go | 4 | ||||
-rw-r--r-- | i_ui.go | 18 |
5 files changed, 24 insertions, 13 deletions
@@ -135,7 +135,7 @@ func c_format_rdp(host *HostNode) []string { return cmd_fmt } -func c_format_cmd(host *HostNode) { +func c_format_cmd(host *HostNode, term string) { var cmd_fmt []string switch host.Protocol { @@ -146,12 +146,15 @@ func c_format_cmd(host *HostNode) { default: c_die("type not found", nil) } + if len(term) > 0 { + cmd_fmt = append([]string{term, "-e"}, cmd_fmt...) + } c_exec_cmd(cmd_fmt) } -func c_exec(host *HostNode) { +func c_exec(host *HostNode, term string) { if host == nil { return } - c_format_cmd(host) + c_format_cmd(host, term) } diff --git a/c_hardflip.go b/c_hardflip.go index 94e6211..ac73658 100644 --- a/c_hardflip.go +++ b/c_hardflip.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/c_hardflip.go - * Wed Jan 10 16:36:35 2024 + * Thu Jan 18 12:31:08 2024 * Joe * * the main @@ -63,7 +63,7 @@ type HardData struct { func main() { data_dir := c_get_data_dir() - opts := HardOpts{true, true} + opts := HardOpts{true, true, false, "alacritty"} ldirs := c_load_data_dir(data_dir, opts) litems := c_load_litems(ldirs) data := HardData{ @@ -59,6 +59,8 @@ import ( type HardOpts struct { Icon bool Loop bool + Perc bool + Term string } // this function recurses into the specified root directory in order to load diff --git a/i_events.go b/i_events.go index 2fdeec2..9bc52ab 100644 --- a/i_events.go +++ b/i_events.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_events.go - * Mon Jan 15 17:59:15 2024 + * Thu Jan 18 12:33:22 2024 * Joe * * events in the code @@ -293,7 +293,7 @@ func i_events(data *HardData) { break } else if data.litems.curr.is_dir() == false { ui.s.Fini() - c_exec(data.litems.curr.Host) + c_exec(data.litems.curr.Host, data.opts.Term) if data.opts.Loop == false { os.Exit(0) } else { @@ -489,7 +489,7 @@ func i_info_panel_host(ui HardUI, host *HostNode) { } } -func i_info_panel(ui HardUI, litems *ItemsList) { +func i_info_panel(ui HardUI, percent bool, litems *ItemsList) { i_draw_box(ui.s, (ui.dim[W] / 3), 0, ui.dim[W] - 1, ui.dim[H] - 2, " Infos ", false) @@ -500,6 +500,10 @@ func i_info_panel(ui HardUI, litems *ItemsList) { if litems.head != nil { text := " " + strconv.Itoa(litems.curr.ID) + " of " + strconv.Itoa(int(litems.last.ID)) + " " + if percent == true { + text += "- " + + strconv.Itoa(litems.curr.ID * 100 / litems.last.ID) + "% " + } i_draw_text(ui.s, (ui.dim[W] - 1) - len(text) - 1, ui.dim[H] - 2, @@ -507,6 +511,7 @@ func i_info_panel(ui HardUI, litems *ItemsList) { ui.dim[H] - 2, ui.def_style, text) + i_draw_text(ui.s, 0, ui.dim[H] - 2, len(text), ui.dim[H] - 2, ui.def_style, text) } else { text := " 0 hosts " i_draw_text(ui.s, @@ -536,13 +541,14 @@ func i_scrollhint(ui HardUI, litems *ItemsList) { if max <= h { return } - if litems.draw.ID > 1 { - ui.s.SetContent(0, 0, + draw_id := litems.draw.ID + if draw_id > 1 { + ui.s.SetContent(0, 1, '▲', nil, ui.def_style) } - if max - litems.draw.ID > h { - ui.s.SetContent(0, ui.dim[H] - 2, + if max - draw_id > h { + ui.s.SetContent(0, ui.dim[H] - 3, '▼', nil, ui.def_style) return @@ -574,7 +580,7 @@ func i_ui(data *HardData) { ui.s.Clear() i_bottom_text(*ui) i_host_panel(data.ui, data.opts.Icon, data.litems, data) - i_info_panel(data.ui, data.litems) + i_info_panel(data.ui, data.opts.Perc, data.litems) i_scrollhint(data.ui, data.litems) if data.litems.head == nil { i_draw_zhosts_box(*ui) |