summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-03-05 11:27:16 +0100
committerhut <hut@lavabit.com>2012-03-05 11:38:42 +0100
commit23b7f16961a7b679dec16f6ee91401a6b8f6ca82 (patch)
tree22dae0662d03ce8562159d9196fd8c854d6af009 /ranger
parent6b1666df4664482644efb270f4e0215b469c8ffc (diff)
downloadranger-23b7f16961a7b679dec16f6ee91401a6b8f6ca82.tar.gz
Added $RANGER_LEVEL environment variable (see man page)
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/main.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 4bb4c48a..b4629801 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -38,6 +38,13 @@ def main():
 	except:
 		print("Warning: Unable to set locale.  Expect encoding problems.")
 
+	# so that programs can know that ranger spawned them:
+	level = 'RANGER_LEVEL'
+	if level in os.environ and os.environ[level].isdigit():
+		os.environ[level] = str(int(os.environ[level]) + 1)
+	else:
+		os.environ[level] = '1'
+
 	if not 'SHELL' in os.environ:
 		os.environ['SHELL'] = 'bash'