Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AnthoPakPak/FastFinder
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.1
Choose a base ref
...
head repository: AnthoPakPak/FastFinder
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 13 commits
  • 8 files changed
  • 2 contributors

Commits on Dec 1, 2018

  1. Update download link

    AnthoPakPak authored Dec 1, 2018
    Copy the full SHA
    5ce9fec View commit details
  2. Update README with GIF

    AnthoPakPak authored Dec 1, 2018
    Copy the full SHA
    0275e07 View commit details
  3. Better GIF quality

    AnthoPakPak authored Dec 1, 2018
    Copy the full SHA
    8a44b21 View commit details
  4. Update README.md

    AnthoPakPak authored Dec 1, 2018
    Copy the full SHA
    a111f2a View commit details
  5. Local gif

    AnthoPakPak authored Dec 1, 2018
    Copy the full SHA
    a3fba2f View commit details
  6. Update README.md

    AnthoPakPak authored Dec 1, 2018
    Copy the full SHA
    767a8f4 View commit details

Commits on Dec 2, 2018

  1. Update README.md

    AnthoPakPak authored Dec 2, 2018
    Copy the full SHA
    d3d2dca View commit details

Commits on Jan 7, 2019

  1. Add Gitter badge

    gitter-badger committed Jan 7, 2019
    Copy the full SHA
    566773a View commit details
  2. Merge pull request #1 from gitter-badger/gitter-badge

    Add a Gitter chat badge to README.md
    AnthoPakPak authored Jan 7, 2019
    Copy the full SHA
    40727b2 View commit details

Commits on Jan 8, 2019

  1. Copy the full SHA
    7cb8b96 View commit details
  2. Copy the full SHA
    d32bb66 View commit details
  3. Update README.md

    AnthoPakPak committed Jan 8, 2019
    Copy the full SHA
    f520eb5 View commit details
  4. Update README.md

    AnthoPakPak authored Jan 8, 2019
    Copy the full SHA
    db3f1ab View commit details
Original file line number Diff line number Diff line change
@@ -74,14 +74,94 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FastFinder/ViewController/SettingsViewController.m"
timestampString = "565384919.423647"
timestampString = "568674219.037619"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "86"
endingLineNumber = "86"
startingLineNumber = "94"
endingLineNumber = "94"
landmarkName = "-didChangeAnimationVelocity:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FastFinder/Helper/FinderLogicHelper.m"
timestampString = "568674331.018504"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "137"
endingLineNumber = "137"
landmarkName = "-getFinderWindowFromWindows:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FastFinder/Helper/FinderLogicHelper.m"
timestampString = "568674331.019065"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "131"
endingLineNumber = "131"
landmarkName = "-getFinderWindowFromWindows:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FastFinder/Helper/FinderLogicHelper.m"
timestampString = "568674331.0194139"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "107"
endingLineNumber = "107"
landmarkName = "-show:finder:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FastFinder/Helper/FinderLogicHelper.m"
timestampString = "568674331.01974"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "92"
endingLineNumber = "92"
landmarkName = "-show:finder:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FastFinder/Helper/FinderLogicHelper.m"
timestampString = "568674331.020051"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "97"
endingLineNumber = "97"
landmarkName = "-show:finder:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
11 changes: 6 additions & 5 deletions FastFinder/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -836,7 +837,7 @@
<rect key="frame" x="44" y="5" width="361" height="28"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" id="oCa-qL-jbv">
<font key="font" metaFont="system" size="11"/>
<font key="font" metaFont="smallSystem"/>
<string key="title">You can reopen this window at any moment by opening FastFinder
from Spotlight or your Application folder</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -921,10 +922,10 @@ Animation is currently experimental and can cause quick glitch do to how MacOS h
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Nyb-ZY-c8Z">
<rect key="frame" x="167" y="247" width="19" height="14"/>
<rect key="frame" x="167" y="247" width="50" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="0.1" id="XMp-re-cIW">
<font key="font" metaFont="system" size="11"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="0.1" id="XMp-re-cIW">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@@ -942,7 +943,7 @@ Animation is currently experimental and can cause quick glitch do to how MacOS h
<rect key="frame" x="103" y="13" width="148" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Credits : Anthonin Cocagne" id="evw-x8-xEh">
<font key="font" metaFont="system" size="11"/>
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
76 changes: 56 additions & 20 deletions FastFinder/Helper/FinderLogicHelper.m
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
//CONFIGURATION

//for first launch
static CGFloat const DEFAULT_FINDER_HEIGHT = 500;
static CGFloat const DEFAULT_FINDER_HEIGHT = 550;


@implementation FinderLogicHelper {
@@ -26,6 +26,7 @@ @implementation FinderLogicHelper {
CGFloat screenHeight;
CGFloat screenWidth;

NSInteger idOfMainVisorFinderWindow;
NSInteger idOfVisorFinderWindow;
CGFloat lastFinderHeight;
}
@@ -87,6 +88,18 @@ -(void) show:(BOOL)show finder:(FinderApplication*)finder {
} else {
NSLog(@"Hide finder");

//experimental : reopen last closed window/tab; unfortunately, there is no way to distinguish tabs from window…
if ([self frontmostWindowIsTabOfMainWindow:finderWindows]) {
idOfVisorFinderWindow = ((FinderWindow*)finderWindows[0]).id; //show tab of main window
} else { //frontmost window isn't mainWindow nor a tab of mainWindow
// ((FinderWindow*)finderWindows[0]).index++;
for (int i = 0; i < [self getMainWindow:finderWindows].index; i++) {
((FinderWindow*)finderWindows[i]).index++; //send all windows which are above mainWindow to back
}
[self getMainWindow:finderWindows].index = 1; //send mainWindow to front
idOfVisorFinderWindow = idOfMainVisorFinderWindow; //restore main window
}

finderWindow = [self getFinderWindowFromWindows:finderWindows];
CGFloat finderHeight = finderWindow.bounds.size.height;

@@ -97,6 +110,8 @@ -(void) show:(BOOL)show finder:(FinderApplication*)finder {
if (animated) {
[self animateOffsetWindow:finderWindow directionUp:NO completionHandler:^{
//if the frontmost window (not finder one) at the time of making the shortcut takes the whole screen (window.bounds == screen.bounds)

// finder.frontmost = NO; //use this to allow working "Show in Finder" but experience is not as well as with finder.visible
finder.visible = NO; //this is what causes the glitch that is visible when there is no other window behind, because when you reactivate the finder after hiding it, it restores position

//if the frontmost window (not finder one) at the time of making the shortcut does NOT take the whole screen (window.bounds != screen.bounds), but the problem of this version is that the fact of not setting finder visible=NO, causes that if we click manually on Finder dock icon, it stays at its position on bottom…
@@ -114,24 +129,8 @@ -(FinderWindow*) getFinderWindowFromWindows:(SBElementArray*)finderWindows {
FinderWindow *finderWindow = nil;

if (finderWindows.count > 1) {
for (FinderWindow *finderWin in finderWindows) {
//NSLog(@"win : %@", finderWin.properties); //this can cause glitch…

if (finderWin.id == idOfVisorFinderWindow) {
finderWindow = finderWin;
finderWindow.index = 1; //set this window the frontmost one
}
}

//don't really know why i have to do this a second time, but without this it doesn't work
if (finderWindow.id != idOfVisorFinderWindow) {
NSLog(@"Window isn't the good one, searching for the good one…");
for (FinderWindow *finderWin in finderWindows) {
if (finderWin.id == idOfVisorFinderWindow) {
finderWindow = finderWin;
}
}
}
finderWindow = [self getMainWindow:finderWindows];
finderWindow.index = 1;
}

if (finderWindow == nil) {
@@ -147,11 +146,13 @@ -(FinderWindow*) getFinderWindowFromWindows:(SBElementArray*)finderWindows {

// [self runCommand:@"osascript -e \"tell application \"Finder\" to make new Finder window\""];
}
idOfMainVisorFinderWindow = finderWindow.id;
idOfVisorFinderWindow = finderWindow.id;
}

// NSLog(@"Window : id:%ld, name:%@, index:%ld, idOfVisorFinderWindow:%ld", finderWindow.id, finderWindow.name, finderWindow.index, idOfVisorFinderWindow);

idOfVisorFinderWindow = finderWindow.id;
//idOfVisorFinderWindow = finderWindow.id;
return finderWindow;
}

@@ -186,7 +187,42 @@ - (void)animateOffsetWindow:(FinderWindow *)finderWindow directionUp:(BOOL)direc
}


-(FinderWindow*) getMainWindow:(SBElementArray*)finderWindows {
FinderWindow *mainWindow;
for (FinderWindow *finderWin in finderWindows) {
//NSLog(@"win : %@", finderWin.properties); //this can cause glitch…

if (finderWin.id == idOfVisorFinderWindow) {
mainWindow = finderWin;
break;
}
}

//don't really know why i have to do this a second time, but without this it doesn't work
if (mainWindow.id != idOfVisorFinderWindow) {
NSLog(@"Window isn't the good one, searching for the good one…");
for (FinderWindow *finderWin in finderWindows) {
if (finderWin.id == idOfVisorFinderWindow) {
NSLog(@"Window finally found !");
mainWindow = finderWin;
break;
}
}
}

return mainWindow;
}

-(BOOL) frontmostWindowIsTabOfMainWindow:(SBElementArray*)finderWindows {
FinderWindow *frontmostWindow = (FinderWindow*)finderWindows[0];
FinderWindow *mainWindow = [self getMainWindow:finderWindows];

if (CGRectEqualToRect(frontmostWindow.bounds, mainWindow.bounds) && CGPointEqualToPoint(frontmostWindow.position, mainWindow.position)) {
return YES;
}

return NO;
}

#pragma mark - Misc

3 changes: 2 additions & 1 deletion FastFinder/Helper/UserSettingsHelper.m
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ +(UserSettingsHelper*)getInstance {
}

-(void) setDefaultsSettings {
self.launchOnStartup = YES;
self.launchOnStartup = NO; //should be YES but currently feature isn't working so I disable it
self.animated = YES;
self.animationVelocity = 0.4;
}
@@ -48,6 +48,7 @@ -(void) setLaunchOnStartup:(BOOL)launchOnStartup {
_launchOnStartup = launchOnStartup;
[[NSUserDefaults standardUserDefaults] setBool:launchOnStartup forKey:kSettingsLaunchOnStartup];

//has to be fixed with : https://theswiftdev.com/2017/10/27/how-to-launch-a-macos-app-at-login/ . for now, please add it manually to login items in System Preferences
SMLoginItemSetEnabled ((__bridge CFStringRef)@"com.acocagne.FastFinder", launchOnStartup); // NO to cancel launch at login
}
}
4 changes: 2 additions & 2 deletions FastFinder/Info.plist
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<string>0.1.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
10 changes: 9 additions & 1 deletion FastFinder/ViewController/SettingsViewController.m
Original file line number Diff line number Diff line change
@@ -73,7 +73,15 @@ -(void) restoreSettingsStates {
- (IBAction)didChangeLaunchOnStartup:(NSButton*)button {
NSLog(@"Setting launchOnStartup to %ld", (long)button.state);

[UserSettingsHelper getInstance].launchOnStartup = button.state;
//[UserSettingsHelper getInstance].launchOnStartup = button.state;

NSAlert *alert = [NSAlert new];
[alert setMessageText:@"⚠️ Feature not available currently"];
[alert setInformativeText:@"Sorry, launch at startup isn't supported for now.\n\nFor now, please do it manually by going to System Preferences > Users and groups > Login Items and adding FastFinder there.\n\nThe feature will be available when I'll have time to implement it, or if you have some free time, feel free to make a PR on https://github.com/AnthoPakPak/FastFinder 😉"];
[alert addButtonWithTitle:@"OK"];
[alert runModal];

button.state = NSControlStateValueOff;
}

- (IBAction)didChangeAnimated:(NSButton*)button {
Binary file added FastFinderDemo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@

# FastFinder

[![Join the chat at https://gitter.im/AnthoPakPak-FastFinder/community](https://badges.gitter.im/AnthoPakPak-FastFinder/community.svg)](https://gitter.im/AnthoPakPak-FastFinder/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

FastFinder goal is to always have a Finder window at a key press. Set your preferred shortcut, and use it to open your Finder window. The same window will be opened no matter on which Space you are !

**FastFinder is fully compatible with MacOS Mojave and compliant with System Integrity Protection, so that you don't have to disable it.**

![FastFinder Demo](FastFinderDemo.gif)


## How to use

- Download the [last version of FastFinder](http://…)
<img src="https://i.imgur.com/rrAeThK.png" width="500">

- Download the [last version of FastFinder](https://github.com/AnthoPakPak/FastFinder/releases/download/0.1.1/FastFinder_v0.1.1.dmg)
- Drag it into your Applications folder
- Launch it and set your shortcut and settings
- If you are working with multiple Spaces, right click on Finder dock icon > `Options` > tick `All desktops` (I was unable to set it automatically currently, due to MacOS restrictions)
@@ -17,17 +25,29 @@ FastFinder goal is to always have a Finder window at a key press. Set your prefe
FastFinder is written in `Objective-C` and is a standalone app. It listens for shortcut to bring your Finder. When you trigger the shortcut, it will find your Finder window and bring it to the front. It saves this Finder window `id` in order to always present the same window, even if you have multiple Finder windows opened. Basically, if Finder is not on screen, it shows it, and if it is, it hides it.


## Changelog

- **0.1.1**
**Support for multiple tabs in Finder window** : the last opened tab in your main Finder window will be reopened. Since `AppleScript` doesn't provide informations regarding if the window is a tab part of a window or if it's a main window (everything is a window), I've made the choice to detect if it's a tab by comparing window bounds. It works well, but it may be improved.
**Temporarily disable Launch At Startup feature** : disabled this setting and explained how to do it manually, since it is inexplicably long to implement in a Cocoa app. If you have time, feel free to submit a PR with the feature ;) (here is a good link to start with https://theswiftdev.com/2017/10/27/how-to-launch-a-macos-app-at-login/).

- **0.1**
Initial release


## Limitations

In order to comply with SIP protection, FastFinder is working with `AppleScript` only (`ScriptingBridge` to be precise). This means that it doesn't inject any code into Finder. Therefore, the capabilities of FastFinder are quite limited.

The sliding animation is experimental and you can see some quick glitches in some cases. This is due to how MacOS behaves with hidden windows.

Also note that it won't work on fullscreen Spaces, as it will switch to an non-fullscreen Space.


## Contribution

If you find better ways to implement this, or find workarounds to fix animations glitches, please feel free to make a PR or add a new issue with your code if you're lazy for the PR ;)


## Licence
FastFinder is licensed under the GNU GPLv3 licence.
FastFinder is licensed under the GNU GPLv3 licence.