Merge pull request #118 from hjmmc/master

add local mode support
This commit is contained in:
ZeRo° Xu 2020-04-18 11:50:54 +08:00 committed by GitHub
commit 1ddda098e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 2 deletions

View file

@ -20,12 +20,14 @@ macOS 的 DPI 机制和 Windows 下不一样,比如 1080p 的屏幕在 Windows
## 使用方法 ## 使用方法
在终端输入以下命令回车即可 1.远程模式: 在终端输入以下命令回车即可
```bash ```bash
bash -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)" bash -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)"
``` ```
2.本地模式: 下载项目解压,双击 `hidpi.command` 运行
![运行](./img/run-zh.jpg) ![运行](./img/run-zh.jpg)
## 恢复 ## 恢复

View file

@ -18,12 +18,14 @@ System Preferences
## Usage ## Usage
Run this script in Terminal 1.Remote Mode: Run this script in Terminal
```bash ```bash
bash -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)" bash -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)"
``` ```
2.Local Mode: Download ZIP, decompressing it, and double click `hidpi.command` to run
![RUN](./img/run.jpg) ![RUN](./img/run.jpg)
## Recovery ## Recovery

6
hidpi.command Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
$DIR/hidpi.sh

View file

@ -5,6 +5,8 @@ systemVersion=($(sw_vers -productVersion | cut -d "." -f 2))
systemLanguage=($(locale | grep LANG | sed s/'LANG='// | tr -d '"' | cut -d "." -f 1)) systemLanguage=($(locale | grep LANG | sed s/'LANG='// | tr -d '"' | cut -d "." -f 1))
disableSIP="Need to disable SIP" disableSIP="Need to disable SIP"
langRemoteMode="Remote Mode"
langLocalMode="Local Mode"
langDisplay="Display" langDisplay="Display"
langMonitors="Monitors" langMonitors="Monitors"
langIndex="Index" langIndex="Index"
@ -37,6 +39,8 @@ langChooseResOpCustom="(6) Manual input resolution"
if [[ "${systemLanguage}" == "zh_CN" ]]; then if [[ "${systemLanguage}" == "zh_CN" ]]; then
disableSIP="需要关闭 SIP" disableSIP="需要关闭 SIP"
langRemoteMode="远程模式"
langLocalMode="本地模式"
langDisplay="显示器" langDisplay="显示器"
langMonitors="显示器" langMonitors="显示器"
langIndex="序号" langIndex="序号"
@ -72,6 +76,15 @@ downloadHost="https://raw.githubusercontent.com/xzhih/one-key-hidpi/master"
# downloadHost="https://raw.githubusercontent.com/xzhih/one-key-hidpi/dev" # downloadHost="https://raw.githubusercontent.com/xzhih/one-key-hidpi/dev"
# downloadHost="http://127.0.0.1:8080" # downloadHost="http://127.0.0.1:8080"
shellDir="$(dirname $0)"
if [ -d "${shellDir}/displayIcons" ];then
echo $langLocalMode
downloadHost="file://${shellDir}"
else
echo $langRemoteMode
fi
if [[ "${sipInfo}" == *"Filesystem Protections: disabled"* ]] || [[ "$(awk '{print $5}' <<< "${sipInfo}")" == "disabled." ]] || [[ "$(awk '{print $5}' <<< "${sipInfo}")" == "disabled" ]]; then if [[ "${sipInfo}" == *"Filesystem Protections: disabled"* ]] || [[ "$(awk '{print $5}' <<< "${sipInfo}")" == "disabled." ]] || [[ "$(awk '{print $5}' <<< "${sipInfo}")" == "disabled" ]]; then
: :
else else