Skip to content

Commit

Permalink
Support moving to Applications if not running from there
Browse files Browse the repository at this point in the history
Incorporate LetsMove "https://github.com/potionfactory/LetsMove/"

Couple other things that are disabled for now (a new HUDPanel that will provide configuring conky parameters etc)
  • Loading branch information
npyl committed Jan 28, 2018
1 parent c2fca5d commit 8b92da2
Show file tree
Hide file tree
Showing 10 changed files with 721 additions and 6 deletions.
26 changes: 24 additions & 2 deletions ConkyX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
EC1D9352201DDC6C00BD55EF /* PFMoveApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = EC1D9351201DDC6C00BD55EF /* PFMoveApplication.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
EC57EE74201CBF0600BC428E /* conky in CopyFiles */ = {isa = PBXBuildFile; fileRef = EC57EE6F201CBEEB00BC428E /* conky */; };
EC57EE77201CC47500BC428E /* InstallLibraries.sh in Resources */ = {isa = PBXBuildFile; fileRef = EC57EE76201CC47500BC428E /* InstallLibraries.sh */; };
EC696791201CDA44001E2FDD /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC696790201CDA44001E2FDD /* Sparkle.framework */; };
Expand Down Expand Up @@ -69,8 +70,10 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
EC1D9350201DDC6C00BD55EF /* PFMoveApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PFMoveApplication.h; path = LetsMove/PFMoveApplication.h; sourceTree = SOURCE_ROOT; };
EC1D9351201DDC6C00BD55EF /* PFMoveApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PFMoveApplication.m; path = LetsMove/PFMoveApplication.m; sourceTree = SOURCE_ROOT; };
EC57EE64201CBEEB00BC428E /* conky.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = conky.xcodeproj; path = "conky-for-macOS/ConkyX/conky.xcodeproj"; sourceTree = "<group>"; };
EC57EE76201CC47500BC428E /* InstallLibraries.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = InstallLibraries.sh; path = Resources/InstallLibraries.sh; sourceTree = SOURCE_ROOT; };
EC57EE76201CC47500BC428E /* InstallLibraries.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = InstallLibraries.sh; path = ConkyX/Resources/InstallLibraries.sh; sourceTree = SOURCE_ROOT; };
EC696790201CDA44001E2FDD /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
EC923C2320169A230019C772 /* ConkyX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ConkyX.app; sourceTree = BUILT_PRODUCTS_DIR; };
EC923C2C20169A230019C772 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -99,6 +102,15 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
EC1D934A201DDC4300BD55EF /* LetsMove */ = {
isa = PBXGroup;
children = (
EC1D9350201DDC6C00BD55EF /* PFMoveApplication.h */,
EC1D9351201DDC6C00BD55EF /* PFMoveApplication.m */,
);
path = LetsMove;
sourceTree = "<group>";
};
EC22EB47201CDA0D0052A6D5 /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -135,7 +147,9 @@
EC923C2520169A230019C772 /* ConkyX */ = {
isa = PBXGroup;
children = (
ECEF2231201D58D0001764E7 /* Resources */,
EC22EB47201CDA0D0052A6D5 /* Frameworks */,
EC1D934A201DDC4300BD55EF /* LetsMove */,
EC923C2C20169A230019C772 /* Assets.xcassets */,
EC923C2E20169A230019C772 /* Main.storyboard */,
EC923C3120169A230019C772 /* Info.plist */,
Expand All @@ -148,11 +162,18 @@
ECEDCC1A201CA99000BF1A90 /* MainWindowController.h */,
ECEDCC1B201CA99000BF1A90 /* MainWindowController.m */,
EC923C3A20169A540019C772 /* MainWindow.xib */,
EC57EE76201CC47500BC428E /* InstallLibraries.sh */,
);
path = ConkyX;
sourceTree = "<group>";
};
ECEF2231201D58D0001764E7 /* Resources */ = {
isa = PBXGroup;
children = (
EC57EE76201CC47500BC428E /* InstallLibraries.sh */,
);
path = Resources;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -248,6 +269,7 @@
files = (
ECEDCC1C201CA99000BF1A90 /* MainWindowController.m in Sources */,
EC923C3E20169B410019C772 /* AppDelegate.m in Sources */,
EC1D9352201DDC6C00BD55EF /* PFMoveApplication.m in Sources */,
EC923C3320169A230019C772 /* main.m in Sources */,
ECCA053F201D378B00F14527 /* ConfigureConkyController.m in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
6 changes: 5 additions & 1 deletion ConkyX/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "AppDelegate.h"

#import "PFMoveApplication.h"
#import "MainWindowController.h"

@interface AppDelegate ()
Expand All @@ -16,6 +17,10 @@ @interface AppDelegate ()

@implementation AppDelegate

- (void)applicationWillFinishLaunching:(NSNotification *)notification {
PFMoveToApplicationsFolderIfNecessary();
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application

Expand All @@ -37,5 +42,4 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}


@end
57 changes: 57 additions & 0 deletions ConkyX/ConfigureConky.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConfigureConkyController"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" frameAutosaveName="" animationBehavior="default" id="XcW-3L-70H" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="113" y="157" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="BDq-AB-8QH">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yAu-Eg-xVQ">
<rect key="frame" x="18" y="234" width="174" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Launch Conky at Login" bezelStyle="regularSquare" imagePosition="left" alignment="center" state="on" inset="2" id="Q7n-hi-AJa">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<browser verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" enabled="YES" hasHorizontalScroller="YES" allowsEmptySelection="YES" defaultColumnWidth="100" minColumnWidth="100" maxVisibleColumns="1" titled="YES" separatesColumns="YES" allowsTypeSelect="YES" columnResizingType="auto" translatesAutoresizingMaskIntoConstraints="NO" id="4oK-tu-TGN">
<rect key="frame" x="27" y="22" width="280" height="228"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</browser>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kdE-oU-ibM">
<rect key="frame" x="315" y="208" width="23" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WVq-cp-vu2">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2Ss-ze-pwb">
<rect key="frame" x="315" y="187" width="23" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="elN-QM-Mhw">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
</view>
<point key="canvasLocation" x="-185" y="176"/>
</window>
</objects>
<resources>
<image name="NSAddTemplate" width="11" height="11"/>
<image name="NSRemoveTemplate" width="11" height="11"/>
</resources>
</document>
13 changes: 13 additions & 0 deletions ConkyX/ConfigureConkyController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ConfigureConkyController.h
// ConkyX
//
// Created by Nikolas Pylarinos on 28/01/2018.
// Copyright © 2018 Nikolas Pylarinos. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface ConfigureConkyController : NSObject

@end
13 changes: 13 additions & 0 deletions ConkyX/ConfigureConkyController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ConfigureConkyController.m
// ConkyX
//
// Created by Nikolas Pylarinos on 28/01/2018.
// Copyright © 2018 Nikolas Pylarinos. All rights reserved.
//

#import "ConfigureConkyController.h"

@implementation ConfigureConkyController

@end
10 changes: 7 additions & 3 deletions ConkyX/MainWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ - (void)beginInstalling
/*
* update conky defaults file
*/
// [task.standardOutput setReadabilityHandler:nil];
// [task.standardError setReadabilityHandler:nil];

NSUserDefaults *conkyDefaults = [[NSUserDefaults alloc] init];
[conkyDefaults setValue:@"1" forKey:@"isInstalled"];

Expand All @@ -98,6 +95,13 @@ - (void)beginInstalling
[alert setInformativeText:@"Press OK to restart conky"];
[alert beginSheetModalForWindow:_window completionHandler:^(NSModalResponse returnCode)
{
/*
* start the configuration panel
* It provides functionality that will be incorporated to ManageConky.app later...
*/
//MainWindowController *mainWindowController = [[MainWindowController alloc] init];
//[[NSBundle mainBundle] loadNibNamed:@"ConfigureConky" owner:mainWindowController topLevelObjects:nil];

/*
* restart ConkyX
*/
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions LetsMove/PFMoveApplication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// PFMoveApplication.h, version 1.24
// LetsMove
//
// Created by Andy Kim at Potion Factory LLC on 9/17/09
//
// The contents of this file are dedicated to the public domain.

#ifdef __cplusplus
extern "C" {
#endif

#import <Foundation/Foundation.h>

/**
Moves the running application to ~/Applications or /Applications if the former does not exist.
After the move, it relaunches app from the new location.
DOES NOT work for sandboxed applications.
Call from \c NSApplication's delegate method \c -applicationWillFinishLaunching: method. */
void PFMoveToApplicationsFolderIfNecessary(void);

/**
Check whether an app move is currently in progress.
Returns YES if LetsMove is currently in-progress trying to move the app to the Applications folder, or NO otherwise.
This can be used to work around a crash with apps that terminate after last window is closed.
See https://github.com/potionfactory/LetsMove/issues/64 for details. */
BOOL PFMoveIsInProgress(void);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 8b92da2

Please sign in to comment.