diff --git a/desktop/configs/shell-files/.zshrc b/desktop/configs/shell-files/.zshrc index 2431543..7ee3739 100644 --- a/desktop/configs/shell-files/.zshrc +++ b/desktop/configs/shell-files/.zshrc @@ -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 ff="fastfetch" alias feh="imv" +alias cop="wl-copy" +alias lg="lazygit" export BAT_THEME="Solarized (light)" 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" dbus-run-session sway 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 diff --git a/desktop/scripts/print-tmp.sh b/desktop/scripts/print-tmp.sh index cd4d4fb..7f33ced 100755 --- a/desktop/scripts/print-tmp.sh +++ b/desktop/scripts/print-tmp.sh @@ -7,5 +7,5 @@ fi if [[ $XDG_SESSION_TYPE == "wayland" ]]; then 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 diff --git a/desktop/scripts/print-window.sh b/desktop/scripts/print-window.sh index 395cd30..051e1aa 100755 --- a/desktop/scripts/print-window.sh +++ b/desktop/scripts/print-window.sh @@ -1,4 +1,12 @@ #!/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 maim -i $(xdotool getactivewindow) | xclip -sel clip -t image/png fi @@ -14,8 +22,9 @@ if [[ $XDG_SESSION_TYPE == "wayland" ]]; then fi 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 - xclip -sel clip ~/tmp/jabuxas.png + rm $temp_screenshot + 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 + swappy -f $temp_screenshot fi fi