Gustash / Hyprshot

Hyprshot is an utility to easily take screenshots in Hyprland using your mouse.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Specify output with command

PhlegmaTREEc opened this issue · comments

Hello, just quick question. Would it be possible to add option to specify output to take screen-shot of in the command. Like hyprshot - m output DP-1, so there is no need to select the output with click of a mouse.
Thanks for considering this.

Yes, this is possible. I'll look into adding this as a feature

Thank you very much for the reply

commented

hello @PhlegmaTREEc
if u want this now u do this
image

in line 89.

@0xUnixy Could you be a bit more specific, please?
Where do I put this function? Into Hyprland config?
How do I invoke it? bind = $mainMod SHIFT, p, exec, hyprshot -m output -o ~/Pictures/Screen_Shots This his my current hot key. Do I add the function into it? How?

commented

@PhlegmaTREEc
First of all hyprshot is a bash script, and the screenshot above is the line 89 from that script.
do the following:

  1. run which hyprshot to know where the script is located in your file system.
  2. open it with your txt editor (using sudo ).
  3. go to the line 89 and replace "local geometry=`grab_output`" with local geometry='0,0 1920x1080'.
  4. save the file and u r good to do, there is no need to change anything in the hyprland config.

NOTE: Consider changing the resoloution to your screen resoloution.

OK, that works, Thanks.
I do hope for actual feature, that would be more flexible on multi-monitor setup.

I have a multi-monitor setup and I have been using my mouse to select the window or monitor. I like the idea of finding a way to do the output selection using the keyboard, I assume this is what you mean.

Here’s a little script i made to get the geometry of an output:

#! /usr/bin/env bash

output_name="$1"

if test -z "$output_name"
then
    selector=".focused == true"
elif [[ $output_name =~ ^[0-9]$ ]]
then
    selector=".id == $output_name"
else
    selector='.name == "'"$output_name"'"'
fi

if [ -n "$HYPRLAND_INSTANCE_SIGNATURE"]
{
    read -r X
    read -r Y
    read -r W
    read -r H
} < <(hyprctl -j monitors | jq '.[] | select('"$selector"') | .x,.y,.width,.height')

geometry="$X,$Y ${W}x$H"
echo "$geometry"

If you don’t specify an output, it queries the current output using hyprctl. If you specify an output number or an output name, it will use that output.

Feel free to use it (no warranties, though) and/or include it in a PR in verbatim.

This has been implemented in #19

Please test it out and let me know if it's working as intended, as well as if it breaks anything.

If there are no issues in 2 weeks time I will make a new release with these changes.