Comments (15)
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.
from ntfy.
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.
Also extensive testing is required, as this is more of a temporary hack rather than a solution.
from ntfy.
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
.
from ntfy.
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 😢
from ntfy.
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
.
from ntfy.
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.
from ntfy.
@zamber But won't you get notified even if the terminal is focused, that way?
from ntfy.
@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.
from ntfy.
I switched to Terminology recently and it appears to not set WINDOWID
either.
from ntfy.
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
from ntfy.
Welp. seems Gnome terminal no longer sets WINDOWID either. gonna play with the xdotool solution.
from ntfy.
Doh. per my previous comment xdotool doesn't work. Not sure how to do this 😢
from ntfy.
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
from ntfy.
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
from ntfy.
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.
from ntfy.
Related Issues (20)
- Allow setting notification timeout as CLI flag HOT 2
- use unittest.mock instead of mock
- No release since 2018? HOT 2
- Base path HOT 1
- emojize() got an unexpected keyword argument 'use_aliases' HOT 4
- Google chat and Signal support
- Not auto starting after reboot
- Can not use shell variable as message HOT 2
- how to uninstall in ubuntu?
- Support python3.11 HOT 1
- feature: support customizing icons depending on the result code
- Ignoring VS Code
- AttributeError: module 'telegram' has no attribute 'notify' HOT 2
- incompatible with python 3.11 HOT 6
- How this works? HOT 1
- use Slixmpp instead of SleekXMPP
- ttl support w/Pushover
- Add end-to-end encryption support to SimplePush
- Commands prefixed by space are still logged in `.bash_history`
- Move AUTO_NTFY_DONE_IGNORE config to the yaml file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ntfy.