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

Does not work with guake terminal #77

Open
ojhaujjwal opened this issue Aug 27, 2016 · 15 comments
Open

Does not work with guake terminal #77

ojhaujjwal opened this issue Aug 27, 2016 · 15 comments
Assignees
Labels

Comments

@ojhaujjwal
Copy link

It works very nicely on normal terminal but, I get an error on guake terminal.
image

@nmaggioni
Copy link

It appears that not every terminal sets the WINDOWID environment variable.
Terminator and gnome-terminal, for example, set it correctly, while Guake and Terminix do not.

@nmaggioni
Copy link

I came up with a raw solution based on xdotool, but I don't know if it is in line with @dschep's thoughts; relying on external binaries is not always a welcome choice, especially if such binaries are not installed by default on most systems.

xdotool_patch.txt

Also extensive testing is required, as this is more of a temporary hack rather than a solution.

@dschep
Copy link
Owner

dschep commented Aug 28, 2016

Hmm, yeah I've seen other tools that do this sort of thing using xdotool. I'd prefer not having additional dependencies, but I wouldn't be opposed to using it if available, and falling back to $WINDOWID.

@dschep
Copy link
Owner

dschep commented Aug 28, 2016

Hrmm.. actually, isn't xdotoo getactivewindow the same as the xprop command ntfy uses? WINDOWID is the ID of the window the command is running in, regardless of focus. Good to know that there's an issue with Guake & Gnome-Terminal, but I'm afraid xdotool isn't the answer 😢

@dschep dschep added the bug label Aug 28, 2016
@nmaggioni
Copy link

In theory both refer to the same attribute, but with the said terminals I've only managed to get a WindowID by using xdotool... There's probably another attribute hidden somewhere in /proc.

@zamber
Copy link

zamber commented Sep 2, 2016

Hit the same issue. Solved it by returning False from is_focused(). Will see how that turns out for me ;). On a side note, having that configurable in .config would make things easier for other potentially deficient terminals.

@nmaggioni
Copy link

@zamber But won't you get notified even if the terminal is focused, that way?

@dschep
Copy link
Owner

dschep commented Sep 2, 2016

@zamber hmm yeah, I should make the ntfy done --background-only and ntfy shell-integration --foreground-too options configurable via the config file.

@nmaggioni yup.

@sethwoodworth
Copy link

I switched to Terminology recently and it appears to not set WINDOWID either.

@pmav99
Copy link
Contributor

pmav99 commented Jan 5, 2017

The last version of terminator does not set $WINDOWID either

$ pacman -Qi terminator
Name            : terminator
Version         : 1.90-1

Perhaps, this could be of help?
http://stackoverflow.com/questions/2250757/is-there-a-linux-command-to-determine-the-window-ids-associated-with-a-given-pro

@dschep dschep closed this as completed in 5c2128e Jan 11, 2017
dschep added a commit that referenced this issue Jan 11, 2017
Fix #77 - Stop throwing exceptions if $WINDOWID has not been set.
@dschep
Copy link
Owner

dschep commented May 31, 2018

Welp. seems Gnome terminal no longer sets WINDOWID either. gonna play with the xdotool solution.

@dschep dschep reopened this May 31, 2018
@dschep dschep self-assigned this May 31, 2018
@dschep
Copy link
Owner

dschep commented May 31, 2018

Doh. per my previous comment xdotool doesn't work. Not sure how to do this 😢

@dschep
Copy link
Owner

dschep commented May 31, 2018

Potential fix for getting the terminals WINDOWID

wmctrl -lp | grep $PPID # but in python and recursively since ntfy/python's ppid is bash

still not great bc gnome-terminal for example has many windows for the same pid

@pmav99
Copy link
Contributor

pmav99 commented Jun 1, 2018

I just installed guake

$ guake
Guake not running, starting it
Guake Terminal 3.2.1
VTE 0.50.2
Gtk 3.22.29
System doesn't support transparency
can't bind show-focus key

and xdotool seems to work...

$ xdotool getactivewindow
33554447

$ xdotool getmouselocation --shell | grep WINDOW
WINDOW=33554447

@dschep
Copy link
Owner

dschep commented Jun 1, 2018

Right. but isn't xdotool getactivewindow the equivalent of xprop -root '\t$0' _NET_ACTIVE_WINDOW? Ie: it gets the current active window. WINDOWID is window ID of the terminal that ntfy is running in. Its needed because to determine focus you have to compare the current window id with ntfy's terminal's window id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants