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

Feature Request: webview persistence control #359

Closed
ontipto opened this issue Feb 1, 2023 · 9 comments
Closed

Feature Request: webview persistence control #359

ontipto opened this issue Feb 1, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ontipto
Copy link

ontipto commented Feb 1, 2023

When using a webview, the page stays open when hidden, but reloads when redisplayed. If this could be controlled via an action attribute, persistence and background resources could be tailored to the page.

E.g., when displaying a music website, staying open works great for streaming. But, it's interrupted on redisplay as the page reloads. On a complex page, significant resources can be used even when hidden.

If the persistence and load-on-display could be controlled via something like webviewpersistent=true to only load at initial display and stay open when hidden, and =false to close the page when hidden and reload on display, these two cases would be more useful.

@melonamin melonamin self-assigned this Feb 1, 2023
@melonamin melonamin added the enhancement New feature or request label Feb 1, 2023
@melonamin melonamin added this to the 2.0 milestone Feb 1, 2023
@melonamin
Copy link
Contributor

Great idea, thanks.

I made it persistent by default and now existing refreshOnOpen parameter can be used with webview plugin as well.
While I was at it I made this view detachable as well #374

@ontipto
Copy link
Author

ontipto commented Apr 23, 2023

Excellent - thanks! Looking forward to v2.

@ontipto
Copy link
Author

ontipto commented Sep 24, 2023

Tried this using:

webviewpersistent=false
webviewPersistent=false

yet I still see a process in Activity Monitor for the page after first opened; was expecting SwiftBar webviews to act like Safari tabs, where when they're closed, all resources released.

Let me know if I have the param or expectations wrong.

Thanks - exciting to see the first 2.0.0 drop!

@chew-z
Copy link

chew-z commented Sep 27, 2023

I made it persistent by default

This should be clearly marked as breaking change as it breaks logic of multiple plugins...

I used to display on click graphs in webview. No I am getting the same graph over and over again.

@chew-z
Copy link

chew-z commented Sep 27, 2023

Let me re-phrase...

<swiftbar.refreshOnOpen>true</swiftbar.refreshOnOpen> forces plugin to update on click but in my case it makes several network calls which makes plugin seem not responsive.

Still it makes webview display the same graph on each line. I need to refresh plugin again to see another graph.

I would like to not force plugin refresh and be able to see separate graph on each line.

So I suggest using separate parameter for refreshing plugin and for refreshing webview. That would allow for flexible control of plugin's behavior.

@melonamin melonamin reopened this Sep 27, 2023
@x-f
Copy link

x-f commented Dec 15, 2023

I have the same issue as @chew-z - I don't want to refresh the plugin on every click (scheduling suits better), but I want the page in webview to reload on click, otherwise I'm seeing the same old content every time I click on the icon. I have a time-related Javascript there.

"webviewpersistent=true|false" is not available as a parameter.
I have to revert back to v1.5.0.

melonamin added a commit that referenced this issue Dec 29, 2023
Signed-off-by: Alex Mazanov <alexandr.mazanov@gmail.com>
@melonamin
Copy link
Contributor

@chew-z and @x-f thanks for your input, this approach makes sense to me.

Updated as follows:

  • Added new plugin parameter #<swiftbar.persistentWebView>true</swiftbar.persistentWebView>, if set to true the web view will not refresh on menu open. Defaults to false (i.e. web view refreshes on each open)
  • If persistentWebView = false then web view process is explicitly killed and not hanging in background

Web view will always refresh when Plugin refreshes, either on schedule or manually.

@ontipto
Copy link
Author

ontipto commented Jan 1, 2024

persistentWebView = false works great re: killed web view process, but only when menu is detached then clicked outside of.

Also, all detached web view windows close on desktop click, even when persistentWebView = true (process persists in latter case 👍). Should stay open unless explicitly closed, regardless of persistentWebView?

@melonamin
Copy link
Contributor

all detached web view windows close on desktop click

This is a bug, oppened an issue #397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants