about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStephane Fontaine <stefont@gmail.com>2018-02-24 21:10:35 +0400
committerStephane Fontaine <stefont@gmail.com>2018-02-24 21:10:35 +0400
commited4eb4bf282354886e52ae6fa92bf68078edfef6 (patch)
treeb5ded6d408475add270e35521ef7e3f649b17b20
parentc2b9dd31de649f19805f07f58814d3054d3c9c54 (diff)
downloadranger-ed4eb4bf282354886e52ae6fa92bf68078edfef6.tar.gz
Add new option to disable display of free disk space in statusbar
Fixes #1087
Useful on high-latency filesystems as it avoid calls to statvfs system
call which costs: (number of redraw) * latency.
-rw-r--r--doc/ranger.13
-rw-r--r--doc/ranger.pod4
-rw-r--r--examples/rc_emacs.conf3
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/gui/widgets/statusbar.py15
6 files changed, 22 insertions, 7 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index fca30604..9ec79cfd 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -766,6 +766,9 @@ Display the file size in the main column?
 Display the file size in the status bar?
 .IP "display_tags_in_all_columns [bool]" 4
 .IX Item "display_tags_in_all_columns [bool]"
+Display the free disk space in the status bar?
+.IP "display_free_space_in_status_bar [bool]" 4
+.IX Item "display_free_space_in_status_bar [bool]"
 Display tags in all columns?
 .IP "draw_borders [bool]" 4
 .IX Item "draw_borders [bool]"
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 523d8d9d..04598bd2 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -752,6 +752,10 @@ Display the file size in the main column?
 
 Display the file size in the status bar?
 
+=item display_free_space_in_status_bar [bool]
+
+Display the free disk space in the status bar?
+
 =item display_tags_in_all_columns [bool]
 
 Display tags in all columns?
diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf
index 26074a42..4743f8a3 100644
--- a/examples/rc_emacs.conf
+++ b/examples/rc_emacs.conf
@@ -122,6 +122,9 @@ set mouse_enabled true
 set display_size_in_main_column true
 set display_size_in_status_bar true
 
+# Display the free disk space in the status bar?
+set display_free_space_in_status_bar true
+
 # Display files tags in all columns or only in main column?
 set display_tags_in_all_columns true
 
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 676090fb..51d18ff2 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -137,6 +137,9 @@ set mouse_enabled true
 set display_size_in_main_column true
 set display_size_in_status_bar true
 
+# Display the free disk space in the status bar?
+set display_free_space_in_status_bar true
+
 # Display files tags in all columns or only in main column?
 set display_tags_in_all_columns true
 
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index d0b094d0..e87b6e48 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -38,6 +38,7 @@ ALLOWED_SETTINGS = {
     'dirname_in_tabs': bool,
     'display_size_in_main_column': bool,
     'display_size_in_status_bar': bool,
+    "display_free_space_in_status_bar": bool,
     'display_tags_in_all_columns': bool,
     'draw_borders': bool,
     'draw_progress_bar_in_status_bar': bool,
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 266d48ca..3457955e 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -275,13 +275,14 @@ class StatusBar(Widget):  # pylint: disable=too-many-instance-attributes
             right.add("/" + str(len(target.marked_items)))
         else:
             right.add(human_readable(target.disk_usage, separator='') + " sum")
-            try:
-                free = get_free_space(target.mount_path)
-            except OSError:
-                pass
-            else:
-                right.add(", ", "space")
-                right.add(human_readable(free, separator='') + " free")
+            if self.settings.display_free_space_in_status_bar:
+                try:
+                    free = get_free_space(target.mount_path)
+                except OSError:
+                    pass
+                else:
+                    right.add(", ", "space")
+                    right.add(human_readable(free, separator='') + " free")
         right.add("  ", "space")
 
         if target.marked_items: