1 Star 0 Fork 0

Yume_Maruyama/static-files

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
hidpi.sh 3.31 KB
Copy Edit Raw Blame History
Yume_Maruyama authored 2021-05-15 11:41 . fix hidpi
#!/bin/bash
#set -x # for DEBUGGING
# Script modified from xiaomi-pro's repo: https://github.com/daliansky/XiaoMi-Pro-Hackintosh/tree/master/one-key-hidpi
DISPLAYPATH="/Library/Displays/Contents/Resources/Overrides"
# Choose option
function choice() {
choose=0
echo '(1) Enable HiDPI'
echo '(2) Disable HiDPI'
echo '(3) Exit'
read -p "Enter your choice [1~3]: " choose
}
function networkWarn(){
echo "ERROR: Fail to download, please check the network state."
clean
exit 1
}
function download(){
echo 'Downloading display files...'
mkdir -p /tmp/one-key-hidpi
cd /tmp/one-key-hidpi
curl -fsSL https://gitee.com/kirainmoe/static-files/raw/master/Icons.plist -O || networkWarn
curl -fsSL https://gitee.com/kirainmoe/static-files/raw/master/DisplayVendorID-9e5/DisplayProductID-747 -O || networkWarn
curl -fsSL https://gitee.com/kirainmoe/static-files/raw/master/DisplayVendorID-9e5/DisplayProductID-747.tiff -O || networkWarn
echo 'Download complete'
echo
}
function removeold() {
echo 'Removing previous version...'
# Remove previous one-key-hidpi (Added in commit https://github.com/daliansky/XiaoMi-Pro-Hackintosh/commit/a3b7f136209a91455944b4afece7e14a931e62ba)
sudo rm -rf $DISPLAYPATH/DisplayVendorID-9e5
echo 'Remove complete'
echo
}
# Create backup for Icons.plist
function backup() {
echo 'Backing up...'
sudo mkdir -p $DISPLAYPATH/backup
sudo cp $DISPLAYPATH/Icons.plist $DISPLAYPATH/backup/
echo 'Back up complete'
echo
}
# Copy the display folder
function copy() {
echo 'Copying file to target address...'
sudo mkdir -p $DISPLAYPATH/DisplayVendorID-9e5
sudo cp ./Icons.plist $DISPLAYPATH/
sudo cp ./DisplayProductID-747 $DISPLAYPATH/DisplayVendorID-9e5/
sudo cp ./DisplayProductID-747.tiff $DISPLAYPATH/DisplayVendorID-9e5/
echo 'Copy complete'
echo
}
# Fix permission
function fixpermission() {
echo 'Fixing permission...'
sudo chown root:wheel $DISPLAYPATH/Icons.plist
sudo chown root:wheel $DISPLAYPATH/DisplayVendorID-9e5
sudo chown root:wheel $DISPLAYPATH/DisplayVendorID-9e5/DisplayProductID-747
sudo chown root:wheel $DISPLAYPATH/DisplayVendorID-9e5/DisplayProductID-747.tiff
echo 'Fix complete'
echo
}
# Clean
function clean() {
echo 'Cleaning temporary files...'
sudo rm -rf ../one-key-hidpi
echo 'Clean complete'
echo
}
function makedir() {
mkdir -p $DISPLAYPATH
}
# Install
function install() {
makedir
download
removeold
backup
copy
fixpermission
clean
echo 'Wonderful! This is the end of the installation, please reboot and choose 1424x802 in SysPref! '
exit 0
}
# Uninstall
function uninstall() {
echo 'Uninstalling one-key-hidpi...'
sudo rm -rf $DISPLAYPATH/DisplayVendorID-9e5
# Restore Icon.plist in backup folder if presents
if [ -f "$DISPLAYPATH/backup/Icons.plist" ];then
sudo cp $DISPLAYPATH/backup/Icons.plist $DISPLAYPATH/
sudo chown root:wheel $DISPLAYPATH/Icons.plist
fi
# Remove backup folder
sudo rm -rf $DISPLAYPATH/backup
echo 'Uninstall complete'
exit 0
}
# Main function
function main() {
read -n 1 -p "Input operation: 1 for install, 2 for uninstall" ops
if (( $ops == 1 ))
then
install
else
uninstall
fi
exit 0
}
main
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kirainmoe/static-files.git
git@gitee.com:kirainmoe/static-files.git
kirainmoe
static-files
static-files
master

Search

23e8dbc6 1850385 7e0993f3 1850385