feat: update scripts with my new http server

This commit is contained in:
Lucas Barbieri 2024-08-20 10:13:31 -03:00
parent 5ac0d69128
commit da0a5e6b20
3 changed files with 40 additions and 3 deletions

View File

@ -45,6 +45,8 @@ alias kvm="sh ~/scripts/kvm.sh"
alias windows="sudo grub-set-default 0; sudo grub-reboot 'Microsoft Windows UEFI/GPT'; systemctl reboot" alias windows="sudo grub-set-default 0; sudo grub-reboot 'Microsoft Windows UEFI/GPT'; systemctl reboot"
alias ff="fastfetch" alias ff="fastfetch"
alias feh="imv" alias feh="imv"
alias cop="wl-copy"
alias lg="lazygit"
export BAT_THEME="Solarized (light)" export BAT_THEME="Solarized (light)"
export FPATH="/hdd/docs/eza/completions/zsh:$FPATH" export FPATH="/hdd/docs/eza/completions/zsh:$FPATH"
@ -59,3 +61,29 @@ if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
export XDG_CURRENT_DESKTOP="sway" export XDG_CURRENT_DESKTOP="sway"
dbus-run-session sway dbus-run-session sway
fi fi
paste() {
local file
if [[ -p /dev/stdin ]]; then
file=$(mktemp)
cat > "$file"
elif [[ -n $1 ]]; then
file="$1"
else
echo "Usage: paste [file]"
return 1
fi
curl -F "file=@$file" -H "X-Auth: $(cat ~/.key)" https://paste.jabuxas.xyz/upload
if [[ -p /dev/stdin ]]; then
rm "$file"
fi
}
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/yang/tmp/google-cloud-sdk/path.zsh.inc' ]; then . '/yang/tmp/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/yang/tmp/google-cloud-sdk/completion.zsh.inc' ]; then . '/yang/tmp/google-cloud-sdk/completion.zsh.inc'; fi

View File

@ -7,5 +7,5 @@ fi
if [[ $XDG_SESSION_TYPE == "wayland" ]]; then if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
grim -g "$(slurp)" $tmp grim -g "$(slurp)" $tmp
curl -F'file=@'"${tmp}" -Fsecret= -Fexpires=24 https://0x0.st | wl-copy curl -F'file=@'"${tmp}" -H 'X-Auth: '$(cat ~/.key) https://paste.jabuxas.xyz/upload | wl-copy
fi fi

View File

@ -1,4 +1,12 @@
#!/bin/bash #!/bin/bash
swpy_dir="${XDG_CONFIG_HOME:-$HOME/.config}/swappy"
save_dir="$HOME/pics/screenshots"
save_file="screenshot-$(date -Iseconds | cut -d '+' -f1).png"
temp_screenshot="/tmp/screenshot.png"
mkdir -p $save_dir
mkdir -p $swpy_dir
echo -e "[Default]\nsave_dir=$save_dir\nsave_filename_format=$save_file" > $swpy_dir/config
if [[ $XDG_SESSION_TYPE == "x11" ]]; then if [[ $XDG_SESSION_TYPE == "x11" ]]; then
maim -i $(xdotool getactivewindow) | xclip -sel clip -t image/png maim -i $(xdotool getactivewindow) | xclip -sel clip -t image/png
fi fi
@ -14,8 +22,9 @@ if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
fi fi
if [[ $XDG_CURRENT_DESKTOP == "sway" ]]; then if [[ $XDG_CURRENT_DESKTOP == "sway" ]]; then
grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" ~/tmp/jabuxas.png rm $temp_screenshot
xclip -sel clip ~/tmp/jabuxas.png grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" $temp_screenshot
wl-copy < ~/tmp/jabuxas.png wl-copy < ~/tmp/jabuxas.png
swappy -f $temp_screenshot
fi fi
fi fi