-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag the top window on current screen, not the active window. #8
Comments
Currently, the widget uses Someone will have to take a look at what Latte does and try porting that here if possible. |
Found a way do do this, with a KWin Script (Plasma 6 only). Please ignore the lag, looks like recording two monitors was too much for my IGPU 😆 demo.mp4
This will also benefit all other kwin shortcuts that do things with the active window 🥳 It's not yet integrated with the widget code but you can be tested by running a script with the following (update the SCRIPT path):
#!/bin/env bash
# load the script
echo "running"
SCRIPT="/home/luis/projects/plasma-panel-spacer-extended/moveTopWindow.js"
SCRIPT_NAME="moveTopWindow"
qdbus org.kde.KWin /Scripting org.kde.kwin.Scripting.unloadScript "$SCRIPT_NAME"
script_id=$(qdbus org.kde.KWin /Scripting org.kde.kwin.Scripting.loadScript "${SCRIPT}" "$SCRIPT_NAME")
# run
qdbus org.kde.KWin /Scripting/Script"$script_id" org.kde.kwin.Script.run
sleep 1
qdbus org.kde.KWin /Scripting/Script"$script_id" org.kde.kwin.Script.stop
const windows = workspace.windowList();
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
var windowToMove
let stackOrder = -1
var currentScreen = workspace.screenAt(workspace.cursorPos)
for (var i = 0; i < windows.length; i++) {
if (windows[i].output === currentScreen && !windows[i].desktopWindow && windows[i].normalWindow && !windows[i].minimized && windows[i].moveable && !windows[i].hidden) {
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
print(windows[i].caption);
print(windows[i].resourceName);
print(windows[i].resourceClass);
print(windows[i].stackingOrder);
if (windows[i].stackingOrder > stackOrder) {
windowToMove = windows[i]
}
stackOrder = windows[i].stackingOrder
}
}
resut = ("Dragging: " + windowToMove.caption + "|" + windowToMove.resourceName + "|" + windowToMove.resourceClass + "|" + windowToMove.stackingOrder + "|" + windowToMove.output.name)
print("MOVE")
print(resut)
workspace.activeWindow = windowToMove
workspace.slotWindowMove()
callDBus("org.kde.plasmashell", "/org/kde/osdService", "org.kde.osdService", "showText", "window", resut); |
Will publish a release with #19 tomorrow. For dragging the top window I have a working version already, just need to also activate the top window for all the other shortcuts that need it (e.g. close window and many others) |
This should now work on main with the following shortcuts:
|
It works great! Perfect replacement for Latte-Dock and great for replicating the Gnome/Unity top bar behavior! |
One issue with this approach is that if you have a window pinned to top, it will always grab that window. I'm not sure this can be solved with a script only plasmoid though, it would have to involve writing C++ code. |
Hmmm maybe I could:
|
This is a behavior of latte dock. KDE's new global menu widget also only shows the menu for the active window for the current display, not the menu for the active window on some other display. So tracking by display should in theory be doable.
The text was updated successfully, but these errors were encountered: