From a5767f170319c0b7043c4e09c9e35331f15dcd29 Mon Sep 17 00:00:00 2001 From: toonn Date: Tue, 30 Jan 2018 15:05:43 +0100 Subject: Guard tmux title changes Changing the tmux window title to "ranger" was not guarded for the presence of the tmux executable, this tripped up at least one user with an `rc.conf` that still `set update_tmux_title true`. While the behavior is *not-a-bug*, I expect most people'd rather have the setting enabled by default since "python" is a less useful window title. Fix #1042 --- examples/rc_emacs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf index 26074a42..8924d1d6 100644 --- a/examples/rc_emacs.conf +++ b/examples/rc_emacs.conf @@ -129,7 +129,7 @@ set display_tags_in_all_columns true set update_title false # Set the title to "ranger" in the tmux program? -set update_tmux_title false +set update_tmux_title true # Shorten the title if it gets long? The number defines how many # directories are displayed at once, 0 turns off this feature. -- cgit 1.4.1-2-gfad0 From ed4eb4bf282354886e52ae6fa92bf68078edfef6 Mon Sep 17 00:00:00 2001 From: Stephane Fontaine Date: Sat, 24 Feb 2018 21:10:35 +0400 Subject: 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. --- doc/ranger.1 | 3 +++ doc/ranger.pod | 4 ++++ examples/rc_emacs.conf | 3 +++ ranger/config/rc.conf | 3 +++ ranger/container/settings.py | 1 + ranger/gui/widgets/statusbar.py | 15 ++++++++------- 6 files changed, 22 insertions(+), 7 deletions(-) (limited to 'examples') 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: -- cgit 1.4.1-2-gfad0 From 00366b27e12023d31dc445660df05000cc47a114 Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Sun, 1 Apr 2018 23:32:00 +0200 Subject: examples: Add plugin_avfs.py, a simple AVFS integration http://avf.sourceforge.net/ --- examples/plugin_avfs.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/plugin_avfs.py (limited to 'examples') diff --git a/examples/plugin_avfs.py b/examples/plugin_avfs.py new file mode 100644 index 00000000..6910533c --- /dev/null +++ b/examples/plugin_avfs.py @@ -0,0 +1,31 @@ +# Tested with ranger 1.9.1 +# +# A very simple and possibly buggy support for AVFS +# (http://avf.sourceforge.net/), that allows ranger to handle +# archives. +# +# Run `:avfs' to browse the selected archive. + +from __future__ import (absolute_import, division, print_function) + +from ranger.api.commands import Command +import os +import os.path + +class avfs(Command): + avfs_root = os.path.join(os.environ["HOME"], ".avfs") + avfs_suffix = "#" + + def execute(self): + if os.path.isdir(self.avfs_root): + archive_directory = "".join([ + self.avfs_root, + self.fm.thisfile.path, + self.avfs_suffix, + ]) + if os.path.isdir(archive_directory): + self.fm.cd(archive_directory) + else: + self.fm.notify("This file cannot be handled by avfs.", bad=True) + else: + self.fm.notify("Install `avfs' and run `mountavfs' first.", bad=True) -- cgit 1.4.1-2-gfad0 From 8a9ede42a95b703daa35364aca32b672cfb680f7 Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Sun, 1 Apr 2018 23:56:01 +0200 Subject: Fix pylint --- examples/plugin_avfs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/plugin_avfs.py b/examples/plugin_avfs.py index 6910533c..07968a03 100644 --- a/examples/plugin_avfs.py +++ b/examples/plugin_avfs.py @@ -8,11 +8,13 @@ from __future__ import (absolute_import, division, print_function) -from ranger.api.commands import Command import os import os.path -class avfs(Command): +from ranger.api.commands import Command + + +class avfs(Command): # pylint: disable=invalid-name avfs_root = os.path.join(os.environ["HOME"], ".avfs") avfs_suffix = "#" -- cgit 1.4.1-2-gfad0