diff --git a/AutoRaise-Bridging-Header.h b/AutoRaise-Bridging-Header.h new file mode 100644 index 0000000..1b2cb5d --- /dev/null +++ b/AutoRaise-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/AutoRaise.xcodeproj/project.pbxproj b/AutoRaise.xcodeproj/project.pbxproj index 8010cdc..0a81314 100644 --- a/AutoRaise.xcodeproj/project.pbxproj +++ b/AutoRaise.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ C557DD451B988ED300E59BC9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C557DD441B988ED300E59BC9 /* Images.xcassets */; }; C557DD481B988ED300E59BC9 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C557DD461B988ED300E59BC9 /* MainMenu.xib */; }; C58DC14525FCEBBB00084C22 /* AutoRaise in Resources */ = {isa = PBXBuildFile; fileRef = C58DC14425FCEBBB00084C22 /* AutoRaise */; }; + C58DC14D25FCF1C100084C22 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = C58DC14C25FCF1C100084C22 /* README.md */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +23,7 @@ C557DD471B988ED300E59BC9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; C570C3762586877A00CC080F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C58DC14425FCEBBB00084C22 /* AutoRaise */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = AutoRaise; sourceTree = ""; }; + C58DC14C25FCF1C100084C22 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -38,6 +40,7 @@ C557DD341B988ED300E59BC9 = { isa = PBXGroup; children = ( + C58DC14C25FCF1C100084C22 /* README.md */, C58DC14425FCEBBB00084C22 /* AutoRaise */, C501B69425875F32005B3964 /* LICENSE.md */, C557DD3F1B988ED300E59BC9 /* Launcher */, @@ -136,6 +139,7 @@ files = ( C501B69525875F32005B3964 /* LICENSE.md in Resources */, C557DD451B988ED300E59BC9 /* Images.xcassets in Resources */, + C58DC14D25FCF1C100084C22 /* README.md in Resources */, C58DC14525FCEBBB00084C22 /* AutoRaise in Resources */, C557DD481B988ED300E59BC9 /* MainMenu.xib in Resources */, ); diff --git a/Launcher/AppDelegate.swift b/Launcher/AppDelegate.swift index 1bcaf32..b1d305f 100644 --- a/Launcher/AppDelegate.swift +++ b/Launcher/AppDelegate.swift @@ -2,7 +2,7 @@ * * AutoRaise Launcher * - * Copyright (c) 2020 Stefan Post, Lothar Haeger + * Copyright (c) 2021 Lothar Haeger * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,11 +49,11 @@ class AppDelegate: NSObject, NSApplicationDelegate { let buildNumber: String = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as! String let appAbout = "AutoRaise & Launcher\n" + - "Version 1.5.0, 2021-03-13\n\n" + + "Version 1.5.1, 2021-03-13\n\n" + "©2021 Stefan Post, Lothar Haeger\n" + "Icons made by https://www.flaticon.com/authors/fr" - let homePageUrl = "https://github.com/lhaeger/AutoRaise/tree/Launcher" + let homePageUrl = "https://github.com/lhaeger/AutoRaise" let prefs = UserDefaults.standard diff --git a/Launcher/Prefs.png b/Launcher/Prefs.png new file mode 100644 index 0000000..ad7beb8 Binary files /dev/null and b/Launcher/Prefs.png differ diff --git a/README.md b/README.md index 48faa65..f7dc426 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,15 @@ -When you hover a window it will be raised to the front (with a delay of your choosing) and gets the focus. There is -also an option to warp the mouse to the center of the activated window, using the cmd-tab key combination for example. -To use this tool, copy the AutoRaise binary to your /Applications/ folder making sure it is executable (chmod 700 -AutoRaise). Then double click it from within Finder. To quickly toggle it on/off you can use the applescript below -and paste it into an automator service workflow. Then bind the created service to a keyboard shortcut via System -Preferences|Keyboard|Shortcuts. +AutoRaise & Launcher -**Update**: It is now also possible to create an app bundle (for further instructions see at the bottom of this page). -If you prefer to use the app bundle version, replace "/Applications/AutoRaise" with "/Applications/AutoRaise.app" -and update the applescript accordingly. +This project consists of two components: AutoRaise and Launcher. -Applescript usage: +AutoRaise is written and maintained by Stefan Post at https://github.com/sbmpost/AutoRaise. From the readme: - on run {input, parameters} - tell application "Finder" - if exists of application process "AutoRaise" then - quit application "/Applications/AutoRaise" - display notification "AutoRaise Stopped" - else - launch application "/Applications/AutoRaise" - display notification "AutoRaise Started" - end if - end tell - return input - end run +"When AutoRaise is running and you hover the mouse cursor over a window it will be raised to the front (with a delay of your choosing) and gets the focus. There is also an option to warp the mouse to the center of the activated window, using the cmd-tab key combination for example." -Command line usage: +See also: https://stackoverflow.com/questions/98310/focus-follows-mouse-plus-auto-raise-on-mac-os-x - ./AutoRaise -delay 2 -warpX 0.5 -warpY 0.5 +While AutoRaise is concerned with GUI window and mouse behaviour, as a command line application it lacks a GUI itself. -*Note1*: If no delay has been specified on the command line, AutoRaise will look for an AutoRaise.delay file in the -**home** folder. It will also check for the existence of an AutoRaise.warp file. This is particularly useful for the -applescript usage as described above because 'launch application' does not support command line arguments. The delay -should be specified in units of 20ms. For example to specify a delay of 20ms run this command once in a terminal: +Here is where Launcher into play: it's a menubar application that allows to conveniently control and configure AutoRaise. A mouse click on it's menubar icon will start/stop AutoRaise, preferences can be configured from it's context menu and will be saved between sessions. - echo 1 > ~/AutoRaise.delay - -To enable warp, run this command: - - echo "0.5 0.5" > ~/AutoRaise.warp - -*Note2*: If you are not comfortable running the provided binary, then you can compile it yourself using this command: - - g++ -O2 -Wall -fobjc-arc -o AutoRaise AutoRaise.mm -framework AppKit - -*Note3*: To create the AutoRaise.app bundle, in a bash terminal type: - - ./create-app-bundle.sh - -Beware that AutoRaise.app runs on the background and can only be stopped again via "Activity Monitor" (or the applescript -above). Also command line arguments are ignored which means the app bundle version relies totally on the AutoRaise.delay -and AutoRaise.warp files in your home folder. - -See also https://stackoverflow.com/questions/98310/focus-follows-mouse-plus-auto-raise-on-mac-os-x +![AutoRaise Preferences](/Launcher/Prefs.png?raw=true)