Compare commits

..

2 Commits

Author SHA1 Message Date
lucas barbieri
8b2b33ab94 feat(work): new default apps 2024-11-28 11:05:38 -03:00
lucas barbieri
392d20ce0b feat(work): add print scripts 2024-11-28 11:05:26 -03:00
4 changed files with 44 additions and 10 deletions

View File

@ -0,0 +1,30 @@
#!/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
if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
if [[ $XDG_CURRENT_DESKTOP == "Hyprland" ]]; then
window_info=$(hyprctl activewindow)
coordinates=$(echo "$window_info" | grep -oP 'at: \K([0-9]+,[0-9]+)')
size=$(echo "$window_info" | grep -oP 'size: \K([0-9]+,[0-9]+)')
IFS=',' read -r x y <<< "$coordinates"
IFS=',' read -r width height <<< "$size"
grim -g "${x},${y} ${width}x${height}" ~/tmp/jabuxas.png
wl-copy < ~/tmp/jabuxas.png
fi
if [[ $XDG_CURRENT_DESKTOP == "sway" ]]; then
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

View File

@ -11,32 +11,33 @@ echo -e "[Default]\nsave_dir=$save_dir\nsave_filename_format=$save_file" > $swpy
upload () upload ()
{ {
curl -F'file=@'"${save_dir}/${save_file}" -Fsecret= https://paste.jabuxas.xyz | wl-copy curl -F'file=@'"${save_dir}/${save_file}" -Fsecret= -H 'X-Auth: '$(cat ~/.key) https://paste.jabuxas.xyz | wl-copy
} }
function print_error function print_error
{ {
cat << "EOF" cat << "EOF"
./screenshot.sh <action> ./way-print.sh <action>
...valid actions are... ...valid actions are...
p : print all screens p : print all screens
s : snip current screen s : snip current screen
sf : snip current screen (frozen)
m : print focused monitor m : print focused monitor
t : tmp print
cw: current window
EOF EOF
} }
case $1 in case $1 in
p) # print all outputs p) # print all outputs
~/.local/bin/grimblast copysave screen $temp_screenshot && swappy -f $temp_screenshot ;; grim $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot ;;
s) # drag to manually snip an area / click on a window to print it s) # drag to manually snip an area / click on a window to print it
~/.local/bin/grimblast copysave area $temp_screenshot && swappy -f $temp_screenshot ;; grim -g "$(slurp)" $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot ;;
sf) # frozen screen, drag to manually snip an area / click on a window to print it
~/.local/bin/grimblast --freeze copysave area $temp_screenshot && swappy -f $temp_screenshot ;;
m) # print focused monitor m) # print focused monitor
~/.local/bin/grimblast copysave output $temp_screenshot && swappy -f $temp_screenshot ;; grim -o $(swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true).output') $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot ;;
t) #upload to 0x0.st temporarily t) #upload to paste
~/.local/bin/grimblast copysave area $temp_screenshot && swappy -f $temp_screenshot && upload ;; grim -g "$(slurp)" $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot && upload ;;
cw) #current window
~/scripts/print-window.sh ;;
*) # invalid option *) # invalid option
print_error ;; print_error ;;
esac esac

View File

@ -20,6 +20,7 @@ exec {
teams-for-linux & teams-for-linux &
flatpak run com.mattermost.Desktop flatpak run com.mattermost.Desktop
bitwarden-desktop-bin bitwarden-desktop-bin
flatpak run io.github.mahmoudbahaa.outlook_for_linux
} }
# vim: ts=2 sts=2 sw=2 ft=swayconfig # vim: ts=2 sts=2 sw=2 ft=swayconfig

View File

@ -51,5 +51,7 @@ for_window [title="^Steam Keyboard$"] floating enable
for_window [class="Mattermost"] move to workspace 7 for_window [class="Mattermost"] move to workspace 7
for_window [class="teams-for-linux"] move to workspace 8 for_window [class="teams-for-linux"] move to workspace 8
for_window [class="Bitwarden"] move to workspace 9 for_window [class="Bitwarden"] move to workspace 9
for_window [class="outlook-for-linux"] move to workspace 10
for_window [class="Lacuna.WebPkiCore"] floating enable
# vim: ts=2 sts=2 sw=2 ft=swayconfig # vim: ts=2 sts=2 sw=2 ft=swayconfig