From c5f57dc4c53fc27861aa0ef9689fb0879c855af8 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Sat, 18 Jan 2025 22:30:24 +0100 Subject: [PATCH 1/2] Renamed and removed excessive quotes --- src/bin/{butcher => destroy} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/bin/{butcher => destroy} (82%) diff --git a/src/bin/butcher b/src/bin/destroy similarity index 82% rename from src/bin/butcher rename to src/bin/destroy index 3db56cf..1a0091c 100755 --- a/src/bin/butcher +++ b/src/bin/destroy @@ -8,9 +8,9 @@ def main [input: string, --resize(-r): string, --length(-l): string = "00:00:05" def glitch [input: string, resize: string, length: string] { let output = [ ($input | path parse | get stem ) "_glitch.mkv" ] | str join let filter = if ($resize | is-not-empty) { - $"\'scale=($resize):-2,fps=60,frei0r=filter_name=glitch0r:filter_params=0.2|0.8|.04|1,rgbashift=rh=4:bh=-2,interlace=lowpass=complex\'" + $"scale=($resize):-2,fps=60,frei0r=filter_name=glitch0r:filter_params=0.2|0.8|.04|1,rgbashift=rh=4:bh=-2,interlace=lowpass=complex" } else { - "\'fps=60,frei0r=filter_name=glitch0r:filter_params=0.2|0.8|.04|1,rgbashift=rh=4:bh=-2,interlace=lowpass=complex\'" + "fps=60,frei0r=filter_name=glitch0r:filter_params=0.2|0.8|.04|1,rgbashift=rh=4:bh=-2,interlace=lowpass=complex" } #echo $"ffmpeg -loop 1 -i ($input) -filter_complex ($filter) -to ($length) ($output) -y" ffmpeg -loop 1 -i $input -filter_complex $filter -to $length $output -y From 1ac63ac1809729ce28f3cc5d729d3815f4def3d3 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Sat, 18 Jan 2025 22:30:58 +0100 Subject: [PATCH 2/2] Butcher maim script --- src/bin/butcher | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 src/bin/butcher diff --git a/src/bin/butcher b/src/bin/butcher new file mode 100755 index 0000000..10b47c2 --- /dev/null +++ b/src/bin/butcher @@ -0,0 +1,70 @@ +#!/usr/bin/env nu +# Copyright 2025 Marty Sluijtman +# Distributed under the terms of the GPLv3 license + +let savedir = match ($env.SCROTDIR | is-empty) { + true => $"($env.HOME)/Pictures/Screenshots" + false => $env.SCROTDIR +} + +let date = ^date -Iseconds +let filename = $"($savedir)/($date)_screenshot.png" + +def notify [message: string] { + ^notify-send "Butcher" $message +} + +def clipboard [] { + $in | ^pngquant - | ^xclip -sel clip -t image/png +} + +def main [--clipboard (-c)] { + let scrot = ^maim -ui root | complete + match $clipboard { + true => { + $scrot.stdout | clipboard + notify "Shot entire screen and tossed the output to the clipboard" + } + false => { + $scrot.stdout | save $filename + notify $"Shot entire screen and saved the result to:\n($filename)" + } + } +} + +def "main window" [--clipboard (-c)] { + let window = ^xdotool getactivewindow + let scrot = ^maim -ui $window | complet + match $clipboard { + true => { + $scrot.stdout | clipboad + notify $"Took screenshot of focussed window and tossed it to clipboard" + } + false => { + $scrot.stdout | save $filename + notify $"Saved screenshot of focussed window and save it to:\n($filename)" + } + } +} + +def "main selection" [--clipboard(-c)] { + let scrot = ^maim -su | complete + match $scrot.exit_code { + 0 => { + match $clipboard { + true => { + $scrot.stdout | clipboard + notify "Took screenshot and tossed it to clipboard" + } + false => { + $scrot.stdout | save $filename + notify $"Shot selection and saved it to:\n($filename)" + } + } + } + _ => { + notify "Screenshot selection cancelled" + exit 0 + } + } +}