summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <56338480+adastx@users.noreply.github.com>2022-07-05 21:22:16 +0100
committerAdam <56338480+adastx@users.noreply.github.com>2022-07-05 21:22:16 +0100
commit68b862a8aeab15e662bbba10084a541870b15648 (patch)
tree5d3ab12a35cd25b4b10c21db7d637850c8a32f95
parent50fdbe55476359f800a9ef4bc4df8b94983b09ee (diff)
xdg: python_history
-rw-r--r--.bash_profile1
-rw-r--r--.config/python/pythonrc17
2 files changed, 18 insertions, 0 deletions
diff --git a/.bash_profile b/.bash_profile
index 8a0217a..a3998a7 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -25,6 +25,7 @@ export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel ${_JAVA_OPTIONS}"
export SSB_HOME="$XDG_DATA_HOME"/zoom
export WGETRC="$XDG_CONFIG_HOME/wgetrc"
+export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/pythonrc"
export CM_LAUNCHER=rofi
export CM_SELECTIONS=clipboard
export CM_DIR=/tmp
diff --git a/.config/python/pythonrc b/.config/python/pythonrc
new file mode 100644
index 0000000..f3f86a5
--- /dev/null
+++ b/.config/python/pythonrc
@@ -0,0 +1,17 @@
+import os
+import atexit
+import readline
+
+history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history')
+try:
+ readline.read_history_file(history)
+except OSError:
+ pass
+
+def write_history():
+ try:
+ readline.write_history_file(history)
+ except OSError:
+ pass
+
+atexit.register(write_history)