https://bugs.kde.org/show_bug.cgi?id=385885

--- Comment #40 from tamius....@gmail.com ---
Here's something I noticed about this bug while playing around with xprop. I
ran this command:

    $ sleep 5; xprop -id $(xdotool search --pid `pidof spectacle`)

and ran spectacle --region in the 5 second grace period before the command ran.
Here is a section of the output:

------------------------------------[ begin output
]-----------------------------------------------
_NET_WM_NAME(UTF8_STRING) = "Spectacle"
WM_CLASS(STRING) = "spectacle", "spectacle"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING,
_NET_W
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: -864, 0
                user specified size: 11583 by 2159
                program specified resize increment: 1 by 1
                program specified base size: -1 by -1
                window gravity: Static
------------------------------------[  end output
]-----------------------------------------------


That's funny. "User specified location" is negative by the exact amount of
pixels the preview gets offset by (and user specified size is one pixel less
than my desktop resolution — 11584 x 2160).

I assume this is the spectacle's "select rectangular region" window on which
one draws rectangular selection. The "easy" solution/workaround for this bug
could be to set spectacle's rectangular select window location to 0,0 and
disallow other offsets (especially the negative ones, as they'd put spectacle
off screen).



# TRYING WORKAROUNDS — UNSUCCESSFUL

I'm just leaving this here in order to save two minutes of anyone who thinks
about trying to work around this bug with kwin window rules. Specifying kwin
window rules didn't work. I tried the following:

In 'window matching' tab:
 * 'spectacle' for window class (substring match)
 * 'Spectacle' (exact match) for window title (WM_CLASS and _NET_WM_NAME))
 * all window types selected

In 'size&position' tab:
 * [*] Position       Force     0,0

Nothing happened. Spectacle kept being offset.



# TRYING WORKAROUND — SUCCESSFUL

0. Create and open new file. 
1. Paste this in (indent optional, it's present for visibility reasons)

    #!/bin/bash
    (sleep 2; xdotool windowmove $(xdotool search --pid `pidof spectacle` |
tail -n 1) 0 0) & spectacle --region

2. Save the file. Make it executable.
3. Go to custom keyboard shortcuts. Create new shortcut. You can use the same
keyboard shortcut as you already do (the old shortcut is useless anyway) or use
a new one.
3. In the 'Action' tab, select this file as command/url
4. That's it, really

Some side notes:
 * You absolutely DO need to put that command in a file. The command from step
1 didn't work if used as command directly. I had to put it in a file. 
 * If this still doesn't work for you, try adding the file to your $PATH on
startup
 * Just as a curiosity — according to my experience playing around in the
terminal, it seems important that the xdotool bit goes first and spectacle
last. If I tried to run it the other way around, that is:

    spectacle --region & sleep 5; <xdotool stuff>

Nothing would happen in this case.

Side side note: I don't know enough about C/C++ to whip up a proper patch for
this or else I would.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to