Skip to content

Commit b2f33d8

Browse files
committed
Change macOS App name from "SLIP39" to "SLIP-39" to avoid name collision
o Remove some unnecessary entitlements o Include slip39 package data (paper wallet images) o Get the macOS user's name, if no names provided
1 parent bde0a80 commit b2f33d8

File tree

11 files changed

+129
-93
lines changed

11 files changed

+129
-93
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ dist/
2525
.cache/
2626
.eggs
2727
private_keys
28-
images/SLIP39.iconset
28+
images/SLIP-39.iconset

GNUmakefile

Lines changed: 71 additions & 71 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
<dict>
55
<key>com.apple.security.app-sandbox</key> <true/>
66
<key>com.apple.security.files.user-selected.read-write</key> <true/>
7-
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/>
8-
<key>com.apple.security.cs.disable-executable-page-protection</key> <true/>
97
</dict>
108
</plist>
File renamed without changes.

SLIP39.spec renamed to SLIP-39.spec

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ datas += collect_data_files('slip39')
99
block_cipher = None
1010

1111

12-
a = Analysis(['SLIP39.py'],
12+
a = Analysis(['SLIP-39.py'],
1313
pathex=[],
1414
binaries=[],
1515
datas=datas,
16-
hiddenimports=['slip39'],
16+
hiddenimports=[],
1717
hookspath=[],
1818
hooksconfig={},
1919
runtime_hooks=[],
@@ -26,32 +26,35 @@ pyz = PYZ(a.pure, a.zipped_data,
2626
cipher=block_cipher)
2727

2828
exe = EXE(pyz,
29-
a.scripts,
30-
a.binaries,
31-
a.zipfiles,
32-
a.datas,
29+
a.scripts,
3330
[],
34-
name='SLIP39',
31+
exclude_binaries=True,
32+
name='SLIP-39',
3533
debug=False,
3634
bootloader_ignore_signals=False,
3735
strip=False,
3836
upx=True,
39-
upx_exclude=[],
40-
runtime_tmpdir=None,
4137
console=False,
4238
disable_windowed_traceback=False,
4339
target_arch=None,
4440
codesign_identity='Developer ID Application: Perry Kundert (ZD8TVTCXDS)',
45-
entitlements_file='./SLIP39.metadata/entitlements.plist' )
46-
app = BUNDLE(exe,
47-
name='SLIP39.app',
48-
icon='images/SLIP39.icns',
49-
version='7.0.1',
41+
entitlements_file='./SLIP-39.metadata/entitlements.plist' )
42+
coll = COLLECT(exe,
43+
a.binaries,
44+
a.zipfiles,
45+
a.datas,
46+
strip=False,
47+
upx=True,
48+
upx_exclude=[],
49+
name='SLIP-39')
50+
app = BUNDLE(coll,
51+
name='SLIP-39.app',
52+
icon='images/SLIP-39.icns',
53+
version='7.1.0',
5054
info_plist={
51-
'CFBundleVersion':'7.0.1',
55+
'CFBundleVersion':'7.1.0',
5256
'CFBundlePackageType':'APPL',
5357
'LSApplicationCategoryType':'public.app-category.finance',
5458
'LSMinimumSystemVersion':'10.15.0',
5559
},
5660
bundle_identifier='ca.kundert.perry.SLIP39')
57-
File renamed without changes.
File renamed without changes.
File renamed without changes.

slip39/gui/main.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import math
66
import os
7+
import subprocess
78

89
from itertools import islice
910

@@ -570,7 +571,41 @@ def app(
570571

571572
sg.theme( 'DarkAmber' )
572573

573-
sg.user_settings_set_entry( '-target folder-', os.getcwd() )
574+
# Try to set a sane initial CWD (for saving generated files). If we start up in the standard
575+
# macOS App's "Container" directory for this App, ie.:
576+
#
577+
# /Users/<somebody>/Library/Containers/ca.kundert.perry.SLIP39/Data
578+
#
579+
# then we'll move upwards to the user's home directory. If we change the macOS App's Bundle ID,
580+
# this will change..
581+
cwd = os.getcwd()
582+
if cwd.endswith( '/Library/Containers/ca.kundert.perry.SLIP39/Data' ):
583+
cwd = cwd[:-48]
584+
sg.user_settings_set_entry( '-target folder-', cwd )
585+
586+
#
587+
# If no name(s) supplied, try to get the User's full name.
588+
#
589+
if not names:
590+
try:
591+
scutil = subprocess.run(
592+
[ '/usr/sbin/scutil' ],
593+
input = "show State:/Users/ConsoleUser",
594+
capture_output = True,
595+
encoding = 'UTF-8',
596+
)
597+
print( repr( scutil ))
598+
assert scutil.returncode == 0 and scutil.stdout, \
599+
"'scutil' command failed, or no output returned"
600+
for l in scutil.stdout.split( '\n' ):
601+
if 'kCGSessionLongUserNameKey' in l:
602+
# eg.: " kCGSessionLongUserNameKey : Perry Kundert"
603+
full_name = l.split( ':' )[1].strip()
604+
log.info( f"Current user's full name: {full_name!r}" )
605+
names = [ full_name ]
606+
break
607+
except Exception as exc:
608+
logging.exception( f"Failed to discover user full name: {exc}" )
574609

575610
# If we cannot support the output of Paper Wallets, disable
576611
wallet_pwd = None if paper_wallet_available() else False
@@ -612,7 +647,7 @@ def app(
612647
window['-GROUPS-F-'].expand( expand_x=True )
613648
timeout = None # Subsequently, block indefinitely
614649
else:
615-
window = sg.Window( f"{', '.join( names or [ 'SLIP39' ] )} Mnemonic Cards", layout )
650+
window = sg.Window( f"{', '.join( names or [ 'SLIP-39' ] )} Mnemonic Cards", layout )
616651
timeout = 0 # First time through, refresh immediately
617652

618653
status = None

0 commit comments

Comments
 (0)