-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
webview popover #261
Comments
Very nice. how would this Will this support a local html file? I was thinking Swiftbar aggregates the data, and then writes it out to html file in a display format of your choice. |
Exactly the same, you can put local file url like Here is a test build, if you want to give it a try SwiftBar.app.zip |
It looks like when you attach a webview to the menubar display, it blocks the click triggering the dropdown of other information. Can you display on mouseover rather than click? |
Try using the right click! |
Right click is a little hidden, as we always accessed via left click, but if mousover is difficult, I am more than happy to have this functionality. I was trying to write out to the plugin directory in node. Successful with hardcoded path, but having trouble accessing ENV variable const fs = require('fs');
const writefile = (data, filename="") => {
if (!filename) {
filename = `/Users/scottrhamy/Documents/Shared/Application Settings/Swiftbar/plugins/BTC Holdings/index.html`; // works
//filename = `${SWIFTBAR_PLUGIN_PATH}/index.html` // breaks
}
fs.writeFile(filename, data, (err) => {
if (err) {
console.log(err);
}
});
}
let html = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title></title>
<link rel="stylesheet" href="../base.css">
</head>
<body>
Hello, world!
</body>
</html>`
writefile(html) |
It fails because |
As for right title - it was there since the beginning, and it was in BitBar forever. It is a common pattern for other menu bar items on the Mac as well. Mouse over is not difficult to implement, it is prone to accidental activation which will be annoying. |
Now that you have explained it, I agree mouseover would be annoying. Accessing any ENV variables in node causes plug-in to disappear. No warning icon on menubar, no warnings in console. Anywhere else to look for logs? |
SwiftBar is running but plugin disappears from the menu bar? One potential reason for that - SwiftBar would hide plugin if it produces empty output You can check Debug View, see this comment |
Minimal reproducible Node example: #!/usr/bin/env /usr/local/bin/node
// <bitbar.title>Erroring in Node</bitbar.title>
// <bitbar.version>v1.0</bitbar.version>
// <bitbar.author>Scott Rhamy</bitbar.author>
// <bitbar.author.github>cycle4passion</bitbar.author.github>
// <bitbar.desc></bitbar.desc>
// <bitbar.image></bitbar.image>
// <bitbar.dependencies>node - https://nodejs.org/en/download/</bitbar.dependencies>
// <bitbar.abouturl></bitbar.abouturl>
// </swiftbar.environment>
// <swiftbar.runInBash>false</swiftbar.runInBash>
(async () => {
console.log(`SWIFTBAR_VERSION: ${SWIFTBAR_VERSION}`);
console.log(`---`);
})(); |
This is not how you access env variables in node.js, do this: console.log(`SWIFTBAR_VERSION: ${process.env.SWIFTBAR_VERSION}`); |
I have been playing around with more... I pointed Swiftbar at:
it failed. I dropped it into the browser URL, and it worked. Noticed it appropriately URIencoded it
Maybe consider URIencode() on the swiftbar side so people can copy path from finder/explorer and use it with spaces. |
Added |
Not sure that the URLencode enhancement is working `Australia 391 | href=file:///Users/andrew/Library/Application%20Support/SwiftBar/Plugins/testcricket.5m.py/innings_1.html webview=true webvieww=650 webviewh=800 Australia 391 | href=file:///Users/andrew/Library/Application Support/SwiftBar/Plugins/testcricket.5m.py/innings_1.html webview=true webvieww=650 webviewh=800 The first of these works but the second doesn't |
@arohl SwiftBar line parameters must be quoted, it should be like this: The change I made above wasnt't about URL encoding, but rather alowing for local file URLs. |
That still didn't work for me worked but |
Interesting, can you share the plugin with me? Because this works just as expected for me: #!/bin/bash
echo ":house:| href='/Users/alex/Downloads/swiftbar website master/docs/index.html' webview=true webvieww=720 webviewh=400"
echo "---"
echo "My link| href=''" |
My python code is
and I have attached the datafile to go in the SWIFTBAR_PLUGIN_DATA_PATH directory (you will have to remove the .txt - surprisingly I can't upload a html file! |
This is an enhancement request. The data from swiftbar could be output to HTML file, that is visualized in a popover webview such as on main menubar display mouseover and/or item clicks. Ideally this would also give the author webview size controls. This open source project (no affiliation) gives you a good idea: Menubar Popup Browser
The text was updated successfully, but these errors were encountered: