Skip to content

Commit

Permalink
Merge branch 'release/1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ygini committed Jun 15, 2016
2 parents dda9eee + 44a780d commit 6b2533f
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 49 deletions.
35 changes: 34 additions & 1 deletion package/Hello IT.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,39 @@
<key>UID</key>
<integer>0</integer>
</dict>
<dict>
<key>CHILDREN</key>
<array>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>80</integer>
<key>PATH</key>
<string>../src/Plugins/ScriptedItem/SampleScript/com.github.ygini.Hello-IT.DisplayIP.sh</string>
<key>PATH_TYPE</key>
<integer>1</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>3</integer>
<key>UID</key>
<integer>0</integer>
</dict>
</array>
<key>GID</key>
<integer>80</integer>
<key>PATH</key>
<string>CustomScripts</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>2</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict>
<key>CHILDREN</key>
<array/>
Expand Down Expand Up @@ -577,7 +610,7 @@
<key>RELOCATABLE</key>
<false/>
<key>VERSION</key>
<string>1.2.1</string>
<string>1.2.2</string>
</dict>
<key>PROJECT_COMMENTS</key>
<dict>
Expand Down
6 changes: 6 additions & 0 deletions src/Hello IT/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
@"URL": @"https://github.com/ygini/Hello-IT/wiki/Preferences"
}
},
@{@"functionIdentifier": @"public.script.item",
@"settings": @{
@"script": @"com.github.ygini.Hello-IT.DisplayIP.sh",
@"skipForGlobalState": @YES
}
},
@{@"functionIdentifier": @"public.separator"},
@{@"functionIdentifier": @"public.quit"}
]
Expand Down
4 changes: 2 additions & 2 deletions src/Hello IT/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>94</string>
<string>98</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
22 changes: 18 additions & 4 deletions src/Plugins/Quit/Quit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@

/* Begin PBXBuildFile section */
E1AF40571B529AB70017B4DD /* HITPQuit.m in Sources */ = {isa = PBXBuildFile; fileRef = E1AF40561B529AB70017B4DD /* HITPQuit.m */; };
E1AF405B1B529B3C0017B4DD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E1AF405A1B529B3C0017B4DD /* Localizable.strings */; };
E1B2C9191B5947E0005A9936 /* HITDevKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1B2C9181B5947E0005A9936 /* HITDevKit.framework */; };
F89297401D11356100E431E2 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F89297421D11356100E431E2 /* Localizable.strings */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
E1AF40411B529AA10017B4DD /* Quit.hitp */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Quit.hitp; sourceTree = BUILT_PRODUCTS_DIR; };
E1AF40451B529AA10017B4DD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E1AF40551B529AB70017B4DD /* HITPQuit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HITPQuit.h; sourceTree = "<group>"; };
E1AF40561B529AB70017B4DD /* HITPQuit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HITPQuit.m; sourceTree = "<group>"; };
E1AF405A1B529B3C0017B4DD /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
E1B2C9181B5947E0005A9936 /* HITDevKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HITDevKit.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/Hello_IT-dblktlmawojysuccadblmqsuewcj/Build/Products/Debug/HITDevKit.framework"; sourceTree = "<group>"; };
F89297411D11356100E431E2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
F89297431D11359800E431E2 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -53,7 +54,7 @@
E1AF40431B529AA10017B4DD /* Quit */ = {
isa = PBXGroup;
children = (
E1AF405A1B529B3C0017B4DD /* Localizable.strings */,
F89297421D11356100E431E2 /* Localizable.strings */,
E1AF40441B529AA10017B4DD /* Supporting Files */,
E1AF40551B529AB70017B4DD /* HITPQuit.h */,
E1AF40561B529AB70017B4DD /* HITPQuit.m */,
Expand Down Expand Up @@ -109,6 +110,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
fr,
);
mainGroup = E1AF40381B529AA10017B4DD;
productRefGroup = E1AF40421B529AA10017B4DD /* Products */;
Expand All @@ -125,7 +127,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E1AF405B1B529B3C0017B4DD /* Localizable.strings in Resources */,
F89297401D11356100E431E2 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -142,6 +144,18 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
F89297421D11356100E431E2 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
F89297411D11356100E431E2 /* en */,
F89297431D11359800E431E2 /* fr */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
E1AF40461B529AA10017B4DD /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
File renamed without changes.
Binary file added src/Plugins/Quit/Quit/fr.lproj/Localizable.strings
Binary file not shown.
40 changes: 0 additions & 40 deletions src/Plugins/ScriptedItem/SampleScript/DisplayIP.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

function updateTitleWithMainIP {
ipAddress=""
globalNetworkState="$3"

mainBSDInterface=$(route -n get 8.8.8.8 | grep "interface: " | awk -F ": " '{print $2}')
ipAddress=$(ifconfig "$mainBSDInterface" | grep "inet " | sed "s/.*inet \([0-9.]*\).*/\1/" | head -n1)

if [ -z "$ipAddress" ]
then
echo "hitp-title: No IP Address"
if [[ "$globalNetworkState" == "1" ]]
then
echo "hitp-state: error"
echo "hitp-tooltip: Please, check your Ethernet or WiFi connection"
else
echo "hitp-state: unavailable"
echo "hitp-tooltip: No network connection available"
fi
else
echo "hitp-title: $ipAddress"
echo "hitp-state: ok"
echo "hitp-tooltip: Having an IP address doesn't mean you've Internet access"
fi
}
echo "hitp-enabled: NO"
updateTitleWithMainIP
echo "hitp-enabled: YES"

exit 0
9 changes: 7 additions & 2 deletions src/Plugins/ScriptedItem/ScriptedItem/HITPScriptedItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#import "HITPScriptedItem.h"


#define kHITPSubCommandScript @"path"
#define kHITPSubCommandScriptPath @"path"
#define kHITPSubCommandScriptName @"script"
#define kHITPSubCommandOptions @"options"
#define kHITPSubCommandArgs @"args"
#define kHITPSubCommandNetworkRelated @"network"
Expand All @@ -31,7 +32,11 @@ - (instancetype)initWithSettings:(NSDictionary*)settings
{
self = [super initWithSettings:settings];
if (self) {
_script = [[settings objectForKey:kHITPSubCommandScript] stringByExpandingTildeInPath];
_script = [[settings objectForKey:kHITPSubCommandScriptPath] stringByExpandingTildeInPath];

if ([_script length] == 0) {
_script = [[NSString stringWithFormat:@"/Library/Application Support/com.github.ygini.hello-it/CustomScripts"] stringByAppendingPathComponent:[settings objectForKey:kHITPSubCommandScriptName]];
}

asl_log(NULL, NULL, ASL_LEVEL_INFO, "Loading script based plugin with script at path %s", [_script cStringUsingEncoding:NSUTF8StringEncoding]);

Expand Down

0 comments on commit 6b2533f

Please sign in to comment.