From f6bdb4813cbc97c0395caac8be8e24814c0db88c Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Mon, 25 Mar 2019 12:02:59 +0100 Subject: Calculate the free space on remote filesystems correctly The remote filesystems report their mount path as the mount root even if they contain other mount points on the remote side. Fixes #1505. --- ranger/gui/widgets/statusbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index f068bc7e..71064ed4 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -281,7 +281,7 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes right.add(human_readable(target.disk_usage, separator='') + " sum") if self.settings.display_free_space_in_status_bar: try: - free = get_free_space(target.mount_path) + free = get_free_space(target.path) except OSError: pass else: -- cgit 1.4.1-2-gfad0 From bf00980230e016283ce0c19702889ab727b7523f Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 31 Mar 2019 22:14:30 +0200 Subject: core.actions: avoid error message when pressing right in empty dir --- ranger/core/actions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 75697696..92d36afc 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -521,6 +521,8 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m selection = self.thistab.get_selection() else: selection = [tfile] + if tfile is None: + return if tfile.is_directory: self.thistab.enter_dir(tfile) elif selection: -- cgit 1.4.1-2-gfad0 From 0bffe922cee451cba6c457dbf641bbcd3a12b64a Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 1 Apr 2019 20:36:14 +0200 Subject: A E S T H E T I C --- ranger/colorschemes/aesthetic.py | 47 ++++++++++++++++++++++++++++++++++++++++ ranger/config/rc.conf | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 ranger/colorschemes/aesthetic.py diff --git a/ranger/colorschemes/aesthetic.py b/ranger/colorschemes/aesthetic.py new file mode 100644 index 00000000..22a056e9 --- /dev/null +++ b/ranger/colorschemes/aesthetic.py @@ -0,0 +1,47 @@ +# This file is part of ranger, the console file manager. +# License: GNU GPL version 3, see the file "AUTHORS" for details. + +from __future__ import (absolute_import, division, print_function) + +from ranger.colorschemes.default import Default +from ranger.gui.color import bold, BRIGHT, reverse + + +class Scheme(Default): + progress_bar_color = 166 + + def use(self, context): + fg, bg, attr = Default.use(self, context) + + if context.directory and not context.marked and not context.link \ + and not context.inactive_pane: + fg = 165 + + elif context.link: + fg = 122 if context.good or context.in_titlebar else 198 + + elif context.in_titlebar and context.hostname: + fg = 84 + + elif context.container: + fg = 162 + + elif context.media: + if context.image: + fg = 227 + else: + fg = 174 + + elif context.executable and not \ + any((context.media, context.container, + context.fifo, context.socket, context.link)): + attr |= bold + fg = 47 + + if context.main_column: + if context.marked and not context.selected: + attr |= bold + attr |= reverse + fg = 214 + + return fg, bg, attr diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 4a182f69..e2e215fa 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -136,7 +136,7 @@ set show_hidden_bookmarks true # Which colorscheme to use? These colorschemes are available by default: # default, jungle, snow, solarized -set colorscheme default +set colorscheme aesthetic # Preview files on the rightmost column? # And collapse (shrink) the last column if there is nothing to preview? -- cgit 1.4.1-2-gfad0 From 55801cb4121c47f2af5dab6e62838505a9882c0b Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 3 Apr 2019 16:37:43 +0200 Subject: Revert "A E S T H E T I C" This reverts commit 0bffe922cee451cba6c457dbf641bbcd3a12b64a. --- ranger/colorschemes/aesthetic.py | 47 ---------------------------------------- ranger/config/rc.conf | 2 +- 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 ranger/colorschemes/aesthetic.py diff --git a/ranger/colorschemes/aesthetic.py b/ranger/colorschemes/aesthetic.py deleted file mode 100644 index 22a056e9..00000000 --- a/ranger/colorschemes/aesthetic.py +++ /dev/null @@ -1,47 +0,0 @@ -# This file is part of ranger, the console file manager. -# License: GNU GPL version 3, see the file "AUTHORS" for details. - -from __future__ import (absolute_import, division, print_function) - -from ranger.colorschemes.default import Default -from ranger.gui.color import bold, BRIGHT, reverse - - -class Scheme(Default): - progress_bar_color = 166 - - def use(self, context): - fg, bg, attr = Default.use(self, context) - - if context.directory and not context.marked and not context.link \ - and not context.inactive_pane: - fg = 165 - - elif context.link: - fg = 122 if context.good or context.in_titlebar else 198 - - elif context.in_titlebar and context.hostname: - fg = 84 - - elif context.container: - fg = 162 - - elif context.media: - if context.image: - fg = 227 - else: - fg = 174 - - elif context.executable and not \ - any((context.media, context.container, - context.fifo, context.socket, context.link)): - attr |= bold - fg = 47 - - if context.main_column: - if context.marked and not context.selected: - attr |= bold - attr |= reverse - fg = 214 - - return fg, bg, attr diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index e2e215fa..4a182f69 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -136,7 +136,7 @@ set show_hidden_bookmarks true # Which colorscheme to use? These colorschemes are available by default: # default, jungle, snow, solarized -set colorscheme aesthetic +set colorscheme default # Preview files on the rightmost column? # And collapse (shrink) the last column if there is nothing to preview? -- cgit 1.4.1-2-gfad0 From 2ce165baa011d8e5243408f086b9e0059bdaae70 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 3 Apr 2019 17:57:22 +0200 Subject: core.main: fixed error when starting in inaccessible path --- ranger/core/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ranger/core/main.py b/ranger/core/main.py index 6fdd5366..23648677 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -105,7 +105,8 @@ def main( if not os.access(path_abs, os.F_OK): paths_inaccessible += [path] if paths_inaccessible: - print('Inaccessible paths: {0}'.format(paths), file=sys.stderr) + print('Inaccessible paths: {0}'.format(', '.join(paths_inaccessible)), + file=sys.stderr) return 1 profile = None -- cgit 1.4.1-2-gfad0 From 67e4ea4e143ed3516e5fe02607bbaf8aedf3534d Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 3 Apr 2019 17:59:18 +0200 Subject: core.main: reactivate file opening with ranger directly The normal way to open files with ranger would be to use the tool "rifle" like "rifle ". Ranger used to be able to open files directly, but that feature was removed in 924135e1934a01faef64e94d2425d23f9790b6cf. People have been trying to use ranger like that though, and why force rifle on them? --- ranger/core/main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ranger/core/main.py b/ranger/core/main.py index 23648677..6e51a023 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -96,18 +96,35 @@ def main( paths = get_paths(args) paths_inaccessible = [] + paths_are_files = [] + paths_abs = [] for path in paths: try: path_abs = os.path.abspath(path) except OSError: paths_inaccessible += [path] continue + if os.path.isfile(path_abs): + paths_are_files.append(path_abs) if not os.access(path_abs, os.F_OK): paths_inaccessible += [path] + else: + paths_abs.append(path) if paths_inaccessible: print('Inaccessible paths: {0}'.format(', '.join(paths_inaccessible)), file=sys.stderr) return 1 + if paths_are_files: + from ranger.ext.rifle import Rifle + fm = FM() + if not args.clean and os.path.isfile(fm.confpath('rifle.conf')): + rifleconf = fm.confpath('rifle.conf') + else: + rifleconf = fm.relpath('config/rifle.conf') + rifle = Rifle(rifleconf) + rifle.reload_config() + rifle.execute(paths_abs) + return 0 profile = None exit_msg = '' -- cgit 1.4.1-2-gfad0 From 2fe988d829f66bce3a703ee08e49fd5bcbd6005d Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 3 Apr 2019 19:28:05 +0200 Subject: manpage: better documentation of "f" flag --- doc/ranger.pod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/ranger.pod b/doc/ranger.pod index e3419d0f..a89670f3 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -339,7 +339,9 @@ F<$repo/ranger/config/rifle.conf>. Flags give you a way to modify the behavior of the spawned process. They are used in the commands C<:open_with> (key "r") and C<:shell> (key "!"). - f Fork the process. (Run in background) + f Fork the process, i.e. run in background. Please use this flag instead of + calling "disown" or "nohup", to avoid killing the background command when + pressing Ctrl+C in ranger. c Run the current file only, instead of the selection r Run application with root privilege (requires sudo) t Run application in a new terminal window -- cgit 1.4.1-2-gfad0 From 3a1f942e67d5cb23a7cd139cfcd1141e19ce5c3e Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 3 Apr 2019 19:28:38 +0200 Subject: rebuild man pages --- doc/ranger.1 | 30 ++++++++++++++---------------- doc/rifle.1 | 22 +++++++++------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 09bd94a4..32df615e 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -54,20 +54,16 @@ .\" Avoid warning from groff about undefined register 'F'. .de IX .. -.nr rF 0 -.if \n(.g .if rF .nr rF 1 -.if (\n(rF:(\n(.g==0)) \{\ -. if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.if !\nF .nr F 0 +.if \nF>0 \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. -. if !\nF==2 \{\ -. nr % 0 -. nr F 2 -. \} +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 . \} .\} -.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -133,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.2" "2019-03-10" "ranger manual" +.TH RANGER 1 "ranger-1.9.2" "2019-04-03" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -173,7 +169,7 @@ plugins, sample configuration files and some programs for integrating ranger with other software. They are usually installed to \&\fI/usr/share/doc/ranger/examples\fR. .PP -The man page of \fBrifle\fR\|(1) describes the functions of the file opener +The man page of \fIrifle\fR\|(1) describes the functions of the file opener .PP The section \fI\s-1LINKS\s0\fR of this man page contains further resources. .SH "POSITIONAL ARGUMENTS" @@ -433,8 +429,10 @@ The rules, along with further documentation, are contained in Flags give you a way to modify the behavior of the spawned process. They are used in the commands \f(CW\*(C`:open_with\*(C'\fR (key \*(L"r\*(R") and \f(CW\*(C`:shell\*(C'\fR (key \*(L"!\*(R"). .PP -.Vb 4 -\& f Fork the process. (Run in background) +.Vb 6 +\& f Fork the process, i.e. run in background. Please use this flag instead of +\& calling "disown" or "nohup", to avoid killing the background command when +\& pressing Ctrl+C in ranger. \& c Run the current file only, instead of the selection \& r Run application with root privilege (requires sudo) \& t Run application in a new terminal window @@ -1672,7 +1670,7 @@ copy, run: .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" -\&\fBrifle\fR\|(1) +\&\fIrifle\fR\|(1) .SH "BUGS" .IX Header "BUGS" Report bugs here: diff --git a/doc/rifle.1 b/doc/rifle.1 index 9ed1a145..a42734d2 100644 --- a/doc/rifle.1 +++ b/doc/rifle.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -54,20 +54,16 @@ .\" Avoid warning from groff about undefined register 'F'. .de IX .. -.nr rF 0 -.if \n(.g .if rF .nr rF 1 -.if (\n(rF:(\n(.g==0)) \{\ -. if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.if !\nF .nr F 0 +.if \nF>0 \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. -. if !\nF==2 \{\ -. nr % 0 -. nr F 2 -. \} +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 . \} .\} -.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -133,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RIFLE 1" -.TH RIFLE 1 "rifle-1.9.2" "2018-09-09" "rifle manual" +.TH RIFLE 1 "rifle-1.9.2" "2019-04-03" "rifle manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l -- cgit 1.4.1-2-gfad0 From cb733994217664a27a394fa501d5bf13381fe62e Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 14 Apr 2019 21:09:29 +0200 Subject: Revert "core.main: reactivate file opening with ranger directly" Hut misunderstood an issue people were having with ranger's "open focused on a file" feature and undeprecated the rifle-like functionality. The feature's still broken but I'm already redeprecating because people'll get upset if they start using ranger as rifle and it stops working again when I fix the feature in the near future. This reverts commit 67e4ea4e143ed3516e5fe02607bbaf8aedf3534d. --- ranger/core/main.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/ranger/core/main.py b/ranger/core/main.py index 6e51a023..23648677 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -96,35 +96,18 @@ def main( paths = get_paths(args) paths_inaccessible = [] - paths_are_files = [] - paths_abs = [] for path in paths: try: path_abs = os.path.abspath(path) except OSError: paths_inaccessible += [path] continue - if os.path.isfile(path_abs): - paths_are_files.append(path_abs) if not os.access(path_abs, os.F_OK): paths_inaccessible += [path] - else: - paths_abs.append(path) if paths_inaccessible: print('Inaccessible paths: {0}'.format(', '.join(paths_inaccessible)), file=sys.stderr) return 1 - if paths_are_files: - from ranger.ext.rifle import Rifle - fm = FM() - if not args.clean and os.path.isfile(fm.confpath('rifle.conf')): - rifleconf = fm.confpath('rifle.conf') - else: - rifleconf = fm.relpath('config/rifle.conf') - rifle = Rifle(rifleconf) - rifle.reload_config() - rifle.execute(paths_abs) - return 0 profile = None exit_msg = '' -- cgit 1.4.1-2-gfad0 From 03cb07a5707436dbb4a588ca1b9bb324ecfba808 Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Sun, 14 Apr 2019 21:08:06 +0200 Subject: core.actions: Simplify the usage of :tag_toggle Now it's possible to call :tag_toggle with tag as the positional argument (:tag_toggle X), not only by name (:tag_toggle tag=X). All our usage of tag_toggle() is done with named arguments so there shouldn't be any internal breakage. --- ranger/core/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 92d36afc..6e37aded 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -872,7 +872,7 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m # Tags are saved in ~/.config/ranger/tagged and simply mark if a # file is important to you in any context. - def tag_toggle(self, paths=None, value=None, movedown=None, tag=None): + def tag_toggle(self, tag=None, paths=None, value=None, movedown=None): """:tag_toggle Toggle a tag . -- cgit 1.4.1-2-gfad0 From 7fd9586ee707c02afa667140b9674e6b1411ae9c Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 14 Apr 2019 21:32:47 +0200 Subject: Expand on Vifon's tag_toggle argument swap --- ranger/core/actions.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 6e37aded..e7be0c65 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -876,6 +876,12 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m """:tag_toggle Toggle a tag . + + Keyword arguments: + tag= + paths= + value= + movedown= """ if not self.tags: return @@ -897,11 +903,19 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m self.ui.redraw_main_column() - def tag_remove(self, paths=None, movedown=None, tag=None): - self.tag_toggle(paths=paths, value=False, movedown=movedown, tag=tag) + def tag_remove(self, tag=None, paths=None, movedown=None): + """:tag_remove + + Remove a tag . See :tag_toggle for keyword arguments. + """ + self.tag_toggle(tag=tag, paths=paths, value=False, movedown=movedown) - def tag_add(self, paths=None, movedown=None, tag=None): - self.tag_toggle(paths=paths, value=True, movedown=movedown, tag=tag) + def tag_add(self, tag=None, paths=None, movedown=None): + """:tag_add + + Add a tag . See :tag_toggle for keyword arguments. + """ + self.tag_toggle(tag=tag, paths=paths, value=True, movedown=movedown) # -------------------------- # -- Bookmarks -- cgit 1.4.1-2-gfad0 From dc48aa85c5879248583feba53c3017db10df42fc Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 21 Apr 2019 19:34:25 +0200 Subject: Treat comics as documents Some comics are pdf files and therefore treated as documents, comic archives like cbz aren't. This brings the two in line. --- ranger/container/fsobject.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index c5715294..f57fb451 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -31,10 +31,10 @@ CONTAINER_EXTENSIONS = ('7z', 'ace', 'ar', 'arc', 'bz', 'bz2', 'cab', 'cpio', 'cpt', 'deb', 'dgc', 'dmg', 'gz', 'iso', 'jar', 'msi', 'pkg', 'rar', 'shar', 'tar', 'tbz', 'tgz', 'txz', 'xar', 'xpi', 'xz', 'zip') -DOCUMENT_EXTENSIONS = ('cfg', 'css', 'cvs', 'djvu', 'doc', 'docx', 'gnm', - 'gnumeric', 'htm', 'html', 'md', 'odf', 'odg', 'odp', - 'ods', 'odt', 'pdf', 'pod', 'ps', 'rtf', 'sxc', 'txt', - 'xls', 'xlw', 'xml', 'xslx') +DOCUMENT_EXTENSIONS = ('cbr', 'cbz', 'cfg', 'css', 'cvs', 'djvu', 'doc', + 'docx', 'gnm', 'gnumeric', 'htm', 'html', 'md', 'odf', + 'odg', 'odp', 'ods', 'odt', 'pdf', 'pod', 'ps', 'rtf', + 'sxc', 'txt', 'xls', 'xlw', 'xml', 'xslx') DOCUMENT_BASENAMES = ('bugs', 'bugs', 'changelog', 'copying', 'credits', 'hacking', 'help', 'install', 'license', 'readme', 'todo') -- cgit 1.4.1-2-gfad0