aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2023-10-18 19:14:53 +0100
committerJustine Smithies <justine@smithies.me.uk>2023-10-18 19:14:53 +0100
commit345b5fd5933fdbad8edf437a8dd53c624351754b (patch)
tree3afa0e991f4df91fcce7e6bdcdf71f16f74e9864 /.local/bin
parent7a870a54e8674ae43ab27bc8fc8a6451184a8876 (diff)
Updated daily back to Qtile Wayland
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/screenshot.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/.local/bin/screenshot.sh b/.local/bin/screenshot.sh
index 088c1b1..29c62c8 100755
--- a/.local/bin/screenshot.sh
+++ b/.local/bin/screenshot.sh
@@ -9,10 +9,21 @@ case $1 in
# Take a screenshot and save it to the clipboard
grim -g "$(slurp -d)" - | wl-copy
;;
+ focused-window)
+ # Take a screenshot of the focused window
+ pos=$(qtile cmd-obj -o window -f get_position | awk '{ print $1" "$2}' | tr -dc '0-9 ')
+ xpos=$(echo $pos | awk '{ print $1 }')
+ ypos=$(echo $pos | awk '{ print $2 }')
+ size=$(qtile cmd-obj -o window -f get_size | awk '{ print $1" "$2}' | tr -dc '0-9 ')
+ xsize=$(echo $size | awk '{ print $1 }')
+ ysize=$(echo $size | awk '{ print $2 }')
+ xsize=$((xsize+4)) # Value added is 2 times the border width
+ ysize=$((ysize+4)) # Value added is 2 times the border width
+ grim -g "$xpos"",""$ypos $xsize""x""$ysize" -t jpeg ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
+ ;;
*)
# Take a screenshot of the currently focused output and save it into screenshots
- output="$(lswt -j | jq -c '.[] | select(.activated) | .outputs' | awk -F'[""
-]' '{print $2}')"
+ output="$(qtile cmd-obj -o core -f eval -a "self._current_output.wlr_output.name" | awk -F"['']" '/,/{print $2}')"
grim -o $output -t jpeg ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
;;
esac