mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
kwin/scripts: Add convergentwindows and switch from kwin maximized mode
This commit is contained in:
parent
e118946397
commit
987b280f12
5 changed files with 69 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ add_subdirectory(components)
|
|||
add_subdirectory(quicksettings)
|
||||
add_subdirectory(kcms)
|
||||
add_subdirectory(kded)
|
||||
add_subdirectory(kwin)
|
||||
|
||||
find_program(PlasmaOpenSettings plasma-open-settings)
|
||||
set_package_properties(PlasmaOpenSettings PROPERTIES
|
||||
|
|
|
|||
1
kwin/CMakeLists.txt
Normal file
1
kwin/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory(scripts)
|
||||
10
kwin/scripts/CMakeLists.txt
Normal file
10
kwin/scripts/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function(add_kwin_script name)
|
||||
kpackage_install_package(${name} ${name} scripts kwin)
|
||||
|
||||
# Copy the script to the build directory so one can run tests without prior
|
||||
# make install. FIXME: use add_custom_command.
|
||||
file(COPY ${name} DESTINATION ${CMAKE_BINARY_DIR}/bin/kwin/scripts/)
|
||||
endfunction()
|
||||
|
||||
add_kwin_script(convergentwindows)
|
||||
|
||||
33
kwin/scripts/convergentwindows/contents/code/main.js
Normal file
33
kwin/scripts/convergentwindows/contents/code/main.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// SPDX-FileCopyrightText: 2023 Plata Hill <plata.hill@kdemail.net>
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
function run(client) {
|
||||
if (client.screen === 0) {
|
||||
client.setMaximize(true, true);
|
||||
client.noBorder = true;
|
||||
} else {
|
||||
client.noBorder = false;
|
||||
}
|
||||
}
|
||||
|
||||
workspace.clientAdded.connect((client) => {
|
||||
if (client.normalWindow) {
|
||||
client.clientFinishUserMovedResized.connect((client) => {
|
||||
run(client);
|
||||
});
|
||||
run(client);
|
||||
}
|
||||
});
|
||||
|
||||
// Windows are moved from the external screen
|
||||
// to the internal screen if the external screen
|
||||
// is disconnected.
|
||||
workspace.numberScreensChanged.connect((count) => {
|
||||
const clients = workspace.clientList();
|
||||
|
||||
for (var i = 0; i < clients.length; i++) {
|
||||
if (clients[i].normalWindow) {
|
||||
run(clients[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
24
kwin/scripts/convergentwindows/metadata.json
Normal file
24
kwin/scripts/convergentwindows/metadata.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"KPlugin": {
|
||||
"Name": "Convergent Windows",
|
||||
"Description": "Removes window decorations and maximizes windows on the first screen only.",
|
||||
"Icon": "preferences-system-windows",
|
||||
|
||||
"Authors": [
|
||||
{
|
||||
"Email": "plata.hill@kdemail.net",
|
||||
"Name": "Plata Hill"
|
||||
}
|
||||
],
|
||||
"Id": "convergentwindows",
|
||||
"ServiceTypes": [
|
||||
"KWin/Script"
|
||||
],
|
||||
"Version": "1.0",
|
||||
"Licsense": "LGPL-2.1-or-later",
|
||||
"Website": "https://invent.kde.org/plata/convergentwindows"
|
||||
},
|
||||
"X-Plasma-API": "javascript",
|
||||
"X-Plasma-MainScript": "code/main.js"
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue