diff options
author | lali <luteran42@outlook.com> | 2023-11-10 22:59:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 16:59:48 -0500 |
commit | 9a75f05a825e68e5295abf46e76d1810ee6e4deb (patch) | |
tree | c8efe37d4ad542f71cbbbee6a46346407ee01e08 /src | |
parent | 960decfcb89de5601f483d559096afe3481ae10c (diff) |
[feat] add option to use file_path() with the %p keyword (#431)
Use a absolute path where it is needed. like:
{ keys = ["m", "w"], commands = ["shell swaymsg output * bg %p fit"] },
Signed-off-by: luteran42 <luteranlajos@protonmail.ch>
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/sub_process.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/commands/sub_process.rs b/src/commands/sub_process.rs index 9f97af1..437112e 100644 --- a/src/commands/sub_process.rs +++ b/src/commands/sub_process.rs @@ -39,6 +39,23 @@ fn execute_sub_process( command.arg(x); }); } + "%p" => { + if let Some(curr_list) = context.tab_context_ref().curr_tab_ref().curr_list_ref() { + let mut i = 0; + curr_list + .iter_selected() + .map(|e| e.file_path()) + .for_each(|file_path| { + command.arg(file_path); + i += 1; + }); + if i == 0 { + if let Some(entry) = curr_list.curr_entry_ref() { + command.arg(entry.file_path()); + } + } + } + } s => { command.arg(s); } |