From 470c934fc77a978d4d1fa6171f8ca2c6556a6364 Mon Sep 17 00:00:00 2001 From: "John Ankarstr\\xf6m" Date: Tue, 1 Jun 2021 11:59:33 +0200 Subject: Implement SEL_RUNWITH --- config.h | 1 + noice.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/config.h b/config.h index ed0b3f9..ad9d068 100644 --- a/config.h +++ b/config.h @@ -98,4 +98,5 @@ struct key bindings[] = { /* Run command with argument */ { 'e', SEL_RUNARG, "vi", "EDITOR" }, { 'p', SEL_RUNARG, "less", "PAGER" }, + { 'o', SEL_RUNWITH }, }; diff --git a/noice.c b/noice.c index a097a55..4340ab7 100644 --- a/noice.c +++ b/noice.c @@ -72,6 +72,7 @@ enum action { SEL_REDRAW, SEL_RUN, SEL_RUNARG, + SEL_RUNWITH, }; struct key { @@ -865,6 +866,18 @@ nochange: spawn(run, dents[cur].name, path); initcurses(); goto begin; + case SEL_RUNWITH: + /* Save current */ + if (ndents > 0) + mkpath(path, dents[cur].name, oldpath, sizeof(oldpath)); + printprompt("open with: "); + tmp = readln(); + if (tmp == NULL) + goto begin; + exitcurses(); + spawn(tmp, dents[cur].name, path); + initcurses(); + goto begin; } /* Screensaver */ if (idletimeout != 0 && idle == idletimeout) { -- cgit v1.2.3