From b242bcebcf220b42ee50e0f967c7237a5f543b25 Mon Sep 17 00:00:00 2001 From: bodea Date: Tue, 6 Sep 2022 16:42:02 +1000 Subject: [PATCH] i3-sensible-pager: sanitize LESS environment variable (#5111) When an error is encountered such as "The configured command for this shortcut could not be run successfully", the "show errors" button on i3-nagbar doesn't work if $PAGER is less, and $LESS contains either the -E or -F flag (the window pops up, but immediately disappears). Strip these flags from the LESS environment variable before invoking $pager. --- i3-sensible-pager | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/i3-sensible-pager b/i3-sensible-pager index 386e2988..2d824684 100755 --- a/i3-sensible-pager +++ b/i3-sensible-pager @@ -8,6 +8,11 @@ # Distributions/packagers can enhance this script with a # distribution-specific mechanism to find the preferred pager. +# The less -E and -F options exit immediately for short files, strip if present. +case "$LESS" in + *[EF]*) LESS=`echo "$LESS" | tr -d EF` +esac + # Hopefully one of these is installed (no flamewars about preference please!): # We don't use 'more' because it will exit if the file is too short. # Worst case scenario we'll open the file in your editor.