Swiftbar and compiled plugins #73
Replies: 6 comments 13 replies
-
The format could differ. May be metadata can be a section at the bottom or top separated by some special string such as Example
|
Beta Was this translation helpful? Give feedback.
-
I have another idea I think worth exploring, we can try to use extended file attributes. Each property can be a separate attribute, or we an package it like this |
Beta Was this translation helpful? Give feedback.
-
Any new thoughts for this? 😁 |
Beta Was this translation helpful? Give feedback.
-
These are the steps I followed I have a simple sh file. #!/bin/bash
echo hi and I have created an <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCalendarsUsageDescription</key>
<string>This app needs access to your calendar.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to your photos.</string>
</dict>
</plist> I then converted the plist file to a binary format with the following command plutil -convert binary1 -o infofile info.plist this gives a a new file I now write the entire file as an attribute xattr -wx "com.bilal-fazlani:META" (xxd -ps infofile | tr -d \\n) hello.5s.sh Note: the |
Beta Was this translation helpful? Give feedback.
-
This command returned me the binary data xattr -pl com.bilal-fazlani:META hello.5s.sh | xxd -r -p But I am unable to read it back xattr -pl com.bilal-fazlani:META hello.5s.sh | xxd -r -p | plutil -convert xml1 - -o - |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for experimenting with it, on a second thought this what I've come with. Take metadata as it is in non binary plugin(in this case I've created
Write it to an extended file attribute as base64: This is much more easier for the end user and will require less code on SwiftBar end. |
Beta Was this translation helpful? Give feedback.
-
Hi, right now there are two ways to feed information to swifbar
First one is by writing a program that prints out menu items.
Second one is by having some text inside program. For example
This tells swiftbar about metadata of the plugin. For example title, version, etc.
Another example is
Here, by having this text, I am configuring the plugin to hide “about” menu item.
Coming to the main point of discussion,
Having text inside plugin works only for script files. Compiled plugins are binary files and it won’t be possible for swifbar to read those lines.
I propose we decide an approach where compiled plugins can also talk to swiftbar.
One way to achieve this is by reading reading the same things,
swiftbar.hideAbout
,title
version
etc from the output. In the same format i.e.A plug in compiled with java can then just print it in the beginning.
This will open up swiftbar to every programming language like java, c#, kotlin, scala, F#, etc.
Beta Was this translation helpful? Give feedback.
All reactions