aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-12-03Merge branch 'update-credits'HEADv1.0masterTeddy Wing
2016-12-03Remove Credits.rtfTeddy Wing
Remove this file as it isn't relevant at this point. We'll go with the simplified About panel instead.
2016-12-03Low Battery Yup-Info.plist: Update NSHumanReadableCopyrightTeddy Wing
Don't use my initials.
2016-12-03Merge branch 'remove-unnecessary-menu-items'Teddy Wing
2016-12-03MainMenu.xib: Remove unnecessary menu itemsTeddy Wing
Remove: File, Edit, View, Format These don't apply to this app and their functions aren't relevant here.
2016-12-03Merge branch 'add-dev-environment-info-to-README'Teddy Wing
2016-12-03README.md: Add versions of my dev environment for better clarityTeddy Wing
2016-12-03Merge branch 'fix-release-build-launch-crash-bug'Teddy Wing
2016-12-03Copy MASShortcut.framework to bundle Frameworks/ directoryTeddy Wing
The framework was getting copied to Resources/, but the app was told to look for it in Frameworks/, so it was crashing on launch. Here's the error: Dyld Error Message: Library not loaded: @executable_path/../Frameworks/MASShortcut.framework/Versions/A/MASShortcut Referenced from: /Users/USER/Documents/*/Low Battery Yup.app/Contents/MacOS/Low Battery Yup Reason: image not found Thank goodness for Console and logging and crash logs. Never would have figured this out otherwise. Worked fine in Debug configuration and when building for Release in Xcode. Just didn't work in the final archived app. Works now though, phew!
2016-12-03Merge branch 'prepare-for-release'Teddy Wing
2016-12-03Add READMETeddy Wing
Include a description of the problem case and application, a screencast and screenshot, installation information, and license information.
2016-12-03Set MASShortcut build architecture to 64-bitTeddy Wing
My release build was failing because of this error: error: -fobjc-arc is not supported with fragile abi Set MASShortcut to force 64-bit architectures because it uses ARC and from what I understand ARC can only be used on 64-bit.
2016-12-03Add copyright and license text to all source filesTeddy Wing
2016-12-03Add COPYING (GPLv3+)Teddy Wing
2016-12-03Merge branch 'mouse-location-should-be-right-on-all-screen-sizes'Teddy Wing
2016-12-03Clean up code from 9d91a7c908dc2261f2c3335875323c7088938204Teddy Wing
* Remove the old point assignments * Remove the comments describing the pixel offsets from the bottom-left of the low battery alert window * Remove the NSLog for inspecting the frame rect values * Remove the `width` variable which is no longer used
2016-12-03Click the right spot on all screen sizesTeddy Wing
Previously, the point set to be clicked for the low battery alert was only valid on a 13" 1440x900 screen. This change allows the click functionality to work on any screen size. I discovered in 954071bcc651ed5876d8ac0c3e8c253d4470c416 that I couldn't use a percentage to get the height of the "OK" button. But, the low battery alert uses `NSWindow`'s `-center` method, so I thought up a hack to make a fake window, center it, and get the window's frame dimensions. The fake window I create has the same (close enough) dimensions as the low battery alert (measured from a screenshot). I then use those dimensions to figure out where to click so that I'm clicking in the right place on the "OK" button. We also add a check to reinitialise the dimensions and reset the current window if the main window has changed from what we thought it was. This should allow the app to still work if you launch it from one display and later plug in another as your main display where the low battery warning will now appear. We need to subtract the frame's Y coordinate from the screen height because the frame origin uses standard bottom-left origin coordinates, while `CGDisplayMoveCursorToPoint` uses top-left origin coordinates.
2016-12-02Mouse.m: Some calculations on window centerTeddy Wing
Wanted to get a percentage that I could apply to the height to get to the right pixel position on the screen, but it doesn't seem like it's going to be that simple. The percentages are off for a big screen and a small screen, so I can't rely on a single percentage value. After some research, my current idea is to make a fake window, call NSWindow -center on it, and get the coordinates of that window to figure out where the mouse should be positioned.
2016-12-02Merge branch 'launch-agent'Teddy Wing
2016-12-02Populate launchd plistTeddy Wing
Add the necessary keys to the launchd plist to start the daemon application with the right properties on login. Used the Tunnelblick launchd plist as a reference.
2016-12-02Add a button to launch & quit the daemonTeddy Wing
Add a new button to the UI that either launches or quits the daemon depending on whether it's currently running. The button is set as a "Toggle" type that will cycle between "Launch Application" and "Quit Application" labels when clicked. Depending on the button's state (0 or 1), it will either launch or quit the daemon. The button's initial state is set on the UI application's launch to determine how it should read & what it should do.
2016-12-02Revert "DaemonLauncher.m: Check if daemon is running before launch or quit"Teddy Wing
This reverts commit e5debc332f2b11f4e768e0a5b0f2b8770c25523e. Actually, I don't really like that. The methods should instead do first and error if it doesn't work. Why bother checking? We'll keep the `isRunning` method around though because we need it to know what the "Launch Application" button should read.
2016-12-02DaemonLauncher.m: Check if daemon is running before launch or quitTeddy Wing
If the daemon is already running when `launch` is called, don't bother launching. If the daemon is not running when `quit` is called, don't bother quitting.
2016-12-02DaemonLauncher: Add `isRunning` methodTeddy Wing
Says whether or not the daemon app is currently running.
2016-12-02Launch the daemon when "Start at login" is checkedTeddy Wing
Launch the daemon when checked and quit it when unchecked. Now that I'm committing this, I don't really think this is the exact right behaviour. I think running and terminating the app should be maybe a different control so that running it isn't contingent on having it start at login.
2016-12-02Add daemon to UI app bundleTeddy Wing
Add "Low Bettery Yup.d" to "Low Battery Yup"'s Target Dependencies and copy the "Low Bettery Yup.d.app" bundle into "Low Battery Yup"'s bundle resources. This will allow us to distribute the daemon more easily so there's only one app that users see instead of two. It also allows us to locate the app more easily since it's contained within the UI app's application bundle.
2016-12-02MainMenu.xib: Bind "Start at login" checkbox to NSUserDefaultsControllerTeddy Wing
Add a Key-Value Binding in Interface Builder to `NSUserDefaultsController` so that the checkbox value gets persisted between launches of the app. This fixes the bug mentioned in a77a053f90a7b2588dbaabedbf25f908680f2f30 such that now unchecking the box and closing the app will result in the checkbox being unchecked on the next launch. Wow, that was super easy!
2016-12-02Add "Start at login" checkbox that [un]installs launch agentTeddy Wing
A new checkbox in the UI that asks whether the app should start at login. Checking and unchecking the box moves a LaunchAgent plist into and out of `~/Library/LaunchAgents/`. This plist file will define instructions to start the daemon on login. Also add a `DaemonLauncher` class that will launch or quit the daemon when the checkbox is clicked. Bug: Currently the app always starts with the checkbox checked. That's not what should happen. Instead, we should save the checkbox value to `NSUserDefaults` so that it has the previous value when the program is launched.
2016-12-02AppDelegate.h: Add `initializeShortcutView`Teddy Wing
Add the method to the header file from the original commit in 319dd672e1c75f39bcb9239117e520513da6609a.
2016-12-01AppDelegate.m: Move ShortcutView initialization into its own methodTeddy Wing
Keep the code more organised by defining a name for this functionality since we want to add some additional code here to handle the "Start at login" checkbox.
2016-12-01Add a checkbox to the UI for whether to start at loginTeddy Wing
This will enable and disable the daemon and set whether or not it starts at login.
2016-12-01Make click work from hotkey in NSUserDefaultsTeddy Wing
Get the shortcut saved from the windows application in our daemon and if there is one, use that as the hotkey to activate the mouse click. Yay! This is coming together!
2016-12-01Cleanup xcodeproj after mergeTeddy Wing
Reopened the Xcode project after this merge 1cf0b1458248b75c3270b3b6cc7edc643e810929 and Xcode updated the file.
2016-12-01Merge branch 'shortcut-config-UI'Teddy Wing
Conflicts: Low Battery Yup/en.lproj/MainMenu.xib
2016-12-01Add .gitattributes for merging Xcode *.pbxprojTeddy Wing
Automatically merge this file. I got conflicts in it trying to do a merge and it seemed like a bad time. Not conflicts I should be resolving myself manually. Got the tip from a Stack Overflow answer by Josh Brown: http://stackoverflow.com/questions/31541624/merge-conflicts-with-project-pbxproj-on-git-xcode-ios/32567843#32567843 According to this, though: http://stackoverflow.com/questions/12907605/xcode-project-file-git-merge-conflict that won't work in all cases. We'll try it anyway and hope for the best.
2016-12-01Add Constants.h for `kPreferenceGlobalShortcut`Teddy Wing
Since `kPreferenceGlobalShortcut` was defined in two different files, extract it to a single file that gets imported where it's needed so we're not doubly defining the same string.
2016-12-01Show saved keyboard shortcut in the MASShortcutViewTeddy Wing
If a global keyboard shortcut has been stored in the `NSUserDefaults`, display that in the shortcut selection widget.
2016-12-01ShortcutView.h: Add reference to `(void)setShortcutValue:(MASShortcut*)`Teddy Wing
Because it's more explicit about the methods in our .m file and that makes it clearer.
2016-12-01MainMenu.xib: Fix reference to `_shortcut_view` ivarTeddy Wing
Broke the reference to `_shortcut_view` in a984e2dd951bcbfe5e3e6374213eb9a5fd5423cf so when we called methods on it, they didn't work. This fixes it. Oh man that gave me a hard time. Glad I took a break and had an idea to call methods on the superclass and see if they worked. They did, but not methods on `ShorcutView`. So from that I figured out that I needed to update this reference.
2016-12-01ShortcutView: Store updated shortcut in NSUserDefaultsTeddy Wing
This will enable us to access it later in the daemon.
2016-12-01Clean up after a984e2dd951bcbfe5e3e6374213eb9a5fd5423cfTeddy Wing
Clean up the code after that commit. A whole bunch of stuff is no longer necessary so get rid of it all.
2016-12-01Able to get a shortcut from the MASShortcutViewTeddy Wing
Fuck damn it finally freaking works! Damn, just had to take a 1.5 hour nap after that. We're finally able to extract a shortcut out of the MASShortcutView. After trying a whole bunch of different things, I ultimately tried opening the debugger and figured out that for whatever reason the bindings weren't getting created and because of that my shortcut wasn't getting saved in the user defaults. Couldn't figure out how to get the binding to work even after includes and whatnot. Finally decided screw it I'm going to subclass the view and get the shortcut and store it in `NSUserDefaults` myself. So that's what we're going to do and this is the first step to getting that working. Hoo boy. Definitely need to vaccum the code after this.
2016-11-22Merge branch 'register-global-hotkey'Teddy Wing
2016-11-19Low Battery Yup: Close the application when window is closedTeddy Wing
This app has only one window and one function. Since it's so simple, it only needs to be open for a short time. It should close when its window is closed.
2016-11-19Use DDHotKeyTextField in "Low Battery Yup"Teddy Wing
Add a text field to the MainMenu.xib primary window and use it to allow users to type hotkeys. I'm thinking we might use this instead of MASShortcut since I've been having trouble getting that to work (couldn't figure out how to get a registered hotkey out of NSUserDefaults). This tool seems simpler, and could be just the ticket.
2016-11-18AppDelegate: Only allocate one `Mouse` instance in app lifecycleTeddy Wing
Don't keep allocating and releasing `Mouse` objects when the hotkey is pressed. Instead, allocate a single instance to use for the entire run time of the application.
2016-11-18Use hard-coded hotkey to invoke battery dialog dismisserTeddy Wing
* Add DDHotKey library to the project. Just copy the files in from the latest HEAD@e0481f648e0bc7e55d183622b00510b6721152d8. * Only add DDHotKeyCenter.{h,m} & DDHotKeyUtilities.{h,m} to the "Low Battery Yup.d" target as the *TextField file is only useful for a UI to choose a hotkey, and we don't have a UI in this target. * Set the DDHotKey* files to use ARC when compiling since they require it. This was done by going to Build Phases -> Compile Sources and adding this flag for both files: -fobj-arc this I figured out thanks to the following SO post: http://stackoverflow.com/questions/6448874/disable-automatic-reference-counting-for-some-files/10255815#10255815 * Link Carbon.framework because DDHotKey depends on it to register global hotkeys * Move our mouse moving & clicking code to a new method that gets used as the global hotkey action * Fix a runtime error caused by MainMenu.xib not being available (as a result of f0e8b5188e6fb984511eb01849380669e69632a6). To do this, we modify `main.m` to bypass the check for MainMenu.xib as described in this SO post: http://stackoverflow.com/questions/6945872/cocoa-app-without-a-mainmenu-xib/6946016#6946016 * Delete the `window` `IBOutlet` since we no longer have a MainMenu.xib and don't have a window in this app.
2016-11-17Add MASShortcut widget to main windowTeddy Wing
Also remove the `@property` for the window because we're old school.
2016-11-17AppDelegate.m: Release allocated `Mouse` instanceTeddy Wing
Since we alloc-inited the mouse, we need to make sure to release it when we're done with it. Forgot to do this when I originally wrote this bit.
2016-11-17Merge branch 'MASShortcut'Teddy Wing