Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use keyboard selection #116

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dadav
Copy link

@dadav dadav commented Oct 8, 2022

I wanted to make a selection via keyboard and added this functionality. I also added some more options like:

  • making the font color changeable (-L): The font-color used for writing the labels and dimensions.
  • making label-selection font color changeable (-S): The font-color which is used when an area is selected.
  • split the screen in rows/cols. (-m): Splits the outputs or the given restricted areas in rows/columns.
  • show labels in rectangles (-l): Shows the label. The user can press a key and it will select the first match.
  • set font size (-g): You can change the font size with this.
  • add crosshair (-x): Used code from Crosshairs #95
  • set crosshair color (-X): You can set the crosshair color with this.

This is an example how we could make use of this:

#!/bin/bash

# uses slurp to get x y and then clicks it

div=7

while [[ $div -gt 1 ]]; do
        if [[ -z $x ]]; then
                read -r x y w h < <(slurp -l -f "%x %y %w %h" -m "$div:$div")
        else
                read -r x y w h < <(<<<"$x,$y ${w}x${h}" slurp -l -f "%x %y %w %h" -m "$div:$div")
        fi

        div=$((div-2))
done

swaymsg seat - cursor set "$x" "$y"
swaymsg seat - cursor press button1
swaymsg seat - cursor release button1

And this is how I make use of this (first select the x, y coords and then use swaymsg to click it...like..what if someday the mouse is broken?)

foo.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant