diff options
author | Samuel Walladge <samuel@swalladge.net> | 2019-07-24 09:21:05 +0930 |
---|---|---|
committer | Samuel Walladge <samuel@swalladge.net> | 2019-07-24 09:21:05 +0930 |
commit | 3098fd36cd717646e48768f6cdd48cd6f0167d80 (patch) | |
tree | 9c7cf0b5f043901dd4ee684ef90ac9961c8e3104 /ranger | |
parent | 6866dfa3a08591aee3ebbc417fd459754b12a0fb (diff) | |
download | ranger-3098fd36cd717646e48768f6cdd48cd6f0167d80.tar.gz |
expand X condition only
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/rifle.conf | 6 | ||||
-rw-r--r-- | ranger/core/runner.py | 2 | ||||
-rwxr-xr-x | ranger/ext/rifle.py | 9 |
3 files changed, 5 insertions, 12 deletions
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index baff30f8..f593b781 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -26,9 +26,7 @@ # directory | $1 is a directory # number <n> | change the number of this command to n # terminal | stdin, stderr and stdout are connected to a terminal -# X | $DISPLAY is not empty (i.e. Xorg runs) -# W | $WAYLAND_DISPLAY is not empty (i.e. Wayland runs) -# XW or WX | Wayland OR Xorg runs +# X | A graphical environment is available (darwin, Xorg, or Wayland) # # There are also pseudo-conditions which have a "side effect": # flag <flags> | Change how the program is run. See below. @@ -72,7 +70,7 @@ ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@" ext x?html?, has chromium, X, flag f = chromium -- "$@" ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@" ext x?html?, has opera, X, flag f = opera -- "$@" -ext x?html?, has firefox, XW, flag f = firefox -- "$@" +ext x?html?, has firefox, X, flag f = firefox -- "$@" ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@" ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@" ext x?html?, has epiphany, X, flag f = epiphany -- "$@" diff --git a/ranger/core/runner.py b/ranger/core/runner.py index 08d7f85d..efb307da 100644 --- a/ranger/core/runner.py +++ b/ranger/core/runner.py @@ -214,7 +214,7 @@ class Runner(object): # pylint: disable=too-few-public-methods toggle_ui = True context.wait = True if 't' in context.flags: - if 'DISPLAY' not in os.environ and 'WAYLAND_DISPLAY' not in os.environ: + if not ('WAYLAND_DISPLAY' in os.environ or sys.platform == 'darwin' or 'DISPLAY' in os.environ): return self._log("Can not run with 't' flag, no display found!") term = get_term() if isinstance(action, str): diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index a5cf4aed..cdf0d729 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -236,13 +236,8 @@ class Rifle(object): # pylint: disable=too-many-instance-attributes elif function == 'flag': self._app_flags = argument return True - elif function.isupper(): - if 'X' in function and 'W' in function: - return 'WAYLAND_DISPLAY' in os.environ or sys.platform == 'darwin' or 'DISPLAY' in os.environ - elif 'X' in function: - return sys.platform == 'darwin' or 'DISPLAY' in os.environ - elif 'W' in function: - return 'WAYLAND_DISPLAY' in os.environ + elif function == 'X': + return 'WAYLAND_DISPLAY' in os.environ or sys.platform == 'darwin' or 'DISPLAY' in os.environ elif function == 'env': return bool(os.environ.get(argument)) elif function == 'else': |