Skip to content

Instantly share code, notes, and snippets.

@pveierland
Created December 28, 2022 03:04
Show Gist options
  • Save pveierland/cce738fac048cee4b538072cb06ba922 to your computer and use it in GitHub Desktop.
Save pveierland/cce738fac048cee4b538072cb06ba922 to your computer and use it in GitHub Desktop.
slurp_align.sh
#!/bin/sh
# Usage: `slurp_align <divisor>`, e.g. `slurp_align 2` will align slurp width + height to multiple of 2
slurp_align() {
slurp | awk "{split(\$0, loc_size); split(loc_size[2], size, \"x\"); print loc_size[1] \" \" (size[1] - (size[1] % ${1:-1})) \"x\" (size[2] - (size[2] % ${1:-1}));}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment