diff options
author | Samuel Walladge <samuel@swalladge.net> | 2019-07-23 17:17:37 +0930 |
---|---|---|
committer | Samuel Walladge <samuel@swalladge.net> | 2019-07-23 17:17:37 +0930 |
commit | 6866dfa3a08591aee3ebbc417fd459754b12a0fb (patch) | |
tree | fdaaafd42864d3ae4804eef98d0d15a1cfa794ee /ranger | |
parent | 669100aad83e3a51f140b6085d836a8260eda8d0 (diff) | |
download | ranger-6866dfa3a08591aee3ebbc417fd459754b12a0fb.tar.gz |
support wayland condition for rifle
- also support wayland for flag t (opening in new terminal)
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/rifle.conf | 4 | ||||
-rw-r--r-- | ranger/core/runner.py | 2 | ||||
-rwxr-xr-x | ranger/ext/rifle.py | 9 |
3 files changed, 11 insertions, 4 deletions
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index a90646e2..baff30f8 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -27,6 +27,8 @@ # 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 # # There are also pseudo-conditions which have a "side effect": # flag <flags> | Change how the program is run. See below. @@ -70,7 +72,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, X, flag f = firefox -- "$@" +ext x?html?, has firefox, XW, 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 f38b026a..08d7f85d 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: + if 'DISPLAY' not in os.environ and 'WAYLAND_DISPLAY' not 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 a55e14c7..a5cf4aed 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -236,8 +236,13 @@ class Rifle(object): # pylint: disable=too-many-instance-attributes elif function == 'flag': self._app_flags = argument return True - elif function == 'X': - return sys.platform == 'darwin' or 'DISPLAY' in os.environ + 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 == 'env': return bool(os.environ.get(argument)) elif function == 'else': |