From 36b09fa038a8b7996a12e45419c28821c5596308 Mon Sep 17 00:00:00 2001 From: guns Date: Sat, 28 May 2016 00:45:33 -0500 Subject: Add prev_dir and next_dir navigation actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many image collections are organized by directory, so it is nice to have jump-to-adjacent-directory navigation. e.g. Given the following file hierarchy: . ├── A │   ├── 1.jpg │   ├── 2.jpg │   └── C │   ├── 1.jpg │   ├── 2.jpg │   └── 3.jpg └── B ├── 1.jpg ├── 2.jpg └── 3.jpg `feh --recursive` creates the following filelist: A/1.jpg <---- current_file A/2.jpg A/C/1.jpg A/C/2.jpg A/C/3.jpg B/1.jpg B/2.jpg B/3.jpg If we press [next_dir], we move the current_file pointer to: A/1.jpg A/2.jpg A/C/1.jpg <-- current_file A/C/2.jpg A/C/3.jpg B/1.jpg B/2.jpg B/3.jpg Pressing [next_dir] again moves the pointer to: A/1.jpg A/2.jpg A/C/1.jpg A/C/2.jpg A/C/3.jpg B/1.jpg <---- current_file B/2.jpg B/3.jpg [next_dir] now moves the pointer back to the top of the list: A/1.jpg <---- current_file A/2.jpg A/C/1.jpg A/C/2.jpg A/C/3.jpg B/1.jpg B/2.jpg B/3.jpg Pressing [prev_dir] from here moves backwards to the first image of the previous directory: A/1.jpg A/2.jpg A/C/1.jpg A/C/2.jpg A/C/3.jpg B/1.jpg <---- current_file B/2.jpg B/3.jpg When starting from an position that is not the first image of a directory, [prev_dir] moves the pointer to the first image of the current directory. These actions combine well with `--sort dirname` since all regular files in a directory will be sorted before any subdirectories, avoiding a filelist like the following: A/1.jpg A/SUBDIR/2.jpg A/SUBDIR/3.jpg A/4.jpg With `--sort dirname` that filelist becomes: A/1.jpg A/4.jpg A/SUBDIR/2.jpg A/SUBDIR/3.jpg --- src/feh.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/feh.h') diff --git a/src/feh.h b/src/feh.h index a2a586a..73ef1f6 100644 --- a/src/feh.h +++ b/src/feh.h @@ -102,7 +102,9 @@ enum text_bg { TEXT_BG_CLEAR = 0, TEXT_BG_TINTED }; enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_RAND, SLIDE_FIRST, SLIDE_LAST, SLIDE_JUMP_FWD, - SLIDE_JUMP_BACK + SLIDE_JUMP_BACK, + SLIDE_JUMP_NEXT_DIR, + SLIDE_JUMP_PREV_DIR }; enum image_bg { IMAGE_BG_CHECKS = 1, IMAGE_BG_BLACK, IMAGE_BG_WHITE }; -- cgit v1.2.3