Giter Club home page Giter Club logo

Comments (10)

veyxov avatar veyxov commented on July 21, 2024 5

I quickly put together a rough draft.

It uses swaymsg for getting information about windows (wayland/sway) which also shows which windows is focused. I searched, but it seems there is no universal way to get this information in wayland, so this only works in sway.

Sends a request to change the layer to the current window name.

Needs significant improvements, for example switch to the default layer, if current window is not in the list of application-specific layers.

Here is the code: https://github.com/veyxov/qanata (sorry for the name 😅)

Updates:
Saw the xremap implementation for sway, it looks a lot cleaner. Maybe I can integrate some parts from that.
Now using swayipc to get the window name.

from kanata.

Aqaao avatar Aqaao commented on July 21, 2024 3

I use SetWinEventHook implemented a simple tool in windows: kanawin.
This is my first code with rust. I referenced ChatGPT and komokana.
This might help a little.

from kanata.

reidprichard avatar reidprichard commented on July 21, 2024 3

Wow, would you believe that timing! I just finished my own daemon to interact with Kanata's TCP server. I guess it's pretty similar to kanawin with a few pros and cons.

Cons

  • It's not Rust :(
  • Looping is less efficient than using the Windows event hook (but I've yet to see it break 0% CPU usage in Task Manager)
  • No pattern matching for mapping applications to layers

Pros

  • For those of us with Rust skill issues, C isn't bad!
  • No config file needed. You open firefox.exe, layer "firefox" is activated.
  • Additional utility "window_manager" allows you to use hotkeys to save and activate windows. Always find yourself searching for that one browser window? Bind it to a hotkey and refocus it later with a single button press.
  • No dependencies
  • Doesn't need to run as administrator

While it's still a work in progress, it's 100% working on my end. I'd love feedback if anyone gives it a try!

Logo

Window Tools

https://github.com/reidprichard/window_tools

from kanata.

jtroo avatar jtroo commented on July 21, 2024 2

For ease of discovery:

  • Windows has the komokana project that integrates with kanata's TCP server
  • Linux has no fancy solution, but as 13minutes-yt said, xdotool could be one way to do this

from kanata.

13minutes-yt avatar 13minutes-yt commented on July 21, 2024 1

Just a thought. I have been using Espanso as a text expander and noticed they have application aware triggers.
Can't a crate be used in kanata for that purpose?
https://github.com/espanso/espanso/search?q=Appinfo

from kanata.

jtroo avatar jtroo commented on July 21, 2024 1

Yep, that's a good reference to use if one were to implement this in kanata.

https://github.com/espanso/espanso/tree/9f82b4e146e6090897c876a02f5eee697b85e979/espanso-info

from kanata.

13minutes-yt avatar 13minutes-yt commented on July 21, 2024

Is tcp server needed? In linux xdotool can get the activewindow
xdotool getactivewindow getwindowclassname
and xdotool can also simulate keystroke movements( based on result of getactivewindow)
xdotool keydown n (can be used to switch to layer)

from kanata.

jtroo avatar jtroo commented on July 21, 2024

The TCP server is not necessary for this particular feature as you've shown. There can be workarounds that don't involve inter-process communication.

However, the TCP server is nice to have for software integrations.

from kanata.

gerhard-h avatar gerhard-h commented on July 21, 2024

espanso offers similar features than autohotkey hotstrings, and similar to ahk hotstrings espanso won't work while kanata is running (at least on windows).

But if we could tell espanso to listen to the kanata ouput instead of the real keyboard it should work?
Is the kanata tcp server the right thing to use to make espanso listen to it?

from kanata.

jtroo avatar jtroo commented on July 21, 2024

I think it makes sense to convert this to a discussion instead of an open issue. With the TCP server it makes more sense to me to keep the functionality outside of kanata.

I also now added links to the community projects

from kanata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.