Remote control shit for OS X (w/ Android app)

Wazakindjes f5420b55e9 Fuck notification badges, also properly hide notification if connection == rip 4 months ago
app f5420b55e9 Fuck notification badges, also properly hide notification if connection == rip 4 months ago
serbur 6a5b838cd1 Added handlers/buttons for currentvolume and currentbrightness in em Andr0id app as well as a hacky way to get current brightness from Perl, also 4x more steps for brightness (alt+shift+F1/F2 lmao) and accompanying app pref to switch between step size, also add version/build number shit kek 6 months ago
.gitignore 85aca91e8d Initial commit lol 6 months ago
LICENSE 85aca91e8d Initial commit lol 6 months ago
README.md fc1801a556 Added note bout selecting build variant prior to compilan, also updated .apk kek 4 months ago

README.md

The fuck is this

This shit is a dankass remote control thanggGgGg for Mac OS X (I'll keep saying that instead of macOS, fucking deal w/ it). I mostly started it as a proof of concept for keks, but it's easily expanded to include actually useful features. xd Right now it's mostly for enabling laziness. [=[=[==[[=[

The server side is a Perl skrip which can/should be controlled by launchctl to properly make it run as a daemon. The commands it receives are turned into AppleScript cuz that shit has APIs all throughout the OS X system. ;] Also, since the server only runs in SSL/TLS mode you'll need a certificate trusted by the clients used.

The client side can be anything supporting a streaming (TCP) socket with TLS, but I'm using an Android app meinself (incl00ded in the app directory lol). This app has a target SDK of 25 which corresponds to Android 7.1 (I'm using 25 cuz that gives me full-size app icons w/o that adaptive cancer). If you're using a self-signed cert, you should be able to import it into Settings > Security > Credentials > Trusted CAs or smt similar and it'll be accepted. Alternatively you can just disable the cert check inside the app's settings. =]

Supported commands

Many also support shorthand versions, some of which aren't even shown here due to it becoming fucky to read. xd You could also just check the regexes in em Perl if you really wanna kn0.

  • !a[uth] <$key> => Required before doing anything else lol
  • !q[uit], !e[xit] => Attempt clean disconnect
  • !prev => Previous music track
  • !next => Next tracc
  • !play[pause] => Toggle play/pause
  • !vol[ume] <$volume | +$volume | +$volume> => Change/set volume (e.g. !vol -5, !vol +9, !vol 20);
  • !cur[rent]vol[ume] => Return current v0lume level obv m9
  • !m[ute] => Toggle mute
  • !lock[screen] => Locks the screen (i.e. go back to login/user selection screen), keeps all current applications running
  • !bright[ness] <$brightness | up | down | min | max> => Change/set brightness in a similar fashion as !volume
  • !cur[rent]bright[ness] => Return current brightness (hacky af but works, see sauce for that shit lmao)
  • !c[affeinate] <$timestring> => Prevent system/display sleep and screensaver yo (e.g. !c 1h 5m 10s, !c 1h5m10s, !c 30m), should be a built-in utility
  • !decaf[feinate] => Undo all caffeinates (i.e. kill that shit)

Dependencies

Just some good ol' Perl modules:

  • Config::IniFiles
  • File::Basename
  • IO::Handle
  • IO::Select
  • IO::Socket::INET
  • IO::Socket::SSL

Installation

Copy muhconf.ini.example to muhconf.ini and fire up een editor. All the options are explained in there so git to reading fam. The config file must be kept in the same dir as the skrip.

After that change the contents of the com.jemoeder.lief.meqqy.plist file, namely the line that says <string>/Users/[user]/[dir]/serbur/meqqy.pl</string>. Then just copy it to ~/Library/LaunchAgents and run ./load. This makes sure it gets restarted after you reboot or log out and in again. Also it has a keepalive flag so if it died it'll be restarted. ;3

Muy importante: The !curbright is hacky as shit and it requires permission for "assistive" bullshit, in order to open windows in the background and still access their contents. So:

  • Go to System Preferences > Security & Privacy
  • Unlock that shit
  • Click Accessibility on the left side
  • See if meqqy.pl is already in the list on the right, if it is then just check the box next to it and cl0se em sysprefs
  • If not: apparently OS X won't let you add non-.app files manually, so just run the serbur skrip and try to get the current brightness through it
  • You'll get a popup saying it needs assistive aids enabled, simply click the button that'll take you to sysprefs (which is already open so no biggie) and check the fucking box =]

Android specific shit

So since I included muh Android st00dio projeckt in this repo as well, you'll need to make some adjustments if you want to release signed APKs lol. Also, I left the example testing classes in there just in case lel.

In the build.gradle file there are these 4 lines:

storeFile file(getPassword(currentUser, "ANDROID_KEY_STORE"))
storePassword getPassword(currentUser, "ANDROID_STORE_PASSWORD")
keyAlias getPassword(currentUser, "ANDROID_KEY_ALIAS")
keyPassword getPassword(currentUser, "ANDROID_KEY_PASSWORD")

These mean that all signing information (key store file, its password, your key alias and the key password) is st0red in the dankass OS X Keychain. So simply fire up the Keychain Access br0gram from Utilities and unlock the login keychain. Then on the bottom-left pick Passwords for categ0ry. Finally click on the small plus button at the very bottom and specify the fields as follows:

  • Keychain Item Name => one of the four above mentioned names (the ANDROID_* ones etc)
  • Account Name => your username (not display name), use Terminal > whoami to see this or just look at the name of your home directory
  • Password => the value

Example:

  • Keychain Item Name => ANDROID_KEY_STORE
  • Account Name => ayylmao
  • Password => /Users/ayylmao/pki/android_keystore.jks

Then repeat that shit for the others. ;] By doing it this way, your priv8 shit is never stored in the build.gradle file and it's safe to put it under version contr0l. Now, in order to build you won't be using Build > Generate Signed Bundle / APK. Use the Build > Build Bundle(s) / APK(s) option instead (don't forget to set the proper build variant first). ;] Otherwise it'll prompt you for keystore info bullshit anyways and fuck that.

Hurrrr pls halp it's br0ke

Simply ./unload that shit and do ./meqqy.pl in a terminal, you will most likely get some output that will give you an idea of wats goin on. =]