Comments (8)
This may seem like a nice feature, but the core essence of the alttab user experience is interactivity: it must render a dialog in approximately 30 milliseconds to be perceived as "immediate." Calling external programs could potentially undermine this critical feature. Since alttab has no control over external programs, it must not only perform numerous security and sanity checks and handle errors but also implement a timeout for waiting for input. Then arises the question: what should alttab do when the timeout elapses? Should it suddenly display all windows or none at all?
Instead, I suggest the following: the external program should prepare the window list in advance and place it into X objects, for example, by adding a window class or another property indicating "include this window in the list."
By the way, there is already a standard property that makes alttab skip a window: _NET_WM_STATE_SKIP_TASKBAR.
from alttab.
it must render a dialog in approximately 30 milliseconds to be perceived as "immediate."
30 ms for calling a single process seems totally in the realm of possibility. Besides, this is an opt-in feature, the user should have an understanding that they are now responsible for the performance of alttab.
Since alttab has no control over external programs, it must not only perform numerous security and sanity checks
Not sure why this would be the case, the user controls the callback. Configuring a callback like that is typical in many programms for example i3, restic and git from the top of my mind. If a malicious actor can control the invocation of alttab, e.g. -window_list_command 'malicious_command'
they would probably also have enough permissions to directly call malicious_command
directly.
handle errors but also implement a timeout for waiting for input. Then arises the question: what should alttab do when the timeout elapses? Should it suddenly display all windows or none at all?
I would generally start with the simplest approach. Any error is non-recoverable (current invocation is skipped, error is logged in stderr), timeouts are the fault of the user.
Instead, I suggest the following: the external program should prepare the window list in advance and place it into X objects, for example, by adding a window class or another property indicating "include this window in the list."
Sure, that's also an option. It's also possible to accept window lists from stdin, e.g. in a jsonlines format. Downside is that the said program will need to always produce list of windows and react to events. Synchronization can also be a problem here as alttab might be called before the user program responds to new events that alter the window list.
from alttab.
Users might download and execute a dubious script as a "callback," subsequently attributing any perceived sluggishness or unreliability to alttab.
Furthermore, should alttab be exploited, the capability to launch an arbitrary program could exacerbate the situation.
Additionally, if the "callback" itself is compromised or malicious from the outset, it may attempt to exploit alttab by stuffing it with harmful input.
The interaction with external programs expands the attack surface and necessitates security precautions. However, this problem isn't major.
The major problem is unpredictable delays caused by synchronous input. Alttab is designed to monitor various X11 events, maintaining a partially pre-constructed list to avoid the inefficiency of assembling everything at the moment the Alt-Tab keys are pressed.
A simple script might fail or lag in numerous edge cases, which might not be immediately apparent.
The only solution is asynchronous input: alttab should never be in a position where it is awaiting input. It needs to have instant access to at least some list at any given time. Contributions or patches that facilitate such a solution are welcomed.
from alttab.
The only solution is asynchronous input: alttab should never be in a position where it is awaiting input. It needs to have instant access to at least some list at any given time. Contributions or patches that facilitate such a solution are welcomed.
So, to make sure we have the same understanding, the patch will modify alttab in the following way:
- Accept a new, disabled by default, flag that enables the new behavior
- When Alt-Tab is pressed, display only windows that have the
ALTTAB_INCLUDE_WINDOW
property - Related docs
from alttab.
Yes, such approach seems ok.
For alttab, the only justification for being small is being fast and reliable. If it's small AND slow or unreliable, it wouldn't be worth a penny.
from alttab.
Actually, after some thought, one could achieve everything by setting the _NET_WM_STATE_SKIP_TASKBAR
atom on the windows they'd like to hide and remove it from all others. So, it's somewhat possible, with the caveat that _NET_WM_STATE_SKIP_TASKBAR
might already be set by the window for other reasons.
However, i found a bug that prevents that approach: #160
from alttab.
Actually, after some thought, one could achieve everything by setting the
_NET_WM_STATE_SKIP_TASKBAR
atom on the windows they'd like to hide and remove it from all others. So, it's somewhat possible, with the caveat that_NET_WM_STATE_SKIP_TASKBAR
might already be set by the window for other reasons.However, i found a bug that prevents that approach: #160
The one added benefit of a new flag is that it would be possible to have for example multiple different instances of alttab that have different filters.
For example: super+grave to switch between instances of the same class and alt+tab to switch between the focused windows of each workspace.
That could be implemented by providing the name of the property alttab needs to check in each window. For example, alttab -mk Super_L -kk grave -f FOCUSED_CLASS
and alttab -f FOCUSED_WORKSPACE
from alttab.
This seems like a valid idea.
from alttab.
Related Issues (20)
- Some windows forever lost if they have _NET_WM_STATE_SKIP_TASKBAR property HOT 12
- MacOS Ventura Stage Manager Windows Appear Tilted HOT 1
- X11 HOT 3
- bottomline (-b) option is 0 indexed HOT 6
- Many useless windows appear HOT 1
- DWM autostart HOT 4
- Not raising windows? (Qtile) HOT 7
- Unclear -d option usage HOT 8
- Just show whole tab while user is picking which tab to choose HOT 1
- `_NET_WM_STATE_SKIP_TASKBAR` atom not detected if `_NET_WM_STATE` contains more than one atoms HOT 3
- Enhancement: Immediately focus window before alttab exits HOT 3
- alttab man page on OpenBSD should go to other dir HOT 1
- i3wm cannot cancel select HOT 2
- big bug, the -b argument cannot right to i3wm workspace number HOT 3
- and when i want to switch workspace on i3wm, than it cannot show software on the current workspace HOT 5
- how can cancel switch item, the issus ,is closed, it not fixed HOT 1
- some font it not show HOT 3
- some software cannot show icon with using appimage format file HOT 12
- transparency? how? HOT 5
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 alttab.