forked from Schwenger/CSKey
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·23 lines (18 loc) · 859 Bytes
/
install.py
File metadata and controls
executable file
·23 lines (18 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env python3
import os.path
import platform
import sys
import subprocess
layout_filename = "CSLayout.keylayout"
icon_filename = "CSLayout.icns"
if platform.system() == "Darwin": # check if Mac
target = '/Library/Keyboard\\ Layouts/'
command = f"sudo cp {layout_filename} {target}"
command2 = f"sudo cp {icon_filename} {target}"
if os.geteuid() != 0:
print("We need to copy the layout file to `/Library/Keyboard\ Layouts/`. This requires root privileges, so your OS will ask you for your password.")
print("After copying, you will need to open Apple > System Preferences > Keyboard > Input Sources, click the little \"+\", go to \"others\" and select the CSKeyboardLayout. Voilà!")
os.system(command)
os.system(command2)
else:
print("Sorry, We currently only support Mac. You need to install the layout manually.")