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

Add screenshot utility configuration #117

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

FilippoBonazziSUSE
Copy link
Collaborator

This is my screenshot configuration using grim and slurp. It allows to:

  • Print: screenshot all outputs
  • $mod + Print: screenshot the focused output
  • Shift + Print: screenshot the focused window
  • Mod1 + Print: screenshot an interactively selected window
  • Ctrl + Print: screenshot an interactively selected area

Before I merge this PR, I want to open this to contributions if others have better configurations.

@denisok denisok added the enhancement New feature or request label Jun 16, 2023
@denisok denisok added this to the 0.16.0 milestone Jun 16, 2023
@FilippoBonazziSUSE
Copy link
Collaborator Author

I just realized I have one more change on my side: I have also set the environment variable

GRIM_DEFAULT_DIR="$HOME/Pictures/screenshots/"

Otherwise, if not configured, I think grim pollutes your home directory with your screenshots. Suggestions on how to handle this?

I would propose to set this environment variable as a default, and users can then easily override it.
I think $HOME/Pictures/screenshots/ is a decent default, so I would go with that unless there are other suggestions.

@denisok
Copy link
Contributor

denisok commented Jun 16, 2023

I just realized I have one more change on my side: I have also set the environment variable

GRIM_DEFAULT_DIR="$HOME/Pictures/screenshots/"

Otherwise, if not configured, I think grim pollutes your home directory with your screenshots. Suggestions on how to handle this?

yeah, I have it like that and am just used to it. But you are right - having a special directory for it - is handy.

I would propose to set this environment variable as a default, and users can then easily override it. I think $HOME/Pictures/screenshots/ is a decent default, so I would go with that unless there are other suggestions.

The problem with that - the directory could be absent, so grim will fail and ppl will be confused about screenshots aren't taken.

https://wiki.archlinux.org/title/XDG_user_directories

one hacky way is probably to detect if XDG_PICTURES_DIR is empty and set some default one in https://github.com/openSUSE/openSUSEway/blob/main/sway/sway-run.sh that we know exists (also could be checked).
Maybe even create one :) $XDG_PICTURES_DIR/screenshots.

@FilippoBonazziSUSE
Copy link
Collaborator Author

Launching grim with an invalid GRIM_DEFAULT_DIR will place the screenshot in the current directory, when launched on the command line. I see how this could break when grim is launched from within sway... what would be the current directory in that case? Would it be writable?

If we need to create one folder I would agree to go through the XDG folders.

@denisok
Copy link
Contributor

denisok commented Jun 19, 2023

ok, I didn't notice that it is a standard env for grim:

grim will write an image to _output-file_, or to a timestamped file name in
*$GRIM_DEFAULT_DIR* if not specified. If *$GRIM_DEFAULT_DIR* is not set, it
falls back first to *$XDG_PICTURES_DIR* and then to the current working
directory. If _output-file_ is *-*, grim will write the image to the standard
output instead.

So I think we shouldn't care now. But when we do the proper installation that is probably on of the ToDo - to create standard dirs and set up XDG vars.

@denisok denisok merged commit aea1fb7 into openSUSE:main Jan 17, 2024
@FilippoBonazziSUSE
Copy link
Collaborator Author

Follow up in #131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants