Comments (5)
I looked at this some today and believe I ran into an issue related this comment about a "kinda hacky" solution:
https://github.com/edzdez/sway-easyfocus/blob/main/src/ui.rs#L28
The way I understand the current code, the Sway windows are iterated over in a fixed order and the Easy Focus window labels are also assigned in a fixed order: Starting with "a" and extending through the alphabet.
To find which window to focus, it's assumed that the letter of the alphabets corresponds to the order of the Sway window nodes, so the letter can be used as an index of sorts. That assumption would break if random letter orders is allowed.
Looking deeper, it appears that one "GTK window" is used per-output currently, so there is only listener per keyboard events per output currently.
A proposed solution is to render one GTK overlay window per Sway "window node". I believe this would enable defining unique keyboard listener per GTK window. These listeners could defined using a closure where Sway's "window node id" can be captured and used to call the function to focus the window.
If I've understanding things correctly, this would solve the problem if the letters pressed being bound to the order of the windows. Also, it would support more than one letter per window-- setting the foundation of supporting more than 26 windows as well.
from sway-easyfocus.
Your understanding of the current code is indeed correct. Additionally, our solution seems like it may work, but I'm not sure if it's possible for multiple Gtk windows to listen for keypresses simultaneously (rather than only the one focused GtkWindow, as it is right now).
Unfortunately, I'm a bit busy this week so I don't think I'll be able to make progress on this immediately, but if you're interested, I'm open to PRs!
from sway-easyfocus.
According to Google Bard, there are a couple options to register a single global keyboard event handler, which could then contain a dispatch table which maps specific keypresses to corresponding window IDs.
from sway-easyfocus.
Fixed by #16
from sway-easyfocus.
Thank you for fixing this!
from sway-easyfocus.
Related Issues (10)
- draws labels at the wrong location when outputs aren't located at 0,0
- draws a label on the screen even when there aren't any windows in the workspace
- floating windows aren't given a label HOT 2
- labels are drawn wrong in the stacked layout HOT 1
- [Feature] multi-monitor support HOT 2
- [Feature] Config File HOT 1
- allow window / font-size adjustment.
- wish: highlight current window HOT 2
- Feature request: Add visual feedback of the just-focused window HOT 1
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 sway-easyfocus.