Skip to content

alonso-herreros/hyprcap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyprCap

AUR version AUR git version Latest GitHub release

HyprCap is a utility to easily capture screenshots and screen recordings on Hyprland.

It allows selecting windows, regions and monitors with your mouse, command line arguments, or an interactive fuzzel menu.

Installation

Arch Linux

This utility is available in the AUR. You can install it using an AUR helper like yay:

yay -S hyprcap

Manual installation

Dependencies

Install the required dependencies using your package manager. For example, on Arch Linux, you can use:

sudo pacman -S wf-recorder grim slurp hyprland jq wl-clipboard hyprpicker libnotify

The following dependencies are required to run HyprCap:

  • wf-recorder
  • grim
  • slurp
  • hyprland
  • jq

The following extras are not essential, but required for some features

  • wl-clipboard to copy to clipboard
  • hyprpicker to freeze the screen
  • libnotify + a notification daemon to get notified
  • fuzzel to use an interactive menu

Copy the script

Copy the hyprcap script to a folder in your PATH:

git clone https://github.com/alonso-herreros/hyprcap.git HyprCap
cd HyprCap
make all
sudo make install

For user-level installation, you can use:

git clone https://github.com/alonso-herreros/hyprcap.git HyprCap
cd HyprCap
make all
make install PREFIX="$HOME/.local"

You're free to delete the cloned repository after copying the script.

Usage

You can get help on how to use HyprCap by running hyprcap -h:

$ hyprcap -h
Usage: hyprcap [options...] <command> [[-s] <selection>]

HyprCap is a utility to easily capture screenshots and screen recordings on
Hyprland.

Please report bugs and issues at
https://github.com/alonso-herreros/hyprcap/issues

Commands:
  shot | screenshot            Take a screenshot
  rec | record                 Toggle screen recording
  rec-start | record-start     Start a screen recording
  rec-stop | record-stop       Stop a screen recording

A selection can be specified after the command, with the -s or --selection
option, or using a fuzzel (dmenu-like) menu if neither is specified.

Selection:
  monitor                   Select an entire monitor interactively.
  monitor:active            Select the currently focused monitor.
  monitor:<name>            Select the monitor with the exact given name

  window                    Select a visible window interactively.
  window:active             Select the currently focused window.
  window:<title>            Select the first window that contains the title.

  region                    Select a region manually using 'slurp'.
  region:X,Y,WxH            Select the specified region.


Selection options:
  -s, --select <selection>      Alternative way to specify the selection.

Saving options:
  -w, --write                   Save the capture to a file using the default
                                filename and directory.
  -o, --output-dir <dir>        Directory in which to save captures.
                                Default: $XDG_PICTURES_DIR/Screenshots or
                                $XDG_VIDEOS_DIR/Captures
  -f, --filename <filename>     The file name for the resulting capture within
                                the output directory.
                                Default:
                                  YYYY-MM-DD-hhmmss_hyprcap.<extension>
                                where <extension> is determined by the command
                                (e.g. png for screenshots, mp4 for recordings).
  -F, --no-file                 Don't save captures to a file (default).
  -c, --copy                    Copy capture to clipboard with 'wl-copy'.

Capture options:
  -d, --delay <time>            How long to delay starting the capture after
                                selection is done in seconds.
  -z, --freeze                  Freeze the screen on initialization. Only
                                available for screenshots.

Notification options:
  -n, --notify                  Send a notification when capture is done.
                                (default).
  -N, --no-notify               Don't send notifications.
  -a, --actions                 Show actions in the notification (default).
                                Requires --notify.
  -A, --no-actions              Don't show actions in the notification. Requires
                                --notify.
  -t, --notif-timeout <time>    Notification timeout in milliseconds. Requires
                                --notify
                                Default: 10 seconds.

Output options:
  -r, --raw                     Output raw capture data to stdout.
  -v, --verbose                 Print extra information. Specify multiple times
                                to increase verbosity.
  -q, --quiet                   Print less information.
  --disable-title               Forcefully disable setting the terminal title.
                                Useful if the terminal title setting code is
                                causing issues, e.g. when running in a script.
  -V, --version                 Show the version and exit.
  -h, --help                    Show this help message and exit.

Examples:
  Toggle recording current monitor      `hyprcap rec monitor:active`
  Screenshot a window (interactive)     `hyprcap shot window`
  Toggle recording a specific region    `hyprcap rec region:100,100,400x300`
  Stop an ongoing recording             `hyprcap rec-stop`
  Fall back to monitor capture when selection is cancelled
        `hyprcap shot region || hyprcap shot monitor:active`

Configuration

You can add the various modes as keybindings in your Hyprland config like so:

# ~/.config/hypr/hyprland.conf

...

# Screenshot a region
bind = $MOD SHIFT, S,      exec, hyprcap shot region -z -c -n
# Screenshot current window
bind = $MOD SHIFT ALT, S,  exec, hyprcap shot window:active -z -c -n
# Screenshot with interactive selection
bind = $MOD SHIFT CTRL, S, exec, hyprcap shot -z -c -n

# Toggle recording a region
bind = $MOD SHIFT, R,      exec, hyprcap rec region -c -n
# Toggle recording current window
bind = $MOD SHIFT ALT, R,  exec, hyprcap rec window:active -c -n
# Toggle recording with interactive selection
bind = $MOD SHIFT CTRL, R, exec, hyprcap rec -c -n

Save location

You can save the captures by using the --write (-w) option. The --out-dir (-o) and --filename (-f) options can be used to specify the output directory and filename, respectively. By default, captures are saved in the $XDG_PICTURES_DIR/Screenshots directory for screenshots and $XDG_VIDEOS_DIR/Captures for recordings. If those XDG directory variables are not set, the defaults are ~/Pictures/Screenshots and ~/Videos/Captures, respectively.

Note

The current capture is saved in the $XDG_CACHE_DIR/hyprcap dir for internal use.

Contributing

Contributions are welcome! You can help by:

  • Reporting bugs and issues on the GitHub repository
  • Suggesting new features or improvements
  • Submitting pull requests with fixes or new features
  • Improving the documentation
  • Testing the utility and providing feedback

Credit

This project is based on Gustash's Hyprshot

About

HyprCap is a utility to easily capture screenshots and screen recordings on Hyprland

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors