Skip to content

Commit

Permalink
Add scripts and notes, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Frak AlNuaimy committed Sep 21, 2020
1 parent 1d7aa62 commit a42978c
Show file tree
Hide file tree
Showing 8 changed files with 1,363 additions and 7 deletions.
5 changes: 4 additions & 1 deletion App/BitBar/ExecutablePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ - (void)fileHandleDataAvailable:(NSNotification *)notification {

- (void)performRefreshNow {
if (self.pluginIsVisible) {
self.content = @"🔄"; //FRAK updating
[self.statusItem setToolTip:([NSString stringWithFormat:@"Docker Info.\nRefreshing. Please wait."] )];

self.statusItem.enabled = NO;
}

Expand All @@ -154,7 +157,7 @@ -(BOOL)refresh {
strongSelf.lastUpdated = NSDate.new;
//NSLog(@"3 ");
NSString *versionString = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleShortVersionString"];
[self.statusItem setToolTip:([NSString stringWithFormat:@"Docker Info %@\nMenubar Docker Dashboard", versionString] )];
[self.statusItem setToolTip:([NSString stringWithFormat:@"Docker Info %@", versionString] )];
//NSLog(@"Dockerinfo vvv.Menubar Docker Dashboard");

[strongSelf rebuildMenuForStatusItem:strongSelf.statusItem];
Expand Down
38 changes: 36 additions & 2 deletions App/BitBar/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ - (void)loadImageForParams:(NSDictionary *)params completionHandler:(void (^)(NS
}
}


- (NSImage *)imageResize:(NSImage*)anImage newSize:(NSSize)newSize
{
NSImage *sourceImage = anImage;
//[sourceImage setScalesWhenResized:YES];

// Report an error if the source isn't a valid image
if (![sourceImage isValid])
{
NSLog(@"Invalid Image");
}
else
{
NSImage *smallImage = [[NSImage alloc] initWithSize: newSize];
[smallImage lockFocus];
[sourceImage setSize: newSize];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[sourceImage drawAtPoint:NSZeroPoint fromRect:CGRectMake(0, 0, newSize.width, newSize.height) operation:NSCompositeCopy fraction:1.0];
[smallImage unlockFocus];
return smallImage;
}
return nil;
}

- (NSImage*) createImageFromBase64:(NSString*)string isTemplate:(BOOL)template{
NSData * imageData;
if ([NSData instancesRespondToSelector:@selector(initWithBase64EncodedString:options:)]) {
Expand Down Expand Up @@ -142,9 +166,19 @@ - (NSMenuItem*) buildMenuItemWithParams:(NSDictionary *)params {
}];

if (params[@"templateImage"]) {
item.image = [self createImageFromBase64:params[@"templateImage"] isTemplate:true];
NSImage *bimage = [self createImageFromBase64:params[@"templateImage"] isTemplate:true];
if (params[@"width"] && params[@"height"]){
item.image = [self imageResize:bimage newSize:NSMakeSize([params[@"width"] intValue], [params[@"height"] intValue]) ];
}else {
item.image = bimage;
}
}else if (params[@"image"]) {
item.image = [self createImageFromBase64:params[@"image"] isTemplate:false];
NSImage *bimage = [self createImageFromBase64:params[@"image"] isTemplate:false];
if (params[@"width"] && params[@"height"]){
item.image = [self imageResize:bimage newSize:NSMakeSize([params[@"width"] intValue], [params[@"height"] intValue]) ];
}else {
item.image = bimage;
}
}
//FRAK
if (params[@"checked"]) {
Expand Down
2 changes: 1 addition & 1 deletion App/BitBar/PluginManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ - (NSArray *)plugins {
[plugin setPath:[self.path stringByAppendingPathComponent:file]];
[plugin setName:file];
[plugin.statusItem setTitle:@"🔄"]; //FRAK startup
[plugin.statusItem setToolTip:([NSString stringWithFormat:@"Dockerinfo.\nLoading. Please wait."] )];
[plugin.statusItem setToolTip:([NSString stringWithFormat:@"Docker Info.\nLoading. Please wait."] )];
//NSLog(@"Dockerinfo. Please wait.");
//NSLog(@"File:%@",pluginFiles);

Expand Down
4 changes: 2 additions & 2 deletions App/Dockerinfo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>v1.0.0-beta2</string>
<string>v1.0.0-beta3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>Sep-02-2020 23:03:26</string>
<string>Sep-20-2020 00:08:42</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 3 additions & 1 deletion Scripts/bitbar-bundler
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
[ "$#" -ge "2" ] || { echo "usage: $0 /path/to/BitBar.app /path/to/first-plugin /path/to/second-plugin ..."; exit 1; }

codesign --deep --force --verbose --sign - "$1"

app="$1/Contents/MacOS/"

shift
Expand All @@ -12,3 +11,6 @@ cp -v "$@" "$app"

# ensure they are executable
chmod -R +x "$app"

#Added by FRAK
codesign --force --deep --verify --verbose --sign "Developer ID Application: Farqed Al Nuaimy (7G2GKABE9F)" "$app"../../
1,286 changes: 1,286 additions & 0 deletions Scripts/dockerinfo.365d.py

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Scripts/postbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
rm -rf "/Applications/Dockerinfo.app"
mv "/Users/frak/Library/Developer/Xcode/DerivedData/Dockerinfo-fqxgemwvyjkgsaajnxkhotkbabhb/Build/Products/Debug/Dockerinfo.app/" /Applications
./bitbar-bundler "/Applications/Dockerinfo.app" /Users/frak/Documents/BitBarPlugins/dockerinfo.365d.py
spctl -a -v "/Applications/Dockerinfo.app"
26 changes: 26 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```bash
$cat postbuild.sh
#!/bin/bash
rm -rf "/Applications/Dockerinfo.app"
mv "/Users/frak/Library/Developer/Xcode/DerivedData/Dockerinfo-fqxgemwvyjkgsaajnxkhotkbabhb/Build/Products/Debug/Dockerinfo.app/" /Applications
./bitbar-bundler "/Applications/Dockerinfo.app" /Users/frak/Documents/BitBarPlugins/dockerinfo.365d.py
spctl -a -v "/Applications/Dockerinfo.app"
[11:57 PM][frak@frakbookpro15][~/git/employees/Frakalog/bitbar/Scripts] branch:(master***)
$cat bitbar-bundler
#!/bin/bash
[ "$#" -ge "2" ] || { echo "usage: $0 /path/to/BitBar.app /path/to/first-plugin /path/to/second-plugin ..."; exit 1; }

codesign --deep --force --verbose --sign - "$1"
app="$1/Contents/MacOS/"

shift

# copy plugins into the app's executables directory
cp -v "$@" "$app"

# ensure they are executable
chmod -R +x "$app"

#Added by FRAK
codesign --force --deep --verify --verbose --sign "Developer ID Application: Farqed Al Nuaimy (7G2GKABE9F)" "$app"../../
```

0 comments on commit a42978c

Please sign in to comment.