Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add directory's files to filelist alphanumerically #20

merged 1 commit into from Apr 27, 2011


Copy link

@talisein talisein commented Dec 30, 2010

This commit makes feh add files tot he filelist alphanumerically, rather than by whatever order the filesystem gives.

I am attempting to solve this problem: I want to view pictures in dir_b/ and dir_a/ in that order. Both directories have filenames like 01.jpg 02.jpg, but my filesystem always returns 02.jpg before 01.jpg with readdir().

Thanks for your time.

  than the filesystem's (possibly random) order.
Copy link

@derf derf commented Dec 30, 2010

Hi there,

Unless I'm mistaken, what you're doing in the patch is already possible with feh, using the "--sort filename" option. So the patch should not be necessary.

Thanks anyway!

Copy link
Contributor Author

@talisein talisein commented Dec 30, 2010

Unfortunately --sort filename sorts too much for my tastes :)

feh --sort filename dir_b/ dir_a/

will show me the images in dir_a before dir_b, but I want to view the images in dir_b before dir_a, in their alphanumeric order.

Copy link

@derf derf commented Dec 30, 2010

Hmm. Then I'd recommend feh dir_b/* dir_a/*

Since feh is intended as application for console users, I guess relying on the shell should be okay. I'm trying not to add too many new features (seeing as feh already does a huge load of stuff and the code's not getting cleaner), so I hope that's okay

Copy link
Contributor Author

@talisein talisein commented Dec 30, 2010

I don't mind relying on the shell. In fact my real command is

find -maxdepth 1 -type d -print0 | shuf -z | xargs -0 feh

But I've been struggling to get what I want from there. I hadn't tried leveraging shell expansion, but I still can't figure it out short of some gawk program. If you can, I'd be much obliged. :)

Copy link

@derf derf commented Dec 30, 2010

Hmm. Okay, if you really want to have a random list of directories, but then all files in them in order, it gets complicated. The only shell I could easily solve this with is zsh, but I don't know if you're using it.

@ghost ghost assigned derf Apr 12, 2011
derf pushed a commit that referenced this pull request Apr 27, 2011
Add directory's files to filelist alphanumerically
@derf derf merged commit 0522490 into derf:master Apr 27, 2011
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Oct 11, 2014

Upstream changes:

* Release v1.14.1
    * Fix compilation with curl=0
    * Make zoom_default key work properly with --geometry

Wed, 11 May 2011 11:37:32 +0200  Daniel Friesel <>

* Release v1.14
    * Only create caption directory when actually writing out a caption.
    * The --menu-bg option has been deprecated.  It will be removed along with
      --menu-style by the end of 2012.
    * read directory contents sorted by filename instead of 'randomly'
      (as returned by readdir) by default.  Thanks talisein!
    * Show certain warnings in the image window as well as on the commandline
    * Since the manual is way better structured and more detailed than the
      --help output, it now simply refers to the manual.  To include the old
      help text, build feh with 'help=1'
    * You can now use the next/prev/jump keys to navigate thumbnails. Use the
      render key to open the currently selected thumbnail.
    * Change a patch for NETWM fullscreen support to only apply to fullscreen
      windows.  This fixes the moving windows bug in fluxbox (since fluxbox
      doesn't report its window border width).
    * Minor manpage fixes.
    * Fix --auto-zoom / --zoom max/fill documentation, the "Auto-Zoom" menu
      option is now always checked when these options are used
    * Set _NET_WM_NAME and _NET_WM_ICON_NAME properties
    * The 'A' key (toggle_aliasing) now actually changes the current window,
      and not just the default for new windows
    * The zoom_default key now works fine with --scale-down
    * Fix access of uninitialized memory / malloc/realloc clash in continued
      theme definition handling.  Having a theme line with just one
      option/value pair used to produce undefined behaviour

Sat, 23 Apr 2011 22:00:27 +0200  Daniel Friesel <>

* Release v1.13
    * Fix segfault upon unloadable images when image-related format specifiers
      (e.g. %h) are used in --title
    * Show images in current directory when invoked without file arguments
    * Option to disable antialiasing, either global (--force-aliasing) or per
      image (press 'A' to toggle, keybinding toggle_aliasing)
    * Use SIGUSR1/SIGUSR2 to reload all images in multiwindow mode
    * Fix Imlib2 caching bug in reload (only worked after the second try)
    * The --bg options are now Xinerama-aware.  That is, they set the image in
      the respective mode (scale/fill/max/center) on each Xinerama screen. Use
      --no-xinerama to disable this.

Sat, 12 Mar 2011 22:49:53 +0100  Daniel Friesel <>

* Release v1.12
    * Add --zoom fill as equivalent for --auto-zoom
    * Add --zoom max (zooming like in --bg-max)
    * --menu-style is now deprecated
    * http images are now viewed using libcurl, not wget (thanks to talisein)
      This adds libcurl as dependency, and removes the wget recommendation
    * Slight build system change: make now has flags, e.g.
      "make xinerama=0 debug=1". By default feh is compiled with xinerama and
      libcurl support enabled, see README.
    * Remove builtin http client (--builtin)
    * Fix compilation issues with libpng 1.5.1

Wed, 09 Feb 2011 20:11:26 +0100  Daniel Friesel <>

* Release v1.11.2
    * Use wget --no-clobber to prevent TOCTTOU-based hole allowing a
      well-informed attacker to rewrite arbitrary user files with images.
      The attacker needs to know feh's PID and the URL the user gave it.
      It is still possible for an attacker to _create_ arbitrary files via the
      same hole.

Wed, 26 Jan 2011 21:07:19 +0100  Daniel Friesel <>

* Release v1.11.1
    * Show correct image dimensions in for cached thumbnails
    * Allow commandline options to override those set in a theme
    * Remove support for FEH_OPTIONS (was deprecated >5 years ago)
    * Restrict available modifiers to Control/Mod1/Mod4

Sat, 22 Jan 2011 11:48:33 +0100  Daniel Friesel <>

* Release v1.11
    * Patch by Pascal Bleser: Use getaddrinfo for builtin http client,
      this enables IPv6 support
    * Fix zooming when --scale-down is used
    * The themes are now read from ~/.config/feh/themes (BC for .fehrc exists)
    * Key bindings can now be configured via ~/.config/feh/keys
    * Removes --rcpath, use XDG_CONFIG_HOME instead
    * Increase movement steps for Ctrl+Left etc.
    * Make in/out zoom use equal zoom ratio

Fri, 03 Dec 2010 19:41:45 +0100  Daniel Friesel <>

* Release v1.10.1
    * Partially fix --scale-down behaviour (zooming is still broken)
    * Fix buffer overflow when using --draw-actions
    * Fix segfaults after trying to load several unloadable images
    * Fix fehrc created by feh (contined escape errors)

Thu, 07 Oct 2010 20:15:12 +0200  Daniel Friesel <>

* Release v1.10 (aka "2.0 will come real soon now")
    * Patch by Stefan Mark: Add --bg-max (scaled with borders)
    * Removed rather obscure --bg-seamless mode
    * Short option -Y for --hide-pointer
    * Panning via keys: Make it behave like scrolling (inverted directions)
    * Workaround for Xinerama fuckups: Set XINERAMA_SCREEN to the correct
      xinerama screen number
    * Add --info option to display custom image information
    * Do not change to the next slide when executing an action with ; as first
      character (this character is stripped when executing the action)
    * Speed up panning, zooming etc. by hiding image overlay text
    * Zoom button: Zoom to 100% on button release, not button click
    * --draw-filename: Always show position in filelist

Tue, 24 Aug 2010 19:23:36 +0200  Daniel Friesel <>

* Release v1.9
    * Add --fullscreen option, --full-screen is now deprecated
    * Removed --menu-border option, it is largely useless
    * Add short options: -P for --cache-thumbnails,
                         -K for --caption-papth,
                         -G for --draw-actions
                    and  -J for --thumb-redraw
    * Patch by Noel Cragg: Improve support for tiling window managers
    * Set correct window title when starting feh in paused mode
    * Add Up/Down keys for zooming
    * When zooming via keyboard: Always zoom around the center of the window
    * The image can now be panned with Ctrl + arrow keys

Fri, 25 Jun 2010 16:07:20 +0200  Daniel Friesel <>

* Release v1.8
    * support LDLIBS in Makefile/
    * Don't make the --thumbnails window fullscreen. The images launched from
      thumbnail mode may be fullscreen, though. You can still use 'v' to
      toggle fullscreen, should you really need it.
    * --font now sets the global default font (for action/filename display etc.)
    * Rename --screen-clip 0 to --no-screen-clip
    * Allow multiline theme definitions (via backslash, like in the shell)
    * Center the image after pressing <keypad /> or <keypad *>
    * Saving the filelist from thumbnail mode caused undefined behaviour due
      to handling of uninitialised memory. Since I consider this a rarely
      useful action, the feature has been disabled for thumbnail mode.
    * Remove -G/--wget-timestamp option. It was probably not working
      correctly, plus it contained a code execution hole when used with
      malicious URLs containing shell metacharacters (but only if those URLs
      led to a valid file)
    * Don't add ?randomnumber to URLs when downloading them, it confuses some
      servers and is not really neccessary in general

Thu Jun 10 12:12:04 CEST 2010  Daniel Friesel <>

* Release v1.7
    * Fix segfault in Thumbnail mode when trying to open a no longer
      existing image (e.g. when the file was renamed by a previous action)
    * Set a negative slideshow-delay to start the slideshow in paused mode
    * Remove Shift+Key bindings, they were doing the same as Nothing+Key
      anyways. Plus, I might want to bind Shift + <already used key> to other
      stuff in the future
    * Documentation improvements
    * Remove undocumented hjkl menu keys. Most of the menu options can also be
      accessed directly with keys, plus the number of non-qwerty users (which
      have no use for these shortcuts) is growing.
    * Draw a nice little message when in caption editing mode with empty
      caption (to indicate that caption editing is actually active)
    * caption mode: Automatically create caption directory if it doesn't exist
    * Slideshow mode: SIGUSR1 = next image, SIGUSR2 = previous image

Sat Jun  5 21:35:25 CEST 2010  Daniel Friesel <

* Release v1.6.1
    * Fix omitted image borders at high zoom levels
    * Re-add getopt_long files (possibly relevant for non-glibc systems)
    * Do not require a running X server for -L, -u, -U options

Tue Jun  1 10:21:19 CEST 2010  Daniel Friesel <>

* Release v1.6
    * Patch by aaptel: Support numpad keys for actions
    * Fix blur mode (Ctrl + left mouse key)
    * Center images in index/thumbnail mode relative to the text below them
    * Support caching of "large" (up to 256x256 pixels) thumbnails
    * New --thumb-redraw option as workaround to speed up thumbnail mode
      (thumbnail mode redrawing is quite slow, so now a redraw only happens
      every 10 thumbnails by default - can be changed with this option)
    * Because of that: Major speed improvements for --thumbnails, especially
      with cached thumbnails
    * Do not link against Xext and freetype, they're only used by other libs
    * Fix "make uninstall". You do NOT want to call this for feh versions
      1.4.2 to 1.5

Thu May  6 08:34:39 CEST 2010  Daniel Friesel <>

* Release v1.5
    * Rewrite parts of the menu code & fix a memory leak while there
    * Make --start-at work with filenames instead of list positions
    * Add keybinding to toggle pointer visibility (see --hide-pointer)
    * Sort manual a bit

Thu Apr 22 22:28:09 CEST 2010  Daniel Friesel <>

* Release v1.4.3
     * Warp the pointer when reaching a window border in pan mode
     * Various zoom mode improvements, should be more intuitive now
       + When entering zoom mode, always continue from previous zoom level
       + The image part you clicked on to start zoom mode will remain where it
         is. The zoom happen around at that pixel.
     * Manpage review

Fri Apr  2 16:20:55 CEST 2010  Daniel Friesel <>

* Release v1.4.2
     * Replace autoconf by
     * patch by decklin: Use z key to randomly jump in the filelist
     * patch by muennich: Correctly set [Paused] window title in slideshow mode
     * patch by dylan: Remove temporary files if url opening fails
     * Fix problems with unexpectedly empty filelists

Tue Mar 16 07:56:36 CET 2010  Daniel Friesel <>

  * Release v1.4.1
     * Fix chrome theme in the default .fehrc
     * Rename cam to feh-cam and to gen-cam-menu
     * Add manual for feh-cam and gen-cam-menu (from Debian)
     * Fix lossless rotate for filenames with spaces etc.

Thu Mar  4 14:55:02 CET 2010  Daniel Friesel <>

  * Release v1.4
     * Lots of documentation fixes/improvements
       (including previously undocumented options)
     * Fix --(un)loadable option
     * Add --draw-actions (show defined actions and their number)
     * Use <keypad begin> to antialias the image
     * Fix some keypad keys (+,-,/,*)
     * The button-related options have changed (NOT backwards-compatible)
     * Remove --xinerama option
     * Use jpegtran binary instead of libjpeg for lossless rotation
     * Add --bg-fill option (patch by Anonymous)

Mon Feb  8 21:47:56 CET 2010  Daniel Friesel <>

  * Release v1.3.5
     * Import various Debian patches
     * Update feh(1) manpage
     * Make feh -l / feh -O work without a running X
     * Don't die after encountering three or more unloadable images
       (former "No more slides in show" error)
     * Depracate --xinerama <0|1>, use --no-xinerama or nothing instead
     * Fix transparency in thumbnail mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.