Skip to content

Update main.js for each script type to use Plasma 6 API changes #29

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
10 changes: 5 additions & 5 deletions always-open-on-active-screen/contents/code/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config = {
debug("config:", config.allowMode ? "allow" : "deny", "list", config.classList);

// when a window is added
workspace.clientAdded.connect(window => {
workspace.windowAdded.connect(window => {
debug("window", JSON.stringify(window, undefined, 2));

// get active screen
Expand All @@ -42,8 +42,8 @@ workspace.clientAdded.connect(window => {

// clip and move window into bounds of screen dimensions
const area = workspace.clientArea(KWin.MaximizeArea, window);
window.geometry.width = Math.min(area.width, window.width);
window.geometry.height = Math.min(area.height, window.height);
window.geometry.x = Math.max(area.x, Math.min(area.x + area.width - window.width, window.x));
window.geometry.y = Math.max(area.y, Math.min(area.y + area.height - window.height, window.y));
window.frameGeometry.width = Math.min(area.width, window.width);
window.frameGeometry.height = Math.min(area.height, window.height);
window.frameGeometry.x = Math.max(area.x, Math.min(area.x + area.width - window.width, window.x));
window.frameGeometry.y = Math.max(area.y, Math.min(area.y + area.height - window.height, window.y));
});
Binary file not shown.
10 changes: 5 additions & 5 deletions always-open-on-focused-screen/contents/code/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ workspace.clientActivated.connect(window => {
});

// when a window is added
workspace.clientAdded.connect(window => {
workspace.windowAdded.connect(window => {
debug("window", JSON.stringify(window, undefined, 2));

// abort conditions
Expand All @@ -47,8 +47,8 @@ workspace.clientAdded.connect(window => {

// clip and move window into bounds of screen dimensions
const area = workspace.clientArea(KWin.MaximizeArea, window);
window.geometry.width = Math.min(area.width, window.width);
window.geometry.height = Math.min(area.height, window.height);
window.geometry.x = Math.max(area.x, Math.min(area.x + area.width - window.width, window.x));
window.geometry.y = Math.max(area.y, Math.min(area.y + area.height - window.height, window.y));
window.frameGeometry.width = Math.min(area.width, window.width);
window.frameGeometry.height = Math.min(area.height, window.height);
window.frameGeometry.x = Math.max(area.x, Math.min(area.x + area.width - window.width, window.x));
window.frameGeometry.y = Math.max(area.y, Math.min(area.y + area.height - window.height, window.y));
});
Binary file not shown.
10 changes: 5 additions & 5 deletions always-open-on-primary-screen/contents/code/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const config = {
var primaryScreen = 0;

// when a window is added
workspace.clientAdded.connect(window => {
workspace.windowAdded.connect(window => {
debug("window", JSON.stringify(window, undefined, 2));

// abort conditions
Expand All @@ -42,8 +42,8 @@ workspace.clientAdded.connect(window => {

// clip and move window into bounds of screen dimensions
const area = workspace.clientArea(KWin.MaximizeArea, window);
window.geometry.width = Math.min(area.width, window.width);
window.geometry.height = Math.min(area.height, window.height);
window.geometry.x = Math.max(area.x, Math.min(area.x + area.width - window.width, window.x));
window.geometry.y = Math.max(area.y, Math.min(area.y + area.height - window.height, window.y));
window.frameGeometry.width = Math.min(area.width, window.width);
window.frameGeometry.height = Math.min(area.height, window.height);
window.frameGeometry.x = Math.max(area.x, Math.min(area.x + area.width - window.width, window.x));
window.frameGeometry.y = Math.max(area.y, Math.min(area.y + area.height - window.height, window.y));
});