Skip to content

Commit c33bc26

Browse files
committed
first commit
1 parent 140047e commit c33bc26

File tree

14 files changed

+1413
-0
lines changed

14 files changed

+1413
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,6 @@ cython_debug/
205205
marimo/_static/
206206
marimo/_lsp/
207207
__marimo__/
208+
209+
# macOS
210+
.DS_Store

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# macOS Android TV Volume Menubar Widget
2+
This app uses `https://github.com/tronikos/androidtvremote2` and a custom Python script to create a volume control menu bar widget for Android TVs. This has only been tested on a *TCL Percee TV* running Android 8. If you have a different model of Android television, you may need to modify `scripts/tvvolume.py`.
3+
4+
## Installation
5+
Download the installer from the [releases page](https://github.com/jvarn/macos-android-tv-remote-menubar-widget/releases/latest).
6+
Run the installer.
7+
8+
### First Run
9+
1. Open TVVolumeApp from /Applications.
10+
2. When the new volume icon appears in your menu bar, right click and choose Settings.
11+
3. Click on "Re-pair...".
12+
4. Enter your TV's IP address and then enter the pairing code shown on your TV.
13+
5. Enter your TV's IP address to connect and enable the volume control.
14+
15+
## Make It Yourself (Simple)
16+
The only part that contains a pre-compiled binary is the Automator app at `payload/TVVolumeApp.app`. If you prefer not to trust it, the you can make this part yourself using Automator on macOS.
17+
18+
### Create Automator App
19+
1. Create new Application in Automator.
20+
2. Add "Run Shell Script".
21+
3. Set Pass input to "as arguments" and Shell to "/bin/bash".
22+
4. Paste the following script:
23+
```sh
24+
APP_PATH="$HOME/Library/Application Support/TVVolume"
25+
PYTHON_EXECUTABLE="$APP_PATH/.venv/bin/python3"
26+
PYTHON_SCRIPT="$APP_PATH/tvvolume.py"
27+
28+
cd "$APP_PATH"
29+
"$PYTHON_EXECUTABLE" "tvvolume.py" > /dev/null 2>&1 &
30+
```
31+
5. Save the app as "TVVolumeApp".
32+
6. Place "TVVolumeApp.app" into the `payload` folder.
33+
34+
### Pre Install
35+
1. You may need to install `portaudio` using [homebrew](https://brew.sh).
36+
2. Run `./createinstaller.sh`.
37+
3. Run the installer from `built/TVVolumeApp_Installer.pkg`.
38+
39+
## Make It Yourself (Complete)
40+
41+
If you want to build the whole thing yourself from scratch, then follow the instructions below.
42+
43+
1. Create a new working folder with required sub-folders, e.g.:
44+
```sh
45+
mkdir -p ~/scripts/tvvolumeapp/scripts && mkdir ~/scripts/payload && mkdir ~/scripts/built && cd ~/scripts/tvvolumeapp
46+
```
47+
2. Install dependencies – adapted from: [installation instructions](https://github.com/tronikos/androidtvremote2#development-environment).
48+
```sh
49+
brew install portaudio python3
50+
51+
mkdir "~/Library/Application Support/TVVolume"
52+
cd "~/Library/Application Support/TVVolume"
53+
54+
git clone https://github.com/tronikos/androidtvremote2.git
55+
56+
python3 -m venv .venv
57+
source .venv/bin/activate
58+
59+
python -m pip install --upgrade pip
60+
python -m pip install -e ./androidtvremote2
61+
python -m pip install grpcio-tools mypy-protobuf
62+
python -m grpc_tools.protoc androidtvremote2/src/androidtvremote2/*.proto --python_out=androidtvremote2/src/androidtvremote2 --mypy_out=androidtvremote2/src/androidtvremote2 -Iandroidtvremote2/src/androidtvremote2
63+
python -m pip install pre-commit
64+
pre-commit install
65+
pre-commit run --all-files
66+
67+
python -m pip install -e "./androidtvremote2[test]"
68+
pytest
69+
70+
python -m pip install build
71+
python -m build ./androidtvremote2
72+
73+
curl -LJO https://raw.githubusercontent.com/jvarn/macos-android-tv-remote-menubar-widget/refs/heads/main/scripts/tvvolume.py
74+
```
75+
3. Create a new Application in Automator.
76+
4. Add "Run Shell Script".
77+
5. Set Pass input to "as arguments" and Shell to "/bin/bash".
78+
6. Paste the following script:
79+
```sh
80+
APP_PATH="$HOME/Library/Application Support/TVVolume"
81+
PYTHON_EXECUTABLE="$APP_PATH/.venv/bin/python3"
82+
PYTHON_SCRIPT="$APP_PATH/tvvolume.py"
83+
84+
cd "$APP_PATH"
85+
"$PYTHON_EXECUTABLE" "tvvolume.py" > /dev/null 2>&1 &
86+
```
87+
7. Save the app as "TVVolumeApp" and close Automator.
88+
8. Create your own app icon or use the one provided; name it `AppIcon.icns` and place it in `TVVolumeApp.app/Contents/Resources/`.
89+
9. Modify the strings in your "TVVolumeApp" app bundle:
90+
```sh
91+
plutil -replace CFBundleIdentifier -string "com.jvarn.TVVolumeApp" payload/TVVolumeApp.app/Contents/Info.plist
92+
plutil -replace CFBundleIconFile -string "AppIcon" payload/TVVolumeApp.app/Contents/Info.plist
93+
plutil -replace CFBundleIconName -string "AppIcon" payload/TVVolumeApp.app/Contents/Info.plist
94+
```
95+
10. Move or copy the app into your Applications folder.

createinstaller.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
plutil -replace CFBundleIdentifier -string "com.jvarn.TVVolumeApp" payload/TVVolumeApp.app/Contents/Info.plist
4+
plutil -replace CFBundleIconFile -string "AppIcon" payload/TVVolumeApp.app/Contents/Info.plist
5+
plutil -replace CFBundleIconName -string "AppIcon" payload/TVVolumeApp.app/Contents/Info.plist
6+
cp ./payload/AppIcon.icns ./payload/TVVolumeApp.app/Contents/Resources/
7+
mkdir -p ./built
8+
9+
if [ ! -d "scripts/androidtvremote2" ]; then
10+
echo "Fetching dependencies."
11+
git clone https://github.com/tronikos/androidtvremote2.git
12+
mv ./androidtvremote2 scripts/
13+
fi
14+
15+
pkgbuild --root ./payload \
16+
--identifier "com.jvarn.TVVolumeApp" \
17+
--version "1.0.0" \
18+
--install-location "/Applications" \
19+
./built/App_Component.pkg
20+
pkgbuild --identifier "com.jvarn.TVVolumeAppSupport" \
21+
--version "1.0.0" \
22+
--scripts ./scripts \
23+
--nopayload \
24+
./built/Support_Component.pkg
25+
productbuild --package ./built/App_Component.pkg \
26+
--package ./built/Support_Component.pkg \
27+
./built/TVVolumeApp_Installer.pkg
28+
29+
rm ./built/Support_Component.pkg && rm ./built/App_Component.pkg
30+
31+
echo "Done"

payload/AppIcon.icns

1.37 MB
Binary file not shown.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>AMIsApplet</key>
6+
<true/>
7+
<key>AMStayOpen</key>
8+
<false/>
9+
<key>BuildMachineOSBuild</key>
10+
<string>23A344017</string>
11+
<key>CFBundleAllowMixedLocalizations</key>
12+
<true/>
13+
<key>CFBundleDevelopmentRegion</key>
14+
<string>English</string>
15+
<key>CFBundleDocumentTypes</key>
16+
<array>
17+
<dict>
18+
<key>CFBundleTypeExtensions</key>
19+
<array>
20+
<string>*</string>
21+
</array>
22+
<key>CFBundleTypeName</key>
23+
<string>Automator workflow file</string>
24+
<key>CFBundleTypeOSTypes</key>
25+
<array>
26+
<string>****</string>
27+
</array>
28+
<key>CFBundleTypeRole</key>
29+
<string>Viewer</string>
30+
</dict>
31+
</array>
32+
<key>CFBundleExecutable</key>
33+
<string>Automator Application Stub</string>
34+
<key>CFBundleIconFile</key>
35+
<string>AppIcon</string>
36+
<key>CFBundleIconName</key>
37+
<string>AppIcon</string>
38+
<key>CFBundleIdentifier</key>
39+
<string>com.jvarn.TVVolumeApp</string>
40+
<key>CFBundleInfoDictionaryVersion</key>
41+
<string>6.0</string>
42+
<key>CFBundleName</key>
43+
<string>TVVolumeApp</string>
44+
<key>CFBundlePackageType</key>
45+
<string>APPL</string>
46+
<key>CFBundleShortVersionString</key>
47+
<string>1.3</string>
48+
<key>CFBundleSignature</key>
49+
<string>????</string>
50+
<key>CFBundleSupportedPlatforms</key>
51+
<array>
52+
<string>MacOSX</string>
53+
</array>
54+
<key>CFBundleURLTypes</key>
55+
<array/>
56+
<key>CFBundleVersion</key>
57+
<string>534</string>
58+
<key>DTCompiler</key>
59+
<string>com.apple.compilers.llvm.clang.1_0</string>
60+
<key>DTPlatformBuild</key>
61+
<string></string>
62+
<key>DTPlatformName</key>
63+
<string>macosx</string>
64+
<key>DTPlatformVersion</key>
65+
<string>26.3</string>
66+
<key>DTSDKBuild</key>
67+
<string>25D2110</string>
68+
<key>DTSDKName</key>
69+
<string>macosx26.3.internal</string>
70+
<key>DTXcode</key>
71+
<string>2600</string>
72+
<key>DTXcodeBuild</key>
73+
<string>17A6264l</string>
74+
<key>LSMinimumSystemVersion</key>
75+
<string>10.9</string>
76+
<key>LSUIElement</key>
77+
<true/>
78+
<key>NSAppleEventsUsageDescription</key>
79+
<string>This workflow needs to control other applications to run.</string>
80+
<key>NSAppleMusicUsageDescription</key>
81+
<string>This workflow needs access to your music to run.</string>
82+
<key>NSAppleScriptEnabled</key>
83+
<string>YES</string>
84+
<key>NSCalendarsUsageDescription</key>
85+
<string>This workflow needs access to your calendars to run.</string>
86+
<key>NSCameraUsageDescription</key>
87+
<string>This workflow needs access to your camera to run.</string>
88+
<key>NSContactsUsageDescription</key>
89+
<string>This workflow needs access to your contacts to run.</string>
90+
<key>NSHomeKitUsageDescription</key>
91+
<string>This workflow needs access to your HomeKit Home to run.</string>
92+
<key>NSMicrophoneUsageDescription</key>
93+
<string>This workflow needs access to your microphone to run.</string>
94+
<key>NSPhotoLibraryUsageDescription</key>
95+
<string>This workflow needs access to your photos to run.</string>
96+
<key>NSPrincipalClass</key>
97+
<string>NSApplication</string>
98+
<key>NSRemindersUsageDescription</key>
99+
<string>This workflow needs access to your reminders to run.</string>
100+
<key>NSServices</key>
101+
<array/>
102+
<key>NSSiriUsageDescription</key>
103+
<string>This workflow needs access to Siri to run.</string>
104+
<key>NSSystemAdministrationUsageDescription</key>
105+
<string>This workflow needs access to administer this system in order to run.</string>
106+
<key>UTExportedTypeDeclarations</key>
107+
<array/>
108+
<key>UTImportedTypeDeclarations</key>
109+
<array/>
110+
</dict>
111+
</plist>
Binary file not shown.
1.37 MB
Binary file not shown.
1.44 MB
Binary file not shown.
1.81 MB
Binary file not shown.
50.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)