Compare commits
No commits in common. "8b2b33ab949b2d075d8f9a28403e08295ed51ed8" and "68011d1163d32eead6ee1f3ebbbf1fb7f9c16102" have entirely different histories.
8b2b33ab94
...
68011d1163
@ -1,30 +0,0 @@
|
|||||||
#!/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
|
|
@ -11,33 +11,32 @@ echo -e "[Default]\nsave_dir=$save_dir\nsave_filename_format=$save_file" > $swpy
|
|||||||
|
|
||||||
upload ()
|
upload ()
|
||||||
{
|
{
|
||||||
curl -F'file=@'"${save_dir}/${save_file}" -Fsecret= -H 'X-Auth: '$(cat ~/.key) https://paste.jabuxas.xyz | wl-copy
|
curl -F'file=@'"${save_dir}/${save_file}" -Fsecret= https://paste.jabuxas.xyz | wl-copy
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_error
|
function print_error
|
||||||
{
|
{
|
||||||
cat << "EOF"
|
cat << "EOF"
|
||||||
./way-print.sh <action>
|
./screenshot.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
|
||||||
grim $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot ;;
|
~/.local/bin/grimblast copysave screen $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
|
||||||
grim -g "$(slurp)" $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot ;;
|
~/.local/bin/grimblast copysave area $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
|
||||||
grim -o $(swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true).output') $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot ;;
|
~/.local/bin/grimblast copysave output $temp_screenshot && swappy -f $temp_screenshot ;;
|
||||||
t) #upload to paste
|
t) #upload to 0x0.st temporarily
|
||||||
grim -g "$(slurp)" $temp_screenshot && wl-copy < $temp_screenshot && swappy -f $temp_screenshot && upload ;;
|
~/.local/bin/grimblast copysave area $temp_screenshot && swappy -f $temp_screenshot && upload ;;
|
||||||
cw) #current window
|
|
||||||
~/scripts/print-window.sh ;;
|
|
||||||
*) # invalid option
|
*) # invalid option
|
||||||
print_error ;;
|
print_error ;;
|
||||||
esac
|
esac
|
||||||
|
@ -20,7 +20,6 @@ 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
|
||||||
|
@ -51,7 +51,5 @@ 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
|
||||||
|
Loading…
Reference in New Issue
Block a user