Code Monkey home page Code Monkey logo

yaxg's Introduction

yaxg

Yet Another X Grabber script

Dependencies

  • slop - for selecting regions and windows
  • maim - for saving screenshots
  • ffmpeg - for recording videos
  • byzanz - for recording gifs (soon to be replaced with ffmpeg)
  • libnotify / notify-send - for notifications

Usage

yaxg [OPTIONS] [FILE]

Options

-d  specify duration to record for (only works for webms)
-D  specify delay
-F  overwrite file if it exists
-s  select a region or window
-S  pass a arguments directly to slop
-e  execute a script in the config dir or a callback string with the current $SHELL
-g  save as gif (will be overridden by file extension)
-p  save as png (will be overridden by file extension)
-w  save as webm (will be overridden by file extension)
    this is the default behavior when -g or -p is not present and the filename doesn't end in png or gif
    press Ctrl+C to stop recording or run `yaxg stop`
-v  increase verbosity (can be stacked)
    first level will show errors parsing config file, consecutive levels will be passed to ffmpeg
-h  print this help

Special Strings

Similar to scrot, the callback and filename parameters can take format specifiers that are expanded when encountered. Characters preceded by % are interpreted directly by the date commmand. See man strftime for examples. Characters preceded by $ are parsed by yaxg and expanded as such:

$f  quoted image path/filename (only available in callback)
$w  image width
$h  image height

Configuration

A configuration file can saved to ~/.config/yaxg/conf
If a line begins with # it is treated as a comment and ignored.
The config file accepts the following values:

callback
  a callback string to execute
  if callback is a script in the config dir, the the quoted filename will automatically be passed to the script
filename
  a default filename to use when none is provided (must not include extension)
	defaults to %FT%R:%S:%:z_$wx$h
format
  default format to use, must be either 'png', 'webm', or 'gif'
slop
  arguments to be passed to slop

Examples

  • Example CLI usage:
yaxg '%s-$w-$h'
yaxg '%s-$w-$h' -e 'mv $f ~/images/$f'
yaxg -s -S '-l -c 0.3,0.4,0.6,0.4' -e 'mv $f ~/images/$f && firefox ~/images/$f'
printf '#!/usr/bin/env bash\n\n[[ "$1" =~ png$ ]] && optipng "$1"\n' > ~/.config/yaxg/myScript && chmod +x !#:3 && yaxg -e 'myScript'
  • Example config file:
filename  %c - $wx$h
format    png
slop      -l -c 0.3,0.4,0.6,0.4
callback  myScript

The wiki has some example callback scripts.

Installation

Arch Linux users can install from the AUR as yaxg-git via their favorite AUR helper.

If you're on another distro, I would suggest cloning the repo and symlink'ing the script into ~/.local/bin and adding that to your PATH.

See also

Legal

Copyright (C) 2016 Daniel F Gray [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.