Skip to content

Commit 2571377

Browse files
committed
0.2.0 Specify app tooltip via ANYBAR_TITLE (closes #59, closes #64)
1 parent 4ca8526 commit 2571377

File tree

6 files changed

+63
-66
lines changed

6 files changed

+63
-66
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
xcuserdata
2-
*.xcuserdatad
2+
*.xcuserdata
33
build
4+
*.zip
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

AnyBar.xcodeproj/xcuserdata/prokopov.xcuserdatad/xcschemes/AnyBar.xcscheme

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<MacroExpansion>
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "C5AB32B71A8F9091002258B6"
48+
BuildableName = "AnyBar.app"
49+
BlueprintName = "AnyBar"
50+
ReferencedContainer = "container:AnyBar.xcodeproj">
51+
</BuildableReference>
52+
</MacroExpansion>
4453
<Testables>
4554
<TestableReference
4655
skipped = "NO">
@@ -53,17 +62,6 @@
5362
</BuildableReference>
5463
</TestableReference>
5564
</Testables>
56-
<MacroExpansion>
57-
<BuildableReference
58-
BuildableIdentifier = "primary"
59-
BlueprintIdentifier = "C5AB32B71A8F9091002258B6"
60-
BuildableName = "AnyBar.app"
61-
BlueprintName = "AnyBar"
62-
ReferencedContainer = "container:AnyBar.xcodeproj">
63-
</BuildableReference>
64-
</MacroExpansion>
65-
<AdditionalOptions>
66-
</AdditionalOptions>
6765
</TestAction>
6866
<LaunchAction
6967
buildConfiguration = "Release"
@@ -85,8 +83,6 @@
8583
ReferencedContainer = "container:AnyBar.xcodeproj">
8684
</BuildableReference>
8785
</BuildableProductRunnable>
88-
<AdditionalOptions>
89-
</AdditionalOptions>
9086
</LaunchAction>
9187
<ProfileAction
9288
buildConfiguration = "Release"

AnyBar/AppDelegate.m

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @interface AppDelegate()
1616
@property (strong, nonatomic) NSString *imageName;
1717
@property (assign, nonatomic) BOOL dark;
1818
@property (assign, nonatomic) int udpPort;
19-
@property (assign, nonatomic) NSString *appDesc;
19+
@property (assign, nonatomic) NSString *appTitle;
2020

2121
@end
2222

@@ -31,24 +31,23 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNotification {
3131
@try {
3232
_udpPort = [self getUdpPort];
3333
_udpSocket = [self initializeUdpSocket: _udpPort];
34-
_appDesc = [self getAppDesc];
35-
_statusItem.toolTip = _appDesc;
34+
_appTitle = [self readStringFromEnvironmentVariable:@"ANYBAR_TITLE" usingDefault:nil];
35+
_statusItem.toolTip = _appTitle == nil ? [NSString stringWithFormat:@"AnyBar @ %d", _udpPort] : _appTitle;
3636
}
3737
@catch(NSException *ex) {
3838
NSLog(@"Error: %@: %@", ex.name, ex.reason);
3939
_statusItem.image = [NSImage imageNamed:@"exclamation@2x.png"];
4040
}
4141
@finally {
42-
NSString *appTitle = _appDesc;
43-
NSString *portTitle = [NSString stringWithFormat:@"UDP port: %@",
44-
_udpPort >= 0 ? [NSNumber numberWithInt:_udpPort] : @"unavailable"];
45-
NSString *quitTitle = @"Quit";
42+
NSString *portTitle = [NSString stringWithFormat:@"UDP port: %@", _udpPort >= 0 ? [NSNumber numberWithInt:_udpPort] : @"unavailable"];
43+
NSMenu *menu = [[NSMenu alloc] init];
4644

47-
_statusItem.menu = [self initializeStatusBarMenu:@{
48-
portTitle: [NSValue valueWithPointer:nil],
49-
quitTitle: [NSValue valueWithPointer:@selector(terminate:)],
50-
appTitle: [NSValue valueWithPointer:nil]
51-
}];
45+
if (_appTitle != nil)
46+
[menu addItemWithTitle:_appTitle action:nil keyEquivalent:@""];
47+
[menu addItemWithTitle:portTitle action:nil keyEquivalent:@""];
48+
[menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@""];
49+
50+
_statusItem.menu = menu;
5251
}
5352

5453
NSDistributedNotificationCenter *center = [NSDistributedNotificationCenter defaultCenter];
@@ -79,10 +78,6 @@ -(int) getUdpPort {
7978
return port;
8079
}
8180

82-
-(NSString*) getAppDesc {
83-
return [self readStringFromEnvironmentVariable:@"ANYBAR_DESC" usingDefault:@"AnyBar"];
84-
}
85-
8681
- (void)refreshDarkMode {
8782
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
8883
if ([osxMode isEqualToString:@"Dark"])
@@ -187,18 +182,6 @@ -(NSStatusItem*) initializeStatusBarItem {
187182
return statusItem;
188183
}
189184

190-
-(NSMenu*) initializeStatusBarMenu:(NSDictionary*)menuDictionary {
191-
NSMenu *menu = [[NSMenu alloc] init];
192-
193-
[menuDictionary enumerateKeysAndObjectsUsingBlock:^(NSString* key, NSValue* val, BOOL *stop) {
194-
SEL action = nil;
195-
[val getValue:&action];
196-
[menu addItemWithTitle:key action:action keyEquivalent:@""];
197-
}];
198-
199-
return menu;
200-
}
201-
202185
-(int) readIntFromEnvironmentVariable:(NSString*) envVariable usingDefault:(NSString*) defStr {
203186
int intVal = -1;
204187

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### 0.2.0 / Aug 26, 2020
2+
3+
- Specify app tooltip via `ANYBAR_TITLE` #59 #64 thx @mynameismiek @andrewsjg
4+
5+
### 0.1.4
6+
7+
- Bigger dots
8+
- Render “black” on dark menubar as empty circle and “white” on dark as filled circle (#55)
9+
- Compiled for OS X 10.11
10+
11+
### 0.1.3
12+
13+
- AppleScript support (PR #8, thx [Oleg Kertanov](https://github.com/okertanov))
14+
15+
### 0.1.2
16+
17+
- Dark mode support. In dark mode AnyBar will first check for `<image>_alt@2x.png` or `<image>_alt.png` image first, then falls back to `<image>.png`
18+
- Support for Mavericks actually works
19+
20+
### 0.1.1
21+
22+
- Support for Mavericks (PR #2, thx [Oleg Kertanov](https://github.com/okertanov))
23+
- Support for custom images via ~/.AnyBar (PR #1, thx [Paul Boschmann](https://github.com/pboschmann))

README.md

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ AnyBar is a small indicator for your menubar that does one simple thing: it disp
66

77
## Download
88

9-
Version 0.1.4:
9+
Version 0.2.0:
1010

11-
<a href="https://github.com/tonsky/AnyBar/releases/download/0.1.4/AnyBar-0.1.4.zip"><img src="AnyBar/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png?raw=true" style="width: 128px;" width=128/></a>
11+
<a href="https://github.com/tonsky/AnyBar/releases/download/0.2.0/AnyBar-0.2.0.zip"><img src="AnyBar/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png?raw=true" style="width: 128px;" width=128/></a>
1212

1313
Or using [Homebrew Cask](https://github.com/Homebrew/homebrew-cask):
1414

@@ -156,6 +156,14 @@ ANYBAR_PORT=1739 open -na AnyBar
156156
ANYBAR_PORT=1740 open -na AnyBar
157157
```
158158

159+
You can specify title to distinguish dots in the menubar:
160+
161+
```sh
162+
ANYBAR_PORT=1738 ANYBAR_TITLE=First open -na AnyBar
163+
ANYBAR_PORT=1739 ANYBAR_TITLE=Second open -na AnyBar
164+
ANYBAR_PORT=1740 ANYBAR_TITLE=Third open -na AnyBar
165+
```
166+
159167
## Custom images
160168

161169
AnyBar can detect and use local custom images stored in the `~/.AnyBar` directory. For example, if you have a `~/.AnyBar/square@2x.png` image, send `square` to port 1738 and it will be displayed. Images should be 19×19 pixels for standard resolution, and 38x38 pixels for retina (@2x).
@@ -167,28 +175,6 @@ AnyBar can detect and use local custom images stored in the `~/.AnyBar` director
167175
- Windows 10 [PavelStefanov/NoteBar](https://github.com/PavelStefanov/NoteBar)
168176
- Emacs [plexus/.../emybar.el](https://github.com/plexus/plexmacs/blob/master/emybar/emybar.el)
169177

170-
## Changelog
171-
172-
### 0.1.4
173-
174-
- Bigger dots
175-
- Render “black” on dark menubar as empty circle and “white” on dark as filled circle (#55)
176-
- Compiled for OS X 10.11
177-
178-
### 0.1.3
179-
180-
- AppleScript support (PR #8, thx [Oleg Kertanov](https://github.com/okertanov))
181-
182-
### 0.1.2
183-
184-
- Dark mode support. In dark mode AnyBar will first check for `<image>_alt@2x.png` or `<image>_alt.png` image first, then falls back to `<image>.png`
185-
- Support for Mavericks actually works
186-
187-
### 0.1.1
188-
189-
- Support for Mavericks (PR #2, thx [Oleg Kertanov](https://github.com/okertanov))
190-
- Support for custom images via ~/.AnyBar (PR #1, thx [Paul Boschmann](https://github.com/pboschmann))
191-
192178
## License
193179

194180
Copyright © 2015 Nikita Prokopov

0 commit comments

Comments
 (0)