Compare commits

..

No commits in common. "main" and "dev" have entirely different histories.
main ... dev

13 changed files with 106 additions and 127 deletions

View File

@ -1,4 +1,3 @@
[general]
live_config_reload = true
[bell]
@ -61,7 +60,7 @@ x = 0
y = 0
[[keyboard.bindings]]
command = "clone-terminal"
action = "SpawnNewInstance"
key = "E"
mods = "Control|Shift"
@ -638,7 +637,7 @@ semantic_escape_chars = ",│`|:\"' ()[]{}<>"
[window]
decorations = "none"
dynamic_title = false
opacity = 0.6
opacity = 0.8
[window.dimensions]
columns = 0

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
# Extract parent window uuid
WINDOW_ID=$(xdotool getactivewindow)
WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2)
# Generate new uuid for new terminal
uuid=$(uuidgen)
alacritty --title $uuid -e sh -c "TERMINAL_UUID=$uuid PARENT_TERMINAL=$WM_NAME exec $SHELL"

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
UUID=$(uuidgen)
alacritty --title $UUID -e sh -c "TERMINAL_UUID=$UUID exec $SHELL"

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
# auto fix issues with my scanner
input="$3"
color=$(magick "$input" -format "%[hex:u.p{100,-1}]" info:)
tmp=$(mktemp --suffix=.png)
magick "$input" -page +0-100 -background \#$color -flatten -auto-level $tmp
magick $tmp -quality 100 "${input%.*}.pdf"
rm -rf $tmp "$input"

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
xclip -sel clip -o | sed -e 's/^/> /' | xclip -sel clip

View File

@ -17,11 +17,6 @@
"python": {
"command": "pylsp",
"filetypes": ["python"]
},
"typscript": {
"command": "typescript-language-server",
"args": ["--stdio"],
"filetypes": ["typescript"]
}
}
}

View File

@ -72,9 +72,6 @@ cdw() {
fi
}
# Numbat shortcut
alias nb=numbat
# Initialize thefuck
command -v thefuck > /dev/null 2>&1

View File

@ -32,8 +32,5 @@ if [ -d $HOME/.venv ]; then
export VIRTUAL_ENV=$HOME/.venv
fi
# Use port 8000 by default for flask, cause why would we use anything different?
export FLASK_RUN_PORT=8000
export TERM=xterm-256color
export REPORTTIME=5

View File

@ -0,0 +1,103 @@
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
# Based on bira theme
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
# make some aliases for the colours: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}'
done
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
eval PR_BOLD="%{$terminfo[bold]%}"
# Check the UID
if [[ $UID -ge 1000 ]]; then # normal user
# If ssh
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
local PR_ARROW_UP='${PR_GREEN}┌── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='${PR_GREEN}└${PR_NO_COLOR}'
local PR_PROMPT='$PR_GREEN▷$PR_NO_COLOR'
else
eval PR_USER='${PR_MAGENTA}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_BLUE}%#${PR_NO_COLOR}'
local PR_PROMPT='$PR_MAGENTA▷$PR_NO_COLOR'
local PR_ARROW_UP='$PR_MAGENTA┌── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='$PR_MAGENTA└${PR_NO_COLOR}'
fi
elif [[ $UID -eq 0 ]]; then # root
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
local PR_ARROW_UP='${PR_RED}┌── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='${PR_RED}└${PR_NO_COLOR}'
local PR_PROMPT='$PR_RED▷$PR_NO_COLOR'
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' #SSH
else
eval PR_HOST='${PR_BLUE}%M${PR_NO_COLOR}' # no SSH
fi
# local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
truncated_pwd() {
local max_allowed_size=$(( `tput cols` - 30 ))
local path_name=$(print -rD $PWD)
local new_path_name=""
local truncated=0
while [ ${#path_name} -gt $max_allowed_size ]; do
truncated=1
new_path_name=`echo $path_name | cut -d '/' -f 2-`
if [[ "$new_path_name" == "$path_name" ]]; then
break
fi
path_name=$new_path_name
done
if [ $truncated -eq 1 ]; then
echo "~/.../"$path_name
else
echo $path_name
fi
}
local user_host='$PR_BOLD${PR_USER}$PR_BOLD'
local current_dir='$PR_BOLD%{$PR_BLUE%}$(truncated_pwd)$PR_NO_COLOR%}'
local rvm_ruby=''
if which rvm-prompt &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rvm-prompt i v g s)%{$PR_NO_COLOR%}'
else
if which rbenv &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rbenv version | sed -e "s/ (set.*$//")%{$PR_NO_COLOR%}'
fi
fi
local return_code=""
local git_branch='$(git_prompt_info)'
local PR_DATE='${PR_BOLD}${PR_MAGENTA}[%D{%H:%M}]${PR_NO_COLOR}'
#PROMPT="${user_host} ${current_dir} ${rvm_ruby}${git_branch}$PR_PROMPT "
separator='${PR_YELLOW}::${PR_NO_COLOR}'
tty | read tty_value
if [[ $tty_value == *pts* ]]; then # if in a tty
PROMPT="$PR_ARROW_UP${PR_DATE} ${user_host}${separator}${PR_NO_COLOR}${current_dir} ${rvm_ruby}${git_branch}
$PR_ARROW_DOWN$PR_PROMPT ${PR_NO_COLOR}"
return_code="%(?.%{$PR_GREEN%}%? ↵%{$PR_NO_COLOR%}.%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
else
eval PR_NO_COLOR="$PR_WHITE"
PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}> ${PR_NO_COLOR}"
return_code="%(?.%{$PR_GREEN%}%? <%{$PR_NO_COLOR%}.%{$PR_RED%}%? <%{$PR_NO_COLOR%})"
fi
RPS1=" ${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$PR_NO_COLOR%}"
TMOUT=30
TRAPALRM() {
zle reset-prompt
}

View File

@ -1,84 +0,0 @@
if [ "$PRESERVE_SSH_CWD" = "true" ]; then
# Ensure the directory where we store terminal cwds and ssh exists
mkdir -p $HOME/.config/terminalscwd/
# Alias for cd: when we change directory, we write the new cwd in the file corresponding to the terminal uuid
cd() {
if [ -z "$1" ]; then
directory=$HOME
elif [[ "$1" == "-P" ]] && [ -z $2 ]; then
directory="$HOME"
option="$1"
elif [[ "$1" == "-P" ]]; then
directory="$2"
option="$1"
else
directory="$1"
fi
if [ -z "$option" ]; then
builtin cd "$directory"
else
builtin cd "$option" "$directory"
fi
pwd > $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd
}
# Alias for ssh: when we ssh somewhere, we write it so that we know we should ssh when cloning terminal
ssh() {
echo $1 > $HOME/.config/terminalscwd/$TERMINAL_UUID.ssh
/usr/bin/ssh $@
rm $HOME/.config/terminalscwd/$TERMINAL_UUID.ssh
pwd > $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd
}
# If terminal uuid does not exit
if [ -z $TERMINAL_UUID ]; then
# Generate one
export TERMINAL_UUID=$(uuidgen)
fi
# Copy state for new terminal
if [ ! -z $PARENT_TERMINAL ]; then
if [ -f $HOME/.config/terminalscwd/$PARENT_TERMINAL.cwd ]; then
cp $HOME/.config/terminalscwd/$PARENT_TERMINAL.cwd $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd
fi
if [ -f $HOME/.config/terminalscwd/$PARENT_TERMINAL.ssh ]; then
cp $HOME/.config/terminalscwd/$PARENT_TERMINAL.ssh $HOME/.config/terminalscwd/$TERMINAL_UUID.ssh
fi
fi
# When we're done, delete the uuid files
preserve_ssh_cleanup() {
rm -rf $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd
rm -rf $HOME/.config/terminalscwd/$TERMINAL_UUID.ssh
}
trap preserve_ssh_cleanup EXIT
# If there already is a file corresponding to the current uuid
if [ -f $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd ]; then
# Go the the right directory
cd "$(cat $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd)"
else
# Use our custom alias to go to home, and set the file cwd
cd
fi
# If we're running in an ssh session
if [ -f $HOME/.config/terminalscwd/$TERMINAL_UUID.ssh ]; then
# Run the ssh command, and exec shell in the end so the terminal doesn't exit at end of ssh
ssh $(cat $HOME/.config/terminalscwd/$TERMINAL_UUID.ssh)
fi
fi

3
zshrc
View File

@ -21,7 +21,7 @@ DISABLE_AUTO_UPDATE="true"
ZSH=$HOME/.config/ohmyzsh
ZSH_CUSTOM=$HOME/.config/dotfiles/zsh/ohmyzsh
ZSH_THEME="tforgione"
ZSH_THEME="laptop"
if [ -f $DOTFILES/zsh/env.zsh ]; then
source $DOTFILES/zsh/env.zsh
@ -31,7 +31,6 @@ source $DOTFILES/zsh/config.zsh
source $DOTFILES/zsh/path.zsh
source $DOTFILES/zsh/exports.zsh
source $DOTFILES/zsh/aliases.zsh
source $DOTFILES/zsh/preserve-cwd-ssh.zsh
if [ -f $DOTFILES/zsh/extraconfig.zsh ]; then
source $DOTFILES/zsh/extraconfig.zsh