[bin] Make screenshoter Wayland compatible

This commit is contained in:
Sebastian Schulze 2019-06-05 13:22:08 +02:00
parent b556b94f60
commit 04fe44859e
Signed by: bascht
GPG Key ID: 5BCB1D3B4D38A35A
3 changed files with 18 additions and 3 deletions

View File

@ -16,5 +16,10 @@ Net::SCP.start("drop.bascht.space", "bascht") do |scp|
scp.upload(file.expand_path.to_s, "/home/bascht/drop/#{new_name}")
end
Open3.popen3( "xclip -i -selection clipboard" ){ |input, _, _| input << url }
if ENV["WAYLAND_DISPLAY"].nil?
Open3.popen3( "xclip -i -selection clipboard" ){ |input, _, _| input << url }
else
system "wl-copy #{url}"
end
system("notify-send 'Uploaded successfully' '<a href=\'#{url}\'>drop.bascht.space</a>'")

View File

@ -1,3 +1,5 @@
#!/bin/bash
drop $(i3-screenshot -s)
SHOT=$(i3-screenshot -s)
chmod o+r $SHOT
drop $SHOT

View File

@ -1,4 +1,12 @@
#!/bin/bash
FOLDER="/home/bascht/Pictures/Screenshots/$(date +'%Y-%m')"
mkdir -p ${FOLDER}
escrotum "${FOLDER}/Screenshot-%Y-%m-%d-%H%M%S-\$wx\$h.png" $*
if [ -z "$WAYLAND_DISPLAY" ]; then
NAME="${FOLDER}/Screenshot-%Y-%m-%d-%H%M%S-\$wx\$h.png"
exec escrotum "$NAME" $*
else
NAME="${FOLDER}/Screenshot-$(date +%Y-%m-%d-%H%M%S).png"
grim -g "$(slurp)" "$NAME";
echo $NAME
fi;