resurrecting-open-source-projects / scrot

SCReenshOT - command line screen capture utility
Other
512 stars 51 forks source link

New option: --window #212

Closed daltomi closed 1 year ago

daltomi commented 1 year ago
It allows to indicate the identifier of the window, value in
hexadecimal, to which to capture.

Ex: 'scrot --window 0x100000c'

Ex:

 set WID $(xwininfo | grep "Window id:" | awk '{print $4}') && scrot --window $WID

Required parent branch: 23d587a ("Add delay to all capture options")

guijan commented 1 year ago

The feature is fine, but is there a preexisting need for it?

Also, I wouldn't allow hex numbers in every option just because the C interface makes it easy. That's exposing an implementation detail rather than an actual design choice. There should be an optionsParseNumBase() function that is optionsParseNum() but with an extra parameter that is the base strtoll() uses. optionsParseNum()'s usage and behavior would remain unchanged, but its implementation would then become a call to optionsParseNumBase() with the base set to 10.

daltomi commented 1 year ago

I like the idea of a function like this, could you send a PR to this same branch with the changes? So your authorship would also remain in this PR.

daltomi commented 1 year ago

The call to OptionsParseNumBase should use 0 as the argument to the base parameter. xdotool returns a base 10 integer. xwininfo returns a base 16 integer by default, but you can also tell it to return base 10.

Yes, you're right, I'll change it now