Skip to content

Commit def03b7

Browse files
committed
Distinguishing between Discord Stable and PTB
1 parent cdde4b3 commit def03b7

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ RPFX will display the current file you're working on, as well as your workspace.
88
In addition, it will also show file icons for the following file types:
99
- `.swift`
1010
- `.playground`
11-
- `.storyboard`
12-
- `.xcodeproj`
1311

1412
If you wish, you can tweak RPFX to use your own Discord application if you want to add custom functionality, such as more file icons.
1513

@@ -18,9 +16,7 @@ RPFX uses [his fork](https://github.com/PKBeam/SwordRPC) of [Azoy's SwordRPC](ht
1816

1917
## System Requirements
2018
- macOS Big Sur (11.0) (Apple Silicon, Intel)
21-
- Xcode and Discord PBT installed (otherwise this program isn't very useful)
22-
- If you want to use normal Discord version change in Constants.swift `com.hnc.DiscordPTB` to `com.hnc.Discord`
23-
19+
- Xcode and Discord (Stable or PTB) installed (otherwise this program isn't very useful)
2420
## Usage
2521
When you first start up RPFX, it will prompt you for permission to control Xcode. We don't actually need to *control* Xcode,
2622
but we need that permission to execute AppleScript to get information on Xcode.
@@ -31,4 +27,4 @@ That's it, you're done - RPFX will now automatically monitor Xcode.
3127

3228
If you like, you can set RPFX to automatically open on login.
3329

34-
To disable it kill it from Activity Monitor
30+
To disable it kill it from Activity Monitor.

RPFX/AppDelegate.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
9090
let runningApps = NSWorkspace.shared.runningApplications
9191
let xcodeOpen = runningApps.contains(where: {$0.bundleIdentifier == xcodeBundleId})
9292
let discordOpen = runningApps.contains(where: {$0.bundleIdentifier == discordBundleId})
93+
let discordPtbOpen = runningApps.contains(where: {$0.bundleIdentifier == discordPtbBundleId})
9394

9495
if xcodeOpen && discordOpen {
96+
debugPrint("Discord Stable")
97+
initRPC()
98+
} else if xcodeOpen && discordPtbOpen {
99+
debugPrint("Discord PTB")
95100
initRPC()
96101
} else if rpc != nil {
97102
deinitRPC()

RPFX/Constants.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import Foundation
1111
let debug = true
1212

1313
let xcodeBundleId = "com.apple.dt.Xcode"
14-
//if you use stable discord: let discordBundleId = "com.hnc.Discord"
15-
let discordBundleId = "com.hnc.DiscordPTB"
14+
let discordBundleId = "com.hnc.Discord"
15+
let discordPtbBundleId = "com.hnc.DiscordPTB"
1616

1717
// how often we check Xcode for a status update
1818
let statusRefreshInterval = 5.0 // seconds

0 commit comments

Comments
 (0)