Skip to content

Commit

Permalink
New Refreshed Icons (30) + Fixed Window Detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbvfx committed Apr 2, 2022
1 parent def03b7 commit c49e7e5
Show file tree
Hide file tree
Showing 49 changed files with 56 additions and 9 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@ RPFX will display the current file you're working on, as well as your workspace.
In addition, it will also show file icons for the following file types:
- `.swift`
- `.playground`
- `.xcodeproj`
- `.storyboard`
- `.plist`
- `.cpp`
- `.c`
- `.h`
- `.md`

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.
And much more! (30 in total)

## Dependencies
RPFX uses [his fork](https://github.com/PKBeam/SwordRPC) of [Azoy's SwordRPC](https://github.com/Azoy/SwordRPC).

## System Requirements
- macOS Big Sur (11.0) (Apple Silicon, Intel)
- Xcode and Discord (Stable or PTB) installed (otherwise this program isn't very useful)

## Usage
When you first start up RPFX, it will prompt you for permission to control Xcode. We don't actually need to *control* Xcode,
but we need that permission to execute AppleScript to get information on Xcode.
Expand All @@ -27,4 +35,7 @@ That's it, you're done - RPFX will now automatically monitor Xcode.

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

To disable it kill it from Activity Monitor.
To disable it you can kill it from Activity Monitor.

## Orginal Author
Btw, this is a upgraded fork of [RPFX](https://github.com/PKBeam/RPFX) made by [PKBeam](https://github.com/PKBeam)
3 changes: 0 additions & 3 deletions RPFX/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func updateStatus() {
debugPrint("updating Rich Presence status")

print(runAPScript(.documentNames))
print(runAPScript(.windowNames))

var rp = RichPresence()
let fn = getActiveFilename()
let ws = getActiveWorkspace()
Expand Down
10 changes: 7 additions & 3 deletions RPFX/Applescript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Foundation
import Cocoa
import SwiftUI

enum APScripts: String {
case windowNames = "return name of windows"
Expand Down Expand Up @@ -50,18 +51,21 @@ func runAPScript(_ s: APScripts) -> [String]? {
}

func getActiveFilename() -> String? {

guard let fileNames = runAPScript(.documentNames) else {
return nil
}

guard let windowNames = runAPScript(.windowNames) else {
return nil
}

// find the first window title that matches a filename
for window in windowNames { // iterate in order: the first window name is the one in focus
// check the focused window refers to a file
if fileNames.contains(window) {
// check the focused window refers to a files

let myString = window.components(separatedBy: .newlines)

if !fileNames.contains(myString[0]) {
return window
}
}
Expand Down
37 changes: 36 additions & 1 deletion RPFX/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,43 @@ let discordClientId = "959768440518881281"

// image keys of supported file types
let discordRPImageKeys = [
"c",
"cc",
"cp",
"cpp",
"cxx",
"developerprofile",
"entitlements",
"geojson",
"glsl",
"gpx",
"h",
"hpp",
"m",
"make",
"md",
"mm",
"mobileprovision",
"mom",
"nib",
"octest",
"playground",
"plist",
"r",
"rb",
"rbw",
"s",
"storyboard",
"strings",
"swift",
"playground"
"xcappdata",
"xcarchive",
"xcdatamodel",
"xcdatamodeld",
"xcodeproj",
"xcsnapshots",
"xcworkspace",
"xib"
]

// fallback image for unsupported file types
Expand Down
Binary file added images/c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cpp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cxx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/developerprofile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/entitlements.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/geojson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/glsl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gpx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hpp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/make.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/md.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mobileprovision.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/nib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/octest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/old/Markdown_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/old/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/old/markdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/old/playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/old/storyboard.png
Binary file added images/old/swift.png
Binary file added images/old/xcodeproj.png
Binary file modified images/playground.png
Binary file added images/plist.png
Binary file added images/r.png
Binary file added images/rb.png
Binary file added images/rbw.png
Binary file added images/s.png
Binary file added images/storyboard.png
Binary file added images/strings.png
Binary file modified images/swift.png
Binary file added images/xcappdata.png
Binary file added images/xcarchive.png
Binary file added images/xcdatamodel.png
Binary file added images/xcdatamodeld.png
Binary file added images/xcodeproj.png
Binary file added images/xcsnapshots.png
Binary file added images/xcworkspace.png
Binary file added images/xib.png

0 comments on commit c49e7e5

Please sign in to comment.