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

gnome-area screenshot does not work with i3 #5070

Closed
mangelozzi opened this issue Aug 7, 2022 · 3 comments
Closed

gnome-area screenshot does not work with i3 #5070

mangelozzi opened this issue Aug 7, 2022 · 3 comments
Labels
4.20 bug missing-log Read the CONTRIBUTING.md file for instructions stale Issue or PR has become stale and will be closed soon waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment.

Comments

@mangelozzi
Copy link

mangelozzi commented Aug 7, 2022

This issue may seem like #3422 but I work around that issue by writing to a temp file first, then reading from the temp file, bypassing the not copying issue. This issue is about if -a (or --area) argument is used with gnome-screenshot, then it no longer works.

Summary:


# This works in terminal:
gnome-screenshot -f ~/Pictures/last_screenshot.png && cat ~/Pictures/last_screenshot.png | xclip -i -selection clipboard -target image/png

# This works in i3:
bindcode 107 exec gnome-screenshot -f ~/Pictures/last_screenshot.png && cat ~/Pictures/last_screenshot.png | xclip -i -selection clipboard -target image/png && pinta ~/Pictures/last_screenshot.png

# This works in terminal (adding -a to gnome-screenshot):
gnome-screenshot -af ~/Pictures/last_screenshot.png && cat ~/Pictures/last_screenshot.png | xclip -i -selection clipboard -target image/png

# This DOES NOT work in i3 (adding -a to gnome-screenshot):
bindcode 107 exec gnome-screenshot -af ~/Pictures/last_screenshot.png && cat ~/Pictures/last_screenshot.png | xclip -i -selection clipboard -target image/png && pinta ~/Pictures/last_screenshot.png

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

When taking a screen shot with gnome-screenshot with the-a (--area) option, it not longer takes the screen shot.

Expected Behavior

Take a screen shot with the -a (--area) option.

Reproduction Instructions

Open up a terminal, and run:

gnome-screenshot -af ~/Pictures/last_screenshot.png && cat ~/Pictures/last_screenshot.png | xclip -i -selection clipboard -target image/png

It will change the cursot to a targer, and allow you to click and drag a rectangle to take a screenshot of and copy it to the clipboard

Now that we have proved the above line works fine in a terminal, add this to your i3 config:

# Binding Printscreen, can map what ever combo works for you (maybe 107 is not Print on your keyboard
bindcode 107 exec gnome-screenshot -af ~/Pictures/last_screenshot.png && cat ~/Pictures/last_screenshot.png | xclip -i -selection clipboard -target image/png && pinta ~/Pictures/last_screenshot.png

Environment

Output of i3 --moreversion 2>&-:

inary i3 version:  4.20 (2021-10-19) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.20 (2021-10-19) (pid 2787)
Loaded i3 config:
  /home/michael/.config/i3/config (main) (last modified: Sun 07 Aug 2022 12:54:39, 121 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

Log file

Below you can see 07/08/2022 13:10:55 - ../src/key_press.c:handle_key_press:23 - KeyPress 107, state raw = 0x10 :

07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 10, xkb_base 85
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_out:1128 - focus change out: window 0x012000b1 (con 0x5653bd55f8e0, ) lost focus with detail=Ancestor, mode=Grab
07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 9, xkb_base 85
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_in:1014 - focus change in, for window 0x00000427
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_in:1017 - Received focus in for root window, refocusing the focused window.
07/08/2022 13:10:55 - ../src/con.c:con_focus:248 - con_focus = 0x5653bd55f8e0
07/08/2022 13:10:55 - ../src/con.c:con_focus:248 - con_focus = 0x5653bd58fee0
07/08/2022 13:10:55 - ../src/con.c:con_focus:248 - con_focus = 0x5653bd574370
07/08/2022 13:10:55 - ../src/con.c:con_focus:248 - con_focus = 0x5653bd572a60
07/08/2022 13:10:55 - ../src/x.c:x_push_changes:1198 - -- PUSHING WINDOW STACK --
07/08/2022 13:10:55 - ../src/x.c:x_push_changes:1273 - PUSHING CHANGES
07/08/2022 13:10:55 - ../src/x.c:x_push_changes:1330 - Updating focus (focused: 0x5653bd55f8e0 / (null)) to X11 window 0x012000b1
07/08/2022 13:10:55 - ../src/x.c:x_push_changes:1366 - ENDING CHANGES
07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 2, xkb_base 85
07/08/2022 13:10:55 - ../src/key_press.c:handle_key_press:23 - KeyPress 107, state raw = 0x10
07/08/2022 13:10:55 - ../src/bindings.c:get_binding_from_xcb_event:318 - (removed capslock, state = 0x10)
07/08/2022 13:10:55 - ../src/bindings.c:get_binding_from_xcb_event:343 - (transformed keyboard group, state = 0x10010)
07/08/2022 13:10:55 - ../src/bindings.c:get_binding:240 - binding_keycode->modifiers = 72, modifiers_mask = 72, modifiers_state = 16, mods_match = no
07/08/2022 13:10:55 - ../src/bindings.c:get_binding:240 - binding_keycode->modifiers = 74, modifiers_mask = 74, modifiers_state = 16, mods_match = no
... lots of 'binding_keycode->modifiers' type lines...
07/08/2022 13:10:55 - ../src/bindings.c:get_binding:240 - binding_keycode->modifiers = 2, modifiers_mask = 2, modifiers_state = 16, mods_match = no
07/08/2022 13:10:55 - ../src/bindings.c:get_binding:240 - binding_keycode->modifiers = 16, modifiers_mask = 16, modifiers_state = 16, mods_match = yes
07/08/2022 13:10:55 - ../src/bindings.c:get_binding:240 - binding_keycode->modifiers = 18, modifiers_mask = 18, modifiers_state = 16, mods_match = no
07/08/2022 13:10:55 - ../src/handlers.c:yAhandle_event:1380 - event type 10, xkb_base 85
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_out:1128 - focus change out: window 0x012000b1 (con 0x5653bd55f8e0, ) lost focus with detail=Pointer, mode=Ungrab
07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 10, xkb_base 85
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_out:1128 - focus change out: window 0x00000427 (con (nil), ) lost focus with detail=Inferior, mode=Ungrab
07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 9, xkb_base 85
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_in:1014 - focus change in, for window 0x012000b1
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_in:1026 - That is con 0x5653bd55f8e0 / (null)
07/08/2022 13:10:55 - ../src/handlers.c:handle_focus_in:1030 - FocusIn event for grab/ungrab, ignoring
07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 28, xkb_base 85
07/08/2022 13:10:55 - ../src/handlers.c:handle_event:1380 - event type 28, xkb_base 85
- Linux Distribution & Version: Ubuntu 20.04
- Are you using a compositor (e.g., xcompmgr or compton): No
@i3bot i3bot added bug missing-log Read the CONTRIBUTING.md file for instructions labels Aug 7, 2022
@i3bot
Copy link

i3bot commented Aug 7, 2022

I don’t see a link to logs.i3wm.org. Did you follow https://i3wm.org/docs/debugging.html? (In case you actually provided a link to a logfile, please ignore me.)

@i3bot i3bot added the 4.20 label Aug 7, 2022
@Airblader
Copy link
Member

Airblader commented Aug 7, 2022

Try adding--release to the bindcode. This is likely a problem of grabbing the keyboard. If the log file states that i3 issued the configured command, we have done our job.

@orestisfl
Copy link
Member

Closing because of inactivity.

@orestisfl orestisfl closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2022
@orestisfl orestisfl added waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. stale Issue or PR has become stale and will be closed soon labels Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.20 bug missing-log Read the CONTRIBUTING.md file for instructions stale Issue or PR has become stale and will be closed soon waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment.
Projects
None yet
Development

No branches or pull requests

4 participants