Skip to content

Commit

Permalink
✨ only trigger when the selected modifier is pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyruu committed Sep 5, 2024
1 parent 47f07fd commit a14c747
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Tabula.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.3.0;
CURRENT_PROJECT_VERSION = 1.4.0;
DEVELOPMENT_ASSET_PATHS = "\"Tabula/Preview Content\"";
DEVELOPMENT_TEAM = 3S6Q428WC7;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -425,7 +425,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.4.0;
PRODUCT_BUNDLE_IDENTIFIER = de.keyruu.Tabula;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -442,7 +442,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.3.0;
CURRENT_PROJECT_VERSION = 1.4.0;
DEVELOPMENT_ASSET_PATHS = "\"Tabula/Preview Content\"";
DEVELOPMENT_TEAM = 3S6Q428WC7;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -455,7 +455,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.4.0;
PRODUCT_BUNDLE_IDENTIFIER = de.keyruu.Tabula;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
8 changes: 7 additions & 1 deletion Tabula/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
mouseMonitor = nil

if event.modifierFlags.contains(self.getModifierFlag()) {
var all = self.allModifiers()
all.remove(self.getModifierFlag())
if event.modifierFlags.contains(self.getModifierFlag()) && event.modifierFlags.intersection(all).isEmpty {
let scrollSpeedAny = UserDefaults.standard
.object(forKey: "scrollSpeed")
let scrollSpeed = scrollSpeedAny != nil ? scrollSpeedAny as! CGFloat : 20.0
Expand Down Expand Up @@ -93,6 +95,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}

func allModifiers() -> NSEvent.ModifierFlags {
return [.control,.function,.command,.option,.shift]
}

func getModifierFlag() -> NSEvent.ModifierFlags {
let modifierAny = UserDefaults.standard
.object(forKey: "modifier")
Expand Down

0 comments on commit a14c747

Please sign in to comment.