urxvt opens as window instead of as bar when no window has focus (in wayland)
I have installed shellex on my Arch Linux system, which uses wayland with sway. Shellex sometimes (I think in like 10% of the cases I press the key binding) starts as a fullscreen urxvt terminal. Screenshot (taken right after the keybinding for shellex, in a fresh and empty workspace): http://oi65.tinypic.com/241qyv6.jpg
Even if the terminal shows up as a bar at the top of the screen (as intended), a bigger terminal window sometimes flashes for a tiny moment. The problem seems to occur mostly (but not exclusively) when I start shellex (by pressing the keybinding) for the first time in a new/fresh workspace.
I'm not sure if this is related to (or maybe even covered by) #21. More details will be provided if demanded.
Edit: I was sloppy in the original post. In X11, shellex seems to work properly. This issue seems to be (contrary to what I wrote in the first version) exclusive to wayland (possibly to sway).
Thanks for reporting.
What comes ad-hoc to my mind is the following
If it's related to #21 should be easy to check if you remove any urxvt configuration from your Xresources and try to reproduce the problem with shellex. (Clearly not a solution, but should confirm/reject the hypothesis).
Do you have different prompts for shellex and normal zsh shells? (I'm wondering if there is a problem loading the shellex perl module and you get a regular terminal in case the module doesn't get loaded.) If so, in case of a fullscreen shellex, does it show the shellex prompt or a regular shell prompt?
And in the direction of window size picking, I'm wondering if the shellex window gets created at the wrong size or if you see a resizing issue.
The flashing sounds to me like you see the shellex window before it gets its final size. Which shouldn't happen, we say in urxvt/shellex.in
# This hook is run after the window is created, but before it is mapped, so
# this is the place to set the geometry to what we want
sub on_start {
A resizing issue could go like this: I also see a two-line shellex flashing up when it starts. This is: the configuration gets loaded in the shellex window, it grows to accomodate all its content, then the terminal gets cleared and the window shrinks to one line. And here … phew, not sure why this should let you end up with a fullscreen window.
In any case, can you also get such a fullscreen terminal when you start shellex from the command line? (To see the printout from the perl module)
Thanks for your reply!
Please note that I tried shellex on X11 again, and everything is fine -- contrary to what I reported earlier. I edited the issue to reflect this. Sorry for the sloppiness. As a workaround, I now use X + i3 instead of wayland + sway.
I can't reproduce the issue when I run shellex in a terminal emulator. However, by redirecting stderr I obtained:
position should be at the top
Getting shellex-position from focused window
urxvt: Protocol error: bad 9 (Drawable); Sequence Number 4
Opcode (14, 0) = GetGeometry
Bad resource 0 (0x0)
at /usr/lib/shellex/urxvt/shellex line 83.
add_lines(string = "%")
resizing to
size_change(1440, 900)
add_lines(string = " \r \r\r")
resizing to
add_lines(string = "T410% ")
resizing to
add_lines(string = "\r\r")
resizing to
add_lines(string = "T410% ")
resizing to
line_update(row = 0)
resizing toe
line_update(row = 1)
resizing to
line_update(row = 2)
(and so on until line_update(row = 67)
When I do "shellex 2> log" I obtain
position should be at the top
Getting shellex-position from focused window
Focus 4194316 (698x836)
writing max rows file done
loading config
size_change(1024, 17)
line_update(row = 0)
resizing to 1
size_change(1440, 17)
add_lines(string = "unset LD_PRELOAD\r\n")
resizing to 2
size_change(1440, 30)
add_lines(string = ". /etc/shellexrc\r\n")
resizing to 3
size_change(1440, 43)
add_lines(string = "")
resizing to 3
add_lines(string = "%")
resizing to 3
add_lines(string = "
\r \r")
resizing to 3
add_lines(string = "\r")
resizing to 3
add_lines(string = "T410% ")
resizing to 3
add_lines(string = "\r\r")
resizing to 3
add_lines(string = "T410% u")
resizing to 3
add_lines(string = "unset LD_PRELOAD")
resizing to 3
add_lines(string = "\r\r\n")
resizing to 4
size_change(1440, 56)
add_lines(string = "%")
resizing to 4
add_lines(string = " \r \r\r")
resizing to 4
add_lines(string = "T410% ")
resizing to 4
add_lines(string = ".")
resizing to 4
add_lines(string = ". /etc/shellexrc")
resizing to 4
add_lines(string = "\r\r\n")
resizing to 5
size_change(1440, 69)
size_change(1440, 56)
line_update(row = 0)
resizing to 4
line_update(row = 1)
resizing to 4
line_update(row = 2)
resizing to 4
line_update(row = 3)
resizing to 4
add_lines(string = "%")
resizing to 4
add_lines(string = " \r \r")
resizing to 4
add_lines(string = "\r")
resizing to 4
add_lines(string = "shellex> ")
resizing to 4
line_update(row = 0)
resizing to 1
size_change(1440, 17)
line_update(row = 1)
resizing to 1
line_update(row = 2)
resizing to 1
line_update(row = 3)
resizing to 1
add_lines(string = "\r\r\n")
resizing to 2
size_change(1440, 30)
add_lines(string = "")
resizing to 2
Thanks for the logs, I haven't seen this error before
urxvt: Protocol error: bad 9 (Drawable); Sequence Number 4
Opcode (14, 0) = GetGeometry
Bad resource 0 (0x0)
at /usr/lib/shellex/urxvt/shellex line 83.
And from the logs around, it looks like on_start doesn't get executed to the end (shellex configuration doesn't get loaded, resizing to one line isn't done, the max row file doesn't get written …). And the failure comes from geometry_from_focus.
So this means:
on_startneeds error handling in casegeometry_from_focusfails.- Actually
geometry_from_focusneeds error handling in caseGetGeometryfails. - I'd like to understand why/how
geometry_from_focusfails. - Especially how the failure is related to start from terminal vs. start from shortcut and wayland vs. other window managers.
Questions that come to my mind are:
- Does the behaviour change for you if the workspace is empty vs. if you have a window with focus on the current workspace when executing the shortcut?
- Does the issue disappear when you set
shellex.pos: pointer? (to avoidgeometry_from_focusand usegeometry_from_ptr)
EDIT: added missing word.
- You're right - the error occurs when either the workspace is empty, or I click on the background before starting shellex (the window probably loses focus at this point, although visually nothing changes in sway). If I opened a window (and don't click on the background), or if I have recently run shellex, shellex will run fine (so somehow running shellex and exiting will prevent the error from happening). On the other hand, if I open a terminal emulator and close it, shellex will open in fullscreen.
- I am a noob: Where exactly should I put this line?
Ha, next item for my todo-list improve documentation of the customization. I was thinking about the shellex configuration described here https://github.com/Merovius/shellex#configuration
I assume you have a file ${HOME}/.Xresources (which might set the default size and font of urxvt for you https://wiki.archlinux.org/index.php/x_resources) and this can also contain shellex configuration. So add the line
shellex.pos: pointer
to ${HOME}/.Xresources and either restart the window manager or load the updated configuration with xrdb --merge ${HOME}/.Xresources.
Also, I had the syntax wrong in the post before, it should be a colon : not an equal sign.
Oh, I totally should have seen that in the readme. Shellex starts properly after including shellex.pos = pointer in .Xdefaults and doing xrdb -merge ~/.Xdefaults. So at least there's a workaround :)
Okay, thanks again for reporting and debugging.
With this configuration, can we consider the issue "fixed for you"? I'd like to leave it open until there is a proper fix in geometry_from_focus to prevent this from happening.
I took the liberty to update the title according to our findings, I hope that's okay with you.
With this configuration, can we consider the issue "fixed for you"?
Yes!
The response to the issue was very fast and adept, appreciate it a lot :)