Giter Site home page Giter Site logo

nclarius / kwin-application-switcher Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 1.0 4.1 MB

KWin script to raise all windows of an application as a group

Home Page: https://store.kde.org/p/1805105

License: GNU General Public License v3.0

JavaScript 90.75% Shell 9.25%
application group kde kwin kwin-script task-manager task-switcher window window-management window-switcher

kwin-application-switcher's Introduction

I am a software developer and master's student with a background in formal logic and computational linguistics. I

Languages: Python (fluent), C++, QML, JavaScript, bash (working proficiency), Java (native language), Prolog (good in reading, intermediate in writing)

More about me can be found on my personal website.

kwin-application-switcher's People

Contributors

nclarius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

redbearak

kwin-application-switcher's Issues

Inconsistent grouping

@nclarius

I am observing a bit of inconsistency sometimes when switching between applications in my KDE Neon virtual machine. There is a Firefox web browser window, maximized, 3 overlapping Konsole windows, and 3 overlapping Dolphin windows. If one of the other apps is in front and I switch quickly to Dolphin, sometimes only a single Dolphin window shows up. This can happen even if I delay releasing the Alt key for a couple of seconds, until long after the task switcher dialog box finally shows up.

This is without any attempt to use Alt+Grave. Just straight Alt+Tab, release.

I can't get it to happen in any specific way or specific frequency. Wait, no, it happens pretty consistently when the maximized Firefox window is in front, and then I Alt+Tab and hold the Alt key for a while, and the app I'm switching to is right behind the front window (so I'm only hitting Alt+Tab once, then holding Alt).

Seems to happen with far less frequency when quickly switching (i.e., quickly releasing the Alt key). But... sometimes it still happens in that case also.

May just be a quirk of the Boxes VM it's running in. I haven't booted up the MacBook to do more testing there yet. It seemed to respond very reliably on the physical machine.

Watching for a different keyboard shortcut?

@nclarius

Hey, question. I just had a thought, and it's probably a bad one, but would the Kwin script be able to watch for a specific keyboard shortcut, separate from the system keyboard shortcut that triggers the window activation events? Or is the script only capable of watching for the actual window switching/activation events that result from using the system shortcut?

Like, what if I removed the standard keyboard shortcuts from the task switcher settings, and just let the app switcher script entirely take over window switching logic, from beginning to end?

Or would that be stepping completely outside of what Kwin scripting can do?

Interference with other keyboard shortcuts

@nclarius

Alright, I'm seeing the same effect of interference with other keyboard shortcuts on a physical machine as well as the (Boxes/qemu) VM that I was using to test.

The VM was running KDE Neon User Edition, installed just a couple of days ago.

The physical machine is a 2007 white MacBook with Fedora 36 KDE spin freshly installed.

Both machines have Kinto.sh installed to remap the keyboard to act like a Mac, but even with that completely disabled the interference is happening. So I don't think it has anything to do with Kinto or xkeysnail, the Python app it uses to remap the keyboard input.

What I'm seeing:

With the Kwin script disabled, I can reliably trigger things like krunner, the main application launcher menu, and a "search" dropdown that mimics Spotlight from macOS. The shortcuts are:

Ctrl+Shift+Space (KDE app launcher menu)
Alt+Space (krunner)
Alt+F1 (Spotlight search clone widget)

These are the actual shortcuts the widgets are set to use, but with Kinto active they remap to different physical keys on the keyboard.

When I have the Kwin script activated, the success rate for triggering any of these shortcuts falls to around 30-50%. In other words, with the script deactivated I can sit here and hold down Cmd+Shift (on the real MacBook) and hit Space over and over, and the KDE app launcher menu will appear and disappear with 100% reliability. Cmd+Space will activate the Spotlight clone, and hide it. Option(Alt)+Space will reveal krunner.

But once I activate the Kwin script these things will either not activate at all, or I'll see a flash as if it was about to activate, but then it goes away without fully opening.

There doesn't seem to be any corresponding effect on the speed or responsiveness of Alt+Tabbing, even with Kinto remapping physical Cmd+Tab to the Alt+Tab logical shortcut.

I can also go crazy doing shortcuts like Cmd+T (new tabs) and Cmd+N (new window), Cmd+W (close tab/window), and there seems to be no issue with such things.

Working theory: This has something to do with the described shortcuts somehow taking focus away from the current window. In other words, maybe triggering these things that are appearing from the top panel (Whitesur Dark global theme applied) is generating some kind of window activation event.

Yeah, seems to be some sort of window focus problem, because when I use the mouse to access the KDE app launcher menu or the Spotlight clone from their icons on the top bar, I also see an unreliable response to the mouse clicks. As I type in this browser window there is a highlighted border around the text box I'm typing in, and when I click on the icons on the top bar that will flash, and more often than not the focus will immediately return to the browser window rather than opening the item in the top bar.

Other icons in the top bar like clipboard indicator, volume and WiFi icons are exhibiting the same behavior. Seems to be a general problem with the Kwin script not wanting to let windows lose focus to these objects living in the top panel. (If you're using the typical default KDE setup these things will mostly be in your "bottom" panel.)

I haven't even taken a look at the code yet, so I can't offer any specific ideas at the moment as to why this is happening or how to fix it.

Grouping windows from the same Activity

This script works well if all windows of an application are in a single Activity. However, if the same application is running in multiple Activities, they seem to be grouped together even if "Filter windows by" -> "Activites" -> "Current activity" is enabled. The effect of this is that switching to an application with windows opened in different Activities usually jumps to the window in different Activity.

Stops working after closing a window

When opening three Konsole and two Dolphin windows the script works as expected and switches between the two applications in groups. However, after closing one of the Konsole windows, the script does not raise the remaining two Konsole windows together. Only one window is raised when it is activated.

First Alt+Grave after Alt+Tab triggers app switch

@nclarius

I'm observing the behavior when I switch from Alt+Tab to Alt+Grave without releasing Alt in between. Sometimes on the first press of Grave the script brings all windows of the other app forward. But other times it only brings one. Subsequent presses of the Grave key while holding Alt do not bring any other windows forward until I finally release Alt.

Seems like the task switcher is producing a window activation event when Grave is pressed the first time, but not after that.

Just leaving this here in case someone can figure out a way to ignore that first Grave key press after Alt+Tab and somehow make the single-window selection work.

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.