Get rid of old env script
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
319f774457
commit
bba5b16c6f
6 changed files with 46 additions and 62 deletions
|
@ -1,42 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# .env
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin@kaderli.dev>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# This file contains declarations of environment variables.
|
||||
#
|
||||
# USAGE:
|
||||
# This script is sourced by .bashrc
|
||||
# XDG_Base_Directories
|
||||
# XDG Overrides for unsupported programs
|
||||
export VIMINIT=":source ${XDG_CONFIG_HOME}/vim/vimrc"
|
||||
export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
|
||||
|
||||
# zsh
|
||||
export HISTCONTROL=ignoreboth
|
||||
export HISTSIZE=10000
|
||||
export SAVEHIST="${HISTSIZE}"
|
||||
export HISTFILESIZE="${HISTSIZE}"
|
||||
|
||||
# Ibus
|
||||
export GTK_IM_MODULE=ibus
|
||||
export XMODIFIERS=@im=ibus
|
||||
export QT_IM_MODULE=ibus
|
||||
|
||||
# NVIDIA
|
||||
export __GL_SHADER_DISK_CACHE="1"
|
||||
export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP="1"
|
||||
|
||||
mkdir -p "${__GL_SHADER_DISK_CACHE_PATH}"
|
||||
mkdir -p "${XDG_DATA_HOME}/wine/prefixes"
|
||||
mkdir -p "${XDG_CONFIG_HOME}/bazaar"
|
||||
mkdir -p "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
|
||||
if [ -n "$(command -v compinit)" ]; then
|
||||
compinit -d "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
eval "$(starship init zsh)"
|
|
@ -21,6 +21,9 @@ GTK2_RC_FILES="${XDG_CONFIG_HOME}/gtk-2.0/gtkrc"
|
|||
WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
|
||||
ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
|
||||
NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/config"
|
||||
_JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"
|
||||
PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
|
||||
VIMINIT=":source ${XDG_CONFIG_HOME}/vim/vimrc"
|
||||
|
||||
# XDG Cache
|
||||
CUDA_CACHE_PATH="${XDG_CACHE_HOME}/nv"
|
||||
|
|
5
system/.config/environment.d/40_shell.conf
Normal file
5
system/.config/environment.d/40_shell.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Zsh
|
||||
HISTCONTROL="ignoreboth"
|
||||
HISTSIZE="10000"
|
||||
SAVEHIST="${HISTSIZE}"
|
||||
HISTFILESIZE="${HISTSIZE}"
|
2
system/.config/environment.d/50_nvidia.conf
Normal file
2
system/.config/environment.d/50_nvidia.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
__GL_SHADER_DISK_CACHE="1"
|
||||
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP="1"
|
|
@ -1,20 +1,30 @@
|
|||
import atexit
|
||||
import os
|
||||
import atexit
|
||||
import readline
|
||||
from pathlib import Path
|
||||
|
||||
XDG_DATA_HOME = os.environ["XDG_DATA_HOME"]
|
||||
if readline.get_current_history_length() == 0:
|
||||
state_home = os.environ.get("XDG_STATE_HOME")
|
||||
if state_home is None:
|
||||
state_home = Path.home() / ".local" / "state"
|
||||
else:
|
||||
state_home = Path(state_home)
|
||||
|
||||
if not XDG_DATA_HOME:
|
||||
histfile = os.path.join(os.path.expanduser(
|
||||
"~"), ".local", "share", "python", "history")
|
||||
else:
|
||||
histfile = os.path.join(XDG_DATA_HOME, "python", "history")
|
||||
history_path = state_home / "python_history"
|
||||
if history_path.is_dir():
|
||||
raise OSError(f"'{history_path}' cannot be a directory")
|
||||
|
||||
try:
|
||||
readline.set_auto_history(False)
|
||||
readline.read_history_file(histfile)
|
||||
readline.set_history_length(1000)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
history = str(history_path)
|
||||
|
||||
atexit.register(readline.write_history_file, histfile)
|
||||
try:
|
||||
readline.read_history_file(history)
|
||||
except OSError: # Non existent
|
||||
pass
|
||||
|
||||
def write_history():
|
||||
try:
|
||||
readline.write_history_file(history)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
atexit.register(write_history)
|
||||
|
|
|
@ -19,7 +19,6 @@ setopt INC_APPEND_HISTORY
|
|||
setopt SHARE_HISTORY
|
||||
unsetopt correct
|
||||
|
||||
|
||||
# Zsh keybindings
|
||||
|
||||
# Ctrl + Left
|
||||
|
@ -42,11 +41,6 @@ zstyle ':completion:*' menu select
|
|||
# Persistent rehash
|
||||
zstyle ':completion:*' rehash true
|
||||
|
||||
# Sourcing environment variables
|
||||
if [ -f "${HOME}/.config/custom/env" ]; then
|
||||
. "${HOME}/.config/custom/env"
|
||||
fi
|
||||
|
||||
# Enable color support of ls
|
||||
if [ -f "${XDG_CONFIG_HOME}/custom/dircolors" ]; then
|
||||
dircolors -b "${XDG_CONFIG_HOME}/custom/dircolors" > /dev/null 2>&1
|
||||
|
@ -57,6 +51,18 @@ if [ -f "${XDG_CONFIG_HOME}/custom/aliases" ]; then
|
|||
. "${XDG_CONFIG_HOME}/custom/aliases"
|
||||
fi
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "${__GL_SHADER_DISK_CACHE_PATH}"
|
||||
mkdir -p "${XDG_DATA_HOME}/wine/prefixes"
|
||||
mkdir -p "${XDG_CONFIG_HOME}/bazaar"
|
||||
mkdir -p "${XDG_STATE_HOME}/zsh"
|
||||
mkdir -p "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
|
||||
if [ -n "$(command -v compinit)" ]; then
|
||||
compinit -d "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
# Initialize prompt
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
# Plugins
|
||||
source "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue