about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--HACKING4
-rw-r--r--README2
-rw-r--r--doc/colorschemes.txt4
-rw-r--r--doc/ranger.19
-rwxr-xr-xranger.py6
-rw-r--r--ranger/__init__.py5
-rw-r--r--ranger/__main__.py2
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/defaults/apps.py4
-rw-r--r--ranger/defaults/commands.py2
-rw-r--r--ranger/defaults/keys.py2
-rw-r--r--ranger/defaults/options.py2
-rw-r--r--ranger/gui/colorscheme.py6
13 files changed, 29 insertions, 21 deletions
diff --git a/HACKING b/HACKING
index 9c114e89..0424b047 100644
--- a/HACKING
+++ b/HACKING
@@ -56,13 +56,13 @@ assuming <self> is a "SettingsAware" object.
 
 * Changing commands, adding aliases:
 ranger/defaults/commands.py
-or ~/.ranger/commands.py
+or ~/.config/ranger/commands.py
 
 * Adding colorschemes:
 Copy ranger/colorschemes/default.py to ranger/colorschemes/myscheme.py
 and modify it according to your needs.  Alternatively, mimic the jungle
 colorscheme.  It subclasses the default scheme and just modifies a few things.
-In ranger/defaults/options.py (or ~/.ranger/options.py), change
+In ranger/defaults/options.py (or ~/.config/ranger/options.py), change
     colorscheme = 'default'
 to: colorscheme = 'myscheme'
 
diff --git a/README b/README
index dad70262..babcfbbb 100644
--- a/README
+++ b/README
@@ -75,7 +75,7 @@ parent directories and to the right there's a preview of the object you're
 pointing at.  Now use the Arrow Keys to navigate, Enter to open a file
 or type Q to quit.
 
-To customize ranger, copy the files from ranger/defaults/ to ~/.ranger/
+To customize ranger, copy the files from ranger/defaults/ to ~/.config/ranger/
 and modify them according to your wishes.
 
 
diff --git a/doc/colorschemes.txt b/doc/colorschemes.txt
index 905c7a3e..e7bc2c0a 100644
--- a/doc/colorschemes.txt
+++ b/doc/colorschemes.txt
@@ -65,7 +65,7 @@ Specify a Colorscheme
 ---------------------
 
 Colorschemes are searched for in these directories:
-~/.ranger/colorschemes/
+~/.config/ranger/colorschemes/
 /ranger/colorschemes/
 
 To specify which colorscheme to use, define the variable "colorscheme"
@@ -73,7 +73,7 @@ in your options.py:
 colorscheme = colorschemes.default
 
 This means, use the (one) colorscheme contained in
-either ~/.ranger/colorschemes/default.py or /ranger/colorschemes/default.py.
+either ~/.config/ranger/colorschemes/default.py or /ranger/colorschemes/default.py.
 
 You can define more than one colorscheme in a colorscheme file.  The
 one named "Scheme" will be chosen in that case.  If there is no colorscheme
diff --git a/doc/ranger.1 b/doc/ranger.1
index 3db90285..fab42496 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -38,7 +38,8 @@ Return the exit code 1 if ranger is used to run a file, for example with
 `ranger --fail-unless-cd filename`.  This can be useful for scripts.
 .TP
 -r \fIdir\fR, --confdir=\fIdir\fR
-Define a different configuration directory.  The default is $HOME/.ranger.
+Define a different configuration directory.  The default is
+$XDG_CONFIG_HOME/ranger (which defaults to ~/.config/ranger)
 .TP
 -m \fIn\fR, --mode=\fIn\fR
 When a filename is supplied, make it run in mode \fIn\fR. Check the
@@ -177,17 +178,17 @@ of your parent shell after exiting ranger:
 
 ranger() {
     command ranger --fail-unless-cd $@ &&
-    cd "$(grep \\^\\' ~/.ranger/bookmarks | cut -b3-)"
+    cd "$(grep \\^\\' ~/.config/ranger/bookmarks | cut -b3-)"
 }
 .\"-----------------------------------------
 .SH CONFIGURATION
 The files in
 .B ranger/defaults/
 can be copied into your configuration directory (by default, this is
-$HOME/.ranger) and customized according to your wishes.  
+~/.config/ranger) and customized according to your wishes.
 Most files don't have to be copied completely though: Just define those
 settings you want to add or change and they will override the defauls.
-Colorschemes can be placed in $HOME/.ranger/colorschemes.
+Colorschemes can be placed in ~/.config/ranger/colorschemes.
 .P
 All configuration is done in Python.
 Each configuration file should contain sufficient documentation.
diff --git a/ranger.py b/ranger.py
index f290d796..cc7f14ed 100755
--- a/ranger.py
+++ b/ranger.py
@@ -23,7 +23,11 @@
 # after you exit ranger by starting it with: source ranger ranger
 """":
 if [ $1 ]; then
-	$@ --fail-unless-cd && cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
+	if [ -z $XDG_CONFIG_HOME ]; then
+		$@ --fail-unless-cd && cd "$(grep \^\' ~/.config/ranger/bookmarks | cut -b3-)"
+	else
+		$@ --fail-unless-cd && cd "$(grep \^\' "$XDG_CONFIG_HOME"/ranger/bookmarks | cut -b3-)"
+	fi
 else
 	echo "usage: source path/to/ranger.py path/to/ranger.py"
 fi
diff --git a/ranger/__init__.py b/ranger/__init__.py
index e0e8e1bf..57e0e5a2 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -31,7 +31,10 @@ Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
 """
 
 USAGE = '%prog [options] [path/filename]'
-DEFAULT_CONFDIR = '~/.ranger'
+if 'XDG_CONFIG_HOME' in os.environ and os.environ['XDG_CONFIG_HOME']:
+	DEFAULT_CONFDIR = os.environ['XDG_CONFIG_HOME'] + '/ranger'
+else:
+	DEFAULT_CONFDIR = '~/.config/ranger'
 RANGERDIR = os.path.dirname(__file__)
 LOGFILE = '/tmp/errorlog'
 arg = OpenStruct(
diff --git a/ranger/__main__.py b/ranger/__main__.py
index b3a41776..28284ef5 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -113,7 +113,7 @@ def load_settings(fm, clean):
 			pass
 		# COMPAT WARNING
 		if hasattr(keys, 'initialize_commands'):
-			print("Warning: the syntax for ~/.ranger/keys.py has changed.")
+			print("Warning: the syntax for ~/.config/ranger/keys.py has changed.")
 			print("Your custom keys are not loaded."\
 					"  Please update your configuration.")
 		allow_access_to_confdir(ranger.arg.confdir, False)
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index d12d9c6c..a5ee0d4d 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -423,7 +423,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# --------------------------
 	# -- Tags
 	# --------------------------
-	# Tags are saved in ~/.ranger/tagged and simply mark if a
+	# Tags are saved in ~/.config/ranger/tagged and simply mark if a
 	# file is important to you in any context.
 
 	def tag_toggle(self, movedown=None):
diff --git a/ranger/defaults/apps.py b/ranger/defaults/apps.py
index 48735196..47eff0c9 100644
--- a/ranger/defaults/apps.py
+++ b/ranger/defaults/apps.py
@@ -17,13 +17,13 @@
 This is the default ranger configuration file for filetype detection
 and application handling.
 
-You can place this file in your ~/.ranger/ directory and it will be used
+You can place this file in your ~/.config/ranger/ directory and it will be used
 instead of this one.  Though, to minimize your effort when upgrading ranger,
 you may want to subclass CustomApplications rather than making a full copy.
             
 This example modifies the behaviour of "feh" and adds a custom media player:
 
-#### start of the ~/.ranger/apps.py example
+#### start of the ~/.config/ranger/apps.py example
 	from ranger.defaults.apps import CustomApplications as DefaultApps
 	from ranger.api.apps import *
 			
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index f1c92274..b6bf7e2b 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -32,7 +32,7 @@ The return value for quick() can be:
 The return value for execute() doesn't matter.
 
 If you want to add custom commands, you can create a file
-~/.ranger/commands.py, add the line:
+~/.config/ranger/commands.py, add the line:
 	from ranger.api.commands import *
 
 and write some command definitions, for example:
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index e72f4c91..7d8ccc4a 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -58,7 +58,7 @@ dgg       => fm.cut(foo=bar, dirarg=Direction(to=0))
 5dgg      => fm.cut(foo=bar, narg=5, dirarg=Direction(to=0))
 5d3gg     => fm.cut(foo=bar, narg=5, dirarg=Direction(to=3))
 
-Example ~/.ranger/keys.py
+Example ~/.config/ranger/keys.py
 -------------------------
 from ranger.api.keys import *
 
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index d3c420af..126d4bad 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -17,7 +17,7 @@
 This is the default configuration file of ranger.
 
 There are two ways of customizing ranger.  The first and recommended
-method is creating a file at ~/.ranger/options.py and adding
+method is creating a file at ~/.config/ranger/options.py and adding
 those lines you want to change.  It might look like this:
 
 from ranger.api.options import *
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 501b8788..5b317acb 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -24,7 +24,7 @@ The values are specified in ranger.gui.color.
 A colorscheme must...
 
 1. be inside either of these directories:
-~/.ranger/colorschemes/
+~/.config/ranger/colorschemes/
 path/to/ranger/colorschemes/
 
 2. be a subclass of ranger.gui.colorscheme.ColorScheme
@@ -121,7 +121,7 @@ class ColorScheme(SettingsAware):
 		return fg, -1, attr
 
 def _colorscheme_name_to_class(signal):
-	# Find the colorscheme.  First look for it at ~/.ranger/colorschemes,
+	# Find the colorscheme.  First look for it at ~/.config/ranger/colorschemes,
 	# then at RANGERDIR/colorschemes.  If the file contains a class
 	# named Scheme, it is used.  Otherwise, an arbitrary other class
 	# is picked.
@@ -139,7 +139,7 @@ def _colorscheme_name_to_class(signal):
 		except:
 			return False
 
-	# create ~/.ranger/colorschemes/__init__.py if it doesn't exist
+	# create ~/.config/ranger/colorschemes/__init__.py if it doesn't exist
 	if usecustom:
 		if os.path.exists(ranger.relpath_conf('colorschemes')):
 			initpy = ranger.relpath_conf('colorschemes', '__init__.py')
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257