From 0287ca21fcd215e5a61ca736ea3905bac5756ed4 Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Fri, 13 Oct 2023 22:10:04 +0100 Subject: Fixed screenshot keybinds --- .config/river/init | 8 ++++---- .local/bin/screenshot.sh | 15 ++------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.config/river/init b/.config/river/init index c5bf5d0..0b814ff 100755 --- a/.config/river/init +++ b/.config/river/init @@ -140,13 +140,13 @@ riverctl map normal Super F11 enter-mode passthrough riverctl map passthrough Super F11 enter-mode normal # Take a screenshot of the active output -riverctl map normal None Print spawn "grim -o $(lswt -j | jq -c '.[] | select(.activated) | .outputs' | awk -F'"' '{print $2}') -t jpeg ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg" +riverctl map normal None Print spawn '~/.local/bin/screenshot.sh' # Take a screenshot of the selected region -riverctl map normal Super Print spawn 'grim -t jpeg -g "$(slurp)" ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg' +riverctl map normal Super Print spawn '~/.local/bin/screenshot.sh selected-region' # Take a screenshot and save it to the clipboard -riverctl map normal Super+Shift Print spawn 'grim -g "$(slurp)" -| wl-copy && notify-send "Screenshot Clipped"' +riverctl map normal Super+Shift Print spawn '~/.local/bin/screenshot.sh save-to-clipboard' # The scratchpad will live on an unused tag. Which tags are used depends on your # config, but rivers default uses the first 9 tags. @@ -187,7 +187,7 @@ done riverctl background-color 0x002b36 riverctl border-color-focused 0x33ccff riverctl border-color-unfocused 0x595959 - +riverctl border-width 4 # Set keyboard repeat rate riverctl set-repeat 50 300 diff --git a/.local/bin/screenshot.sh b/.local/bin/screenshot.sh index 29c62c8..088c1b1 100755 --- a/.local/bin/screenshot.sh +++ b/.local/bin/screenshot.sh @@ -9,21 +9,10 @@ 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="$(qtile cmd-obj -o core -f eval -a "self._current_output.wlr_output.name" | awk -F"['']" '/,/{print $2}')" + output="$(lswt -j | jq -c '.[] | select(.activated) | .outputs' | awk -F'["" +]' '{print $2}')" grim -o $output -t jpeg ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg ;; esac -- cgit v1.2.3