Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 110164b71e | |||
| 9de770c4bc | |||
| f7b4e36cc3 | |||
| 8800125c06 | |||
| 8af310d0a2 | |||
| 6ba78c412b | |||
| c3a3d16b9f | |||
| bd0cb3c6c2 | |||
| 1facb0079a | |||
| feebba4e12 | |||
| 9241ff0c0d | |||
| a02648109d | |||
| 9e8c7bed3d | |||
| 8ba58d1475 | |||
| 6e63a19f04 | |||
| 90b5a8ad61 | |||
| 62212e6b83 | |||
| b45049ac27 | |||
| 3ff0c82b3f | |||
| e2559a9f85 |
@@ -60,7 +60,7 @@ x = 0
|
||||
y = 0
|
||||
|
||||
[[keyboard.bindings]]
|
||||
action = "SpawnNewInstance"
|
||||
command = "clone-terminal"
|
||||
key = "E"
|
||||
mods = "Control|Shift"
|
||||
|
||||
@@ -637,7 +637,7 @@ semantic_escape_chars = ",│`|:\"' ()[]{}<>"
|
||||
[window]
|
||||
decorations = "none"
|
||||
dynamic_title = false
|
||||
opacity = 0.8
|
||||
opacity = 0.6
|
||||
|
||||
[window.dimensions]
|
||||
columns = 0
|
||||
|
||||
11
bin/clone-terminal
Executable file
11
bin/clone-terminal
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/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"
|
||||
|
||||
4
bin/new-terminal
Executable file
4
bin/new-terminal
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
UUID=$(uuidgen)
|
||||
alacritty --title $UUID -e sh -c "TERMINAL_UUID=$UUID exec $SHELL"
|
||||
9
bin/post-scan
Executable file
9
bin/post-scan
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/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"
|
||||
3
bin/quote
Executable file
3
bin/quote
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
xclip -sel clip -o | sed -e 's/^/> /' | xclip -sel clip
|
||||
@@ -17,6 +17,11 @@
|
||||
"python": {
|
||||
"command": "pylsp",
|
||||
"filetypes": ["python"]
|
||||
},
|
||||
"typscript": {
|
||||
"command": "typescript-language-server",
|
||||
"args": ["--stdio"],
|
||||
"filetypes": ["typescript"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,9 @@ cdw() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Numbat shortcut
|
||||
alias nb=numbat
|
||||
|
||||
# Initialize thefuck
|
||||
command -v thefuck > /dev/null 2>&1
|
||||
|
||||
|
||||
@@ -32,5 +32,8 @@ 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
|
||||
|
||||
84
zsh/preserve-cwd-ssh.zsh
Normal file
84
zsh/preserve-cwd-ssh.zsh
Normal file
@@ -0,0 +1,84 @@
|
||||
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
|
||||
Reference in New Issue
Block a user