Skip to content

Commit a42978c

Browse files
author
Frak AlNuaimy
committed
Add scripts and notes, cleanup
1 parent 1d7aa62 commit a42978c

8 files changed

+1363
-7
lines changed

App/BitBar/ExecutablePlugin.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ - (void)fileHandleDataAvailable:(NSNotification *)notification {
128128

129129
- (void)performRefreshNow {
130130
if (self.pluginIsVisible) {
131+
self.content = @"🔄"; //FRAK updating
132+
[self.statusItem setToolTip:([NSString stringWithFormat:@"Docker Info.\nRefreshing. Please wait."] )];
133+
131134
self.statusItem.enabled = NO;
132135
}
133136

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

160163
[strongSelf rebuildMenuForStatusItem:strongSelf.statusItem];

App/BitBar/Plugin.m

+36-2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,30 @@ - (void)loadImageForParams:(NSDictionary *)params completionHandler:(void (^)(NS
7777
}
7878
}
7979

80+
81+
- (NSImage *)imageResize:(NSImage*)anImage newSize:(NSSize)newSize
82+
{
83+
NSImage *sourceImage = anImage;
84+
//[sourceImage setScalesWhenResized:YES];
85+
86+
// Report an error if the source isn't a valid image
87+
if (![sourceImage isValid])
88+
{
89+
NSLog(@"Invalid Image");
90+
}
91+
else
92+
{
93+
NSImage *smallImage = [[NSImage alloc] initWithSize: newSize];
94+
[smallImage lockFocus];
95+
[sourceImage setSize: newSize];
96+
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
97+
[sourceImage drawAtPoint:NSZeroPoint fromRect:CGRectMake(0, 0, newSize.width, newSize.height) operation:NSCompositeCopy fraction:1.0];
98+
[smallImage unlockFocus];
99+
return smallImage;
100+
}
101+
return nil;
102+
}
103+
80104
- (NSImage*) createImageFromBase64:(NSString*)string isTemplate:(BOOL)template{
81105
NSData * imageData;
82106
if ([NSData instancesRespondToSelector:@selector(initWithBase64EncodedString:options:)]) {
@@ -142,9 +166,19 @@ - (NSMenuItem*) buildMenuItemWithParams:(NSDictionary *)params {
142166
}];
143167

144168
if (params[@"templateImage"]) {
145-
item.image = [self createImageFromBase64:params[@"templateImage"] isTemplate:true];
169+
NSImage *bimage = [self createImageFromBase64:params[@"templateImage"] isTemplate:true];
170+
if (params[@"width"] && params[@"height"]){
171+
item.image = [self imageResize:bimage newSize:NSMakeSize([params[@"width"] intValue], [params[@"height"] intValue]) ];
172+
}else {
173+
item.image = bimage;
174+
}
146175
}else if (params[@"image"]) {
147-
item.image = [self createImageFromBase64:params[@"image"] isTemplate:false];
176+
NSImage *bimage = [self createImageFromBase64:params[@"image"] isTemplate:false];
177+
if (params[@"width"] && params[@"height"]){
178+
item.image = [self imageResize:bimage newSize:NSMakeSize([params[@"width"] intValue], [params[@"height"] intValue]) ];
179+
}else {
180+
item.image = bimage;
181+
}
148182
}
149183
//FRAK
150184
if (params[@"checked"]) {

App/BitBar/PluginManager.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ - (NSArray *)plugins {
327327
[plugin setPath:[self.path stringByAppendingPathComponent:file]];
328328
[plugin setName:file];
329329
[plugin.statusItem setTitle:@"🔄"]; //FRAK startup
330-
[plugin.statusItem setToolTip:([NSString stringWithFormat:@"Dockerinfo.\nLoading. Please wait."] )];
330+
[plugin.statusItem setToolTip:([NSString stringWithFormat:@"Docker Info.\nLoading. Please wait."] )];
331331
//NSLog(@"Dockerinfo. Please wait.");
332332
//NSLog(@"File:%@",pluginFiles);
333333

App/Dockerinfo-Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>v1.0.0-beta2</string>
18+
<string>v1.0.0-beta3</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleURLTypes</key>
@@ -32,7 +32,7 @@
3232
</dict>
3333
</array>
3434
<key>CFBundleVersion</key>
35-
<string>Sep-02-2020 23:03:26</string>
35+
<string>Sep-20-2020 00:08:42</string>
3636
<key>LSApplicationCategoryType</key>
3737
<string>public.app-category.productivity</string>
3838
<key>LSMinimumSystemVersion</key>

Scripts/bitbar-bundler

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
[ "$#" -ge "2" ] || { echo "usage: $0 /path/to/BitBar.app /path/to/first-plugin /path/to/second-plugin ..."; exit 1; }
33

44
codesign --deep --force --verbose --sign - "$1"
5-
65
app="$1/Contents/MacOS/"
76

87
shift
@@ -12,3 +11,6 @@ cp -v "$@" "$app"
1211

1312
# ensure they are executable
1413
chmod -R +x "$app"
14+
15+
#Added by FRAK
16+
codesign --force --deep --verify --verbose --sign "Developer ID Application: Farqed Al Nuaimy (7G2GKABE9F)" "$app"../../

Scripts/dockerinfo.365d.py

+1,286
Large diffs are not rendered by default.

Scripts/postbuild.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
rm -rf "/Applications/Dockerinfo.app"
3+
mv "/Users/frak/Library/Developer/Xcode/DerivedData/Dockerinfo-fqxgemwvyjkgsaajnxkhotkbabhb/Build/Products/Debug/Dockerinfo.app/" /Applications
4+
./bitbar-bundler "/Applications/Dockerinfo.app" /Users/frak/Documents/BitBarPlugins/dockerinfo.365d.py
5+
spctl -a -v "/Applications/Dockerinfo.app"

notes.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
```bash
2+
$cat postbuild.sh
3+
#!/bin/bash
4+
rm -rf "/Applications/Dockerinfo.app"
5+
mv "/Users/frak/Library/Developer/Xcode/DerivedData/Dockerinfo-fqxgemwvyjkgsaajnxkhotkbabhb/Build/Products/Debug/Dockerinfo.app/" /Applications
6+
./bitbar-bundler "/Applications/Dockerinfo.app" /Users/frak/Documents/BitBarPlugins/dockerinfo.365d.py
7+
spctl -a -v "/Applications/Dockerinfo.app"
8+
[11:57 PM][frak@frakbookpro15][~/git/employees/Frakalog/bitbar/Scripts] branch:(master***)
9+
$cat bitbar-bundler
10+
#!/bin/bash
11+
[ "$#" -ge "2" ] || { echo "usage: $0 /path/to/BitBar.app /path/to/first-plugin /path/to/second-plugin ..."; exit 1; }
12+
13+
codesign --deep --force --verbose --sign - "$1"
14+
app="$1/Contents/MacOS/"
15+
16+
shift
17+
18+
# copy plugins into the app's executables directory
19+
cp -v "$@" "$app"
20+
21+
# ensure they are executable
22+
chmod -R +x "$app"
23+
24+
#Added by FRAK
25+
codesign --force --deep --verify --verbose --sign "Developer ID Application: Farqed Al Nuaimy (7G2GKABE9F)" "$app"../../
26+
```

0 commit comments

Comments
 (0)