summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/examples/plugin_file_filter.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/examples/plugin_file_filter.py b/doc/examples/plugin_file_filter.py
index bad5a368..b9bea1f3 100644
--- a/doc/examples/plugin_file_filter.py
+++ b/doc/examples/plugin_file_filter.py
@@ -1,18 +1,20 @@
-# Compatible with ranger 1.6.*
+# Compatible since ranger 1.6.1, git commit c82a8a76989c
 #
-# This plugin hides the directories "boot", "sbin", "proc" and "sys" in the
-# root directory.
+# This plugin hides the directories "/boot", "/sbin", "/proc" and "/sys" unless
+# the "show_hidden" option is activated.
 
 # Save the original filter function
 import ranger.container.directory
 old_accept_file = ranger.container.directory.accept_file
 
+HIDE_FILES = ("/boot", "/sbin", "/proc", "/sys")
+
 # Define a new one
-def custom_accept_file(fname, directory, hidden_filter, name_filter):
-       if hidden_filter and directory.path == '/' and fname in ('boot', 'sbin', 'proc', 'sys'):
-               return False
-       else:
-               return old_accept_file(fname, directory, hidden_filter, name_filter)
+def custom_accept_file(file, filters):
+    if not file.fm.settings.show_hidden and file.path in HIDE_FILES:
+        return False
+    else:
+        return old_accept_file(file, filters)
 
 # Overwrite the old function
 import ranger.container.directory
updated makefile' href='/gbmor/getwtxt/commit/Makefile?h=v0.4.8&id=96fbc6ec48e0613b0d377fc06376a5a767db4b9c'>96fbc6e ^
be76daa ^
69217dd ^
96fbc6e ^
69217dd ^
96fbc6e ^



be76daa ^
69217dd ^
96fbc6e ^
69217dd ^
96fbc6e ^


69217dd ^
be76daa ^

69217dd ^
96fbc6e ^
69217dd ^
96fbc6e ^



69217dd ^
96fbc6e ^


ee0d421 ^
96fbc6e ^

69217dd ^






96fbc6e ^


69217dd ^
96fbc6e ^
be76daa ^

69217dd ^
96fbc6e ^
69217dd ^
96fbc6e ^











69217dd ^

96fbc6e ^



be76daa ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80