Skip to content
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

Move desktop options to desktop module and add desktop widgets option #332

Merged

Conversation

HeitorAugustoLN
Copy link
Member

@HeitorAugustoLN HeitorAugustoLN commented Aug 20, 2024

Help would be really appreciated.

Desktop widgets use basically the same API as panel widgets, so widgets lib can be reused, but they need to have position and size set in ItemGeometries and ItemGeometriesHorizontal with their respective IDs, so we will have to adapt it.

@HeitorAugustoLN
Copy link
Member Author

set ItemGeometries and ItemGeometriesHorizontal

Using a fork of panel widgets lib for desktop widgets would be the best solution I think

@HeitorAugustoLN HeitorAugustoLN added 0. type: enhancement New feature or request for feature 1. scope: workspaces Related to workspaces module 3. status: work in progress Still being worked on 1. scope: widgets Related to widget-specific modules labels Aug 20, 2024
@HeitorAugustoLN
Copy link
Member Author

HeitorAugustoLN commented Aug 20, 2024

Example script for desktop widget:

let allDesktops = desktops();

for (let i = 0; i < allDesktops.length; i++) {
  let desktop = allDesktops[i];

  // Add the widget to the desktop
  // x = horizontal pos
  // y = vertical pos
  // w = width
  // h = height
  let widget = desktop.addWidget("org.kde.plasma.digitalclock", x, y, w, h);

}

@HeitorAugustoLN
Copy link
Member Author

I will continue working on this tomorrow, and I think I can finish it by then.

@HeitorAugustoLN HeitorAugustoLN marked this pull request as ready for review August 21, 2024 12:35
@HeitorAugustoLN
Copy link
Member Author

This is good to go now, hasWidget function needs an update, and widget specific options can be refactored to work on desktop without interfering with panel widgets using the desktopConvert

@HeitorAugustoLN
Copy link
Member Author

HeitorAugustoLN commented Aug 21, 2024

Tested with:

programs.plasma.workspace.desktop.widgets = [
  {
    name = "org.kde.plasma.digitalclock";
    position = { horizontal = 51; vertical = 100; };
    size = { width = 250; height = 250; };
    config.Appearance.showDate = false;
  }
  {
    name = "plasmusic-toolbar";
    position = { horizontal = 51; vertical = 300; };
    size = { width = 250; height = 400; };
    config.General.desktopWidgetBg = 4;
  }
];

@magnouvean
Copy link
Collaborator

Yeah I think that makes sense to do

@HeitorAugustoLN HeitorAugustoLN changed the title Add desktop widgets option Move desktop options to desktop module and add desktop widgets option Aug 21, 2024
@HeitorAugustoLN HeitorAugustoLN added 4. has: plasma module (new) New plasma module 4. has: plasma module (update) Updates plasma module 4. has: plasma widget module (update) Updates plasma widget-specific module and removed 3. status: work in progress Still being worked on labels Aug 21, 2024
@HeitorAugustoLN
Copy link
Member Author

I think this PR is good to merge, I will just wait for you to test. From my testing it is working perfectly fine.

It is not necessary apparently
@magnouvean
Copy link
Collaborator

Looks good. I'll test on saturday probably :)

@HeitorAugustoLN
Copy link
Member Author

I've noticed that desktop widgets can be misplaced sometimes on startup. But that is a plasma issue, since it happened sometimes when I was testing the script with plasma-interactiveconsole before using it here.

@HeitorAugustoLN
Copy link
Member Author

It actually places in the right place, but jump to a random place after it.

Copy link
Collaborator

@magnouvean magnouvean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested a bit and this looks good, very impressive! I'll let you merge if you for some reason want to make some more adjustments, but all looks good to me :)

@HeitorAugustoLN
Copy link
Member Author

I've tested a bit and this looks good, very impressive! I'll let you merge if you for some reason want to make some more adjustments, but all looks good to me :)

Thanks for testing!

@HeitorAugustoLN HeitorAugustoLN merged commit 311435f into nix-community:trunk Aug 24, 2024
1 check passed
@HeitorAugustoLN HeitorAugustoLN deleted the desktop-widgets-v2 branch August 24, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. type: enhancement New feature or request for feature 1. scope: widgets Related to widget-specific modules 1. scope: workspaces Related to workspaces module 4. has: plasma module (new) New plasma module 4. has: plasma module (update) Updates plasma module 4. has: plasma widget module (update) Updates plasma widget-specific module 5. approvals: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants