Skip to content

Commit

Permalink
no more janky icons next to exe
Browse files Browse the repository at this point in the history
fireph committed Nov 15, 2017

Unverified

This user has not yet uploaded their public signing key.
1 parent f80534a commit c3e4a26
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 9 additions & 2 deletions ObsAutoRecordWin.py
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ def refresh_icon(self):
win32gui.Shell_NotifyIcon(message, self.notify_id)

def update_from_state(self, state):
self.icon = os.path.join(os.getcwd(), 'record_green.ico' if state else 'record_red.ico')
self.icon = get_resource_path('record_green.ico' if state else 'record_red.ico')
self.hover_text = 'OBS Auto Record ' + ('(connected)' if state else '(disconnected)')
self.refresh_icon()

@@ -228,10 +228,17 @@ def non_string_iterable(obj):
else:
return not isinstance(obj, basestring)

def get_resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)

if __name__ == '__main__':
obs_auto_record = ObsAutoRecord()
sys_tray_icon = SysTrayIcon(obs_auto_record,
os.path.join(os.getcwd(), 'record_red.ico'),
get_resource_path('record_red.ico'),
'OBS Auto Record',
(),
default_menu_index=1)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,9 +14,8 @@ Controls OBS to auto record specific games when they are running (works on Windo
Install [pywin32](https://github.com/mhammond/pywin32)
```
pip3 install psutil pyinstaller websocket-client wmi
pyinstaller .\ObsAutoRecordWin.py --onefile --noconsole --icon=record_red.ico --name=ObsAutoRecord
pyinstaller .\ObsAutoRecordWin.py --onefile --noconsole --icon=record_red.ico --name=ObsAutoRecord --add-data "record*.ico;."
```
and put the ico files in the same folder as the executable.
### Mac
```
pip3 install psutil py2app rumps websocket-client

0 comments on commit c3e4a26

Please sign in to comment.