Modify the recovery method and optimize the code structure
This commit is contained in:
parent
84e35ead60
commit
fa0e36f68a
3 changed files with 248 additions and 228 deletions
30
README-zh.md
30
README-zh.md
|
@ -38,34 +38,42 @@ bash -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/dev/
|
||||||
|
|
||||||
### 恢复模式
|
### 恢复模式
|
||||||
|
|
||||||
如果使用此脚本后,开机无法进入系统,请到 macos 恢复模式中或使用 clover `-x` 安全模式进入系统,打开终端
|
如果使用此脚本后,开机无法进入系统,请到 macos 恢复模式,打开终端
|
||||||
|
|
||||||
这里有两种方式进行关闭,建议选第一种
|
这里有两种方式进行关闭,建议选第一种
|
||||||
|
|
||||||
1. 快捷恢复
|
1. 快捷恢复
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ls /Volumes/
|
ls /Volumes/
|
||||||
cd /Volumes/你的系统盘/System/Library/Displays/Contents/Resources/Overrides/HIDPI
|
```
|
||||||
|
|
||||||
./disable
|
你会看到你的系统盘
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Volumes/你的系统盘/Users/
|
||||||
|
|
||||||
|
ls
|
||||||
|
```
|
||||||
|
|
||||||
|
你可以看到所有用户的家目录
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd 你的用户名
|
||||||
|
|
||||||
|
./.hidpi-disable
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 手动恢复
|
2. 手动恢复
|
||||||
|
|
||||||
使用终端删除 `/System/Library/Displays/Contents/Resources/Overrides` 下删除显示器 VendorID 对应的文件夹,并把 `HIDPI/backup` 文件夹中的备份复制出来。
|
使用终端删除 `Library/Displays/Contents/Resources/Overrides` 下删除所有通过外部注入的显示器配置文件夹
|
||||||
|
|
||||||
请使用单个显示器执行以下命令,笔记本关闭外接显示器的 HIDPI 时请关闭内置显示器
|
|
||||||
|
|
||||||
具体命令如下:
|
具体命令如下:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ls /Volumes/
|
ls /Volumes/
|
||||||
cd /Volumes/你的系统盘/System/Library/Displays/Contents/Resources/Overrides
|
rm -rf /Volumes/你的系统盘/Library/Displays/Contents/Resources/Overrides
|
||||||
EDID=($(ioreg -lw0 | grep -i "IODisplayEDID" | sed -e "/[^<]*</s///" -e "s/\>//"))
|
|
||||||
Vid=($(echo $EDID | cut -c18-20))
|
|
||||||
rm -rf ./DisplayVendorID-$Vid
|
|
||||||
cp -r ./HIDPI/backup/* ./
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 从以下得到启发
|
## 从以下得到启发
|
||||||
|
|
29
README.md
29
README.md
|
@ -44,26 +44,31 @@ There are two ways to close it. It is recommended to choose the first one
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ls /Volumes/
|
ls /Volumes/
|
||||||
cd /Volumes/"Your System Disk Part"/System/Library/Displays/Contents/Resources/Overrides/HIDPI
|
```
|
||||||
|
|
||||||
./disable
|
you can see all Disk.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Volumes/"Your System Disk Part"/Users/
|
||||||
|
|
||||||
|
ls
|
||||||
|
```
|
||||||
|
|
||||||
|
you can see user home directory.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd "user name"
|
||||||
|
|
||||||
|
./.hidpi-disable
|
||||||
```
|
```
|
||||||
|
|
||||||
2.
|
2.
|
||||||
|
|
||||||
Remove your display's DisplayVendorID folder under `/System/Library/Displays/Contents/Resources/Overrides` , and move backup files
|
Remove all injected display's DisplayVendorID folder under `Library/Displays/Contents/Resources/Overrides`
|
||||||
|
|
||||||
Please use the single display to execute the following commands. If it is a laptop, turn off the internal monitor when turning off the HIDPI of the external monitor.
|
|
||||||
|
|
||||||
In Terminal:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ls /Volumes/
|
ls /Volumes/
|
||||||
cd /Volumes/"Your System Disk Part"/System/Library/Displays/Contents/Resources/Overrides
|
rm -rf /Volumes/"Your System Disk Part"/Library/Displays/Contents/Resources/Overrides
|
||||||
EDID=($(ioreg -lw0 | grep -i "IODisplayEDID" | sed -e "/[^<]*</s///" -e "s/\>//"))
|
|
||||||
Vid=($(echo $EDID | cut -c18-20))
|
|
||||||
rm -rf ./DisplayVendorID-$Vid
|
|
||||||
cp -r ./HIDPI/backup/* ./
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inspired
|
## Inspired
|
||||||
|
|
185
hidpi.sh
185
hidpi.sh
|
@ -11,6 +11,7 @@ cat << EEF
|
||||||
============================================
|
============================================
|
||||||
EEF
|
EEF
|
||||||
|
|
||||||
|
currentDir="$(cd $(dirname -- $0) && pwd)"
|
||||||
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))
|
||||||
|
|
||||||
langDisplay="Display"
|
langDisplay="Display"
|
||||||
|
@ -81,8 +82,7 @@ if [[ "${systemLanguage}" == "zh_CN" ]]; then
|
||||||
langChooseResOpCustom="(6) 手动输入分辨率"
|
langChooseResOpCustom="(6) 手动输入分辨率"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function get_edid()
|
function get_edid() {
|
||||||
{
|
|
||||||
local index=0
|
local index=0
|
||||||
local selection=0
|
local selection=0
|
||||||
|
|
||||||
|
@ -98,8 +98,7 @@ function get_edid()
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
|
|
||||||
# Show monitors.
|
# Show monitors.
|
||||||
for display in "${gDisplayInf[@]}"
|
for display in "${gDisplayInf[@]}"; do
|
||||||
do
|
|
||||||
let index++
|
let index++
|
||||||
MonitorName=("$(echo ${display:190:24} | xxd -p -r)")
|
MonitorName=("$(echo ${display:190:24} | xxd -p -r)")
|
||||||
VendorID=${display:16:4}
|
VendorID=${display:16:4}
|
||||||
|
@ -125,7 +124,7 @@ function get_edid()
|
||||||
[[:digit:]]*)
|
[[:digit:]]*)
|
||||||
# Lower selection (arrays start at zero).
|
# Lower selection (arrays start at zero).
|
||||||
if ((selection < 1 || selection > index)); then
|
if ((selection < 1 || selection > index)); then
|
||||||
echo "${langEnterError}";
|
echo "${langEnterError}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
let selection-=1
|
let selection-=1
|
||||||
|
@ -133,7 +132,7 @@ function get_edid()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "${langEnterError}";
|
echo "${langEnterError}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -152,17 +151,25 @@ function get_edid()
|
||||||
}
|
}
|
||||||
|
|
||||||
# init
|
# init
|
||||||
function init()
|
function init() {
|
||||||
{
|
rm -rf ${currentDir}/tmp/
|
||||||
get_edid
|
mkdir -p ${currentDir}/tmp/
|
||||||
|
|
||||||
currentDir="$(cd `dirname -- $0` && pwd)"
|
|
||||||
libDisplaysDir="/Library/Displays"
|
libDisplaysDir="/Library/Displays"
|
||||||
targetDir="${libDisplaysDir}/Contents/Resources/Overrides"
|
targetDir="${libDisplaysDir}/Contents/Resources/Overrides"
|
||||||
sysDisplayDir="/System${targetDir}"
|
sysDisplayDir="/System${targetDir}"
|
||||||
Overrides="\/Library\/Displays\/Contents\/Resources\/Overrides"
|
Overrides="\/Library\/Displays\/Contents\/Resources\/Overrides"
|
||||||
sysOverrides="\/System${Overrides}"
|
sysOverrides="\/System${Overrides}"
|
||||||
|
|
||||||
|
if [[ ! -d "${targetDir}" ]]; then
|
||||||
|
sudo mkdir -p "${targetDir}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
downloadHost="https://raw.githubusercontent.com/xzhih/one-key-hidpi/master"
|
||||||
|
if [ -d "${currentDir}/displayIcons" ]; then
|
||||||
|
downloadHost="file://${currentDir}"
|
||||||
|
fi
|
||||||
|
|
||||||
DICON="com\.apple\.cinema-display"
|
DICON="com\.apple\.cinema-display"
|
||||||
imacicon=${sysOverrides}"\/DisplayVendorID\-610\/DisplayProductID\-a032\.tiff"
|
imacicon=${sysOverrides}"\/DisplayVendorID\-610\/DisplayProductID\-a032\.tiff"
|
||||||
mbpicon=${sysOverrides}"\/DisplayVendorID\-610\/DisplayProductID\-a030\-e1e1df\.tiff"
|
mbpicon=${sysOverrides}"\/DisplayVendorID\-610\/DisplayProductID\-a030\-e1e1df\.tiff"
|
||||||
|
@ -170,29 +177,16 @@ function init()
|
||||||
lgicon=${sysOverrides}"\/DisplayVendorID\-1e6d\/DisplayProductID\-5b11\.tiff"
|
lgicon=${sysOverrides}"\/DisplayVendorID\-1e6d\/DisplayProductID\-5b11\.tiff"
|
||||||
proxdricon=${Overrides}"\/DisplayVendorID\-610\/DisplayProductID\-ae2f\_Landscape\.tiff"
|
proxdricon=${Overrides}"\/DisplayVendorID\-610\/DisplayProductID\-ae2f\_Landscape\.tiff"
|
||||||
|
|
||||||
if [[ ! -d ${targetDir}/HIDPI ]]; then
|
get_edid
|
||||||
sudo mkdir -p ${targetDir}/HIDPI
|
|
||||||
fi
|
|
||||||
|
|
||||||
downloadHost="https://raw.githubusercontent.com/xzhih/one-key-hidpi/master"
|
|
||||||
if [ -d "${currentDir}/displayIcons" ];then
|
|
||||||
downloadHost="file://${currentDir}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
generate_restore_cmd
|
generate_restore_cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
function generate_restore_cmd()
|
function generate_restore_cmd() {
|
||||||
{
|
|
||||||
#
|
|
||||||
rm -rf ${currentDir}/tmp/
|
|
||||||
mkdir -p ${currentDir}/tmp/
|
|
||||||
cat > "${currentDir}/tmp/disable" <<-\CCC
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
function get_edid()
|
cat >"$(cd && pwd)/.hidpi-disable" <<-\CCC
|
||||||
{
|
#!/bin/sh
|
||||||
|
function get_edid() {
|
||||||
local index=0
|
local index=0
|
||||||
local selection=0
|
local selection=0
|
||||||
gDisplayInf=($(ioreg -lw0 | grep -i "IODisplayEDID" | sed -e "/[^<]*</s///" -e "s/\>//"))
|
gDisplayInf=($(ioreg -lw0 | grep -i "IODisplayEDID" | sed -e "/[^<]*</s///" -e "s/\>//"))
|
||||||
|
@ -201,8 +195,7 @@ function get_edid()
|
||||||
echo '------------------------------------'
|
echo '------------------------------------'
|
||||||
echo ' Index | VendorID | ProductID '
|
echo ' Index | VendorID | ProductID '
|
||||||
echo '------------------------------------'
|
echo '------------------------------------'
|
||||||
for display in "${gDisplayInf[@]}"
|
for display in "${gDisplayInf[@]}"; do
|
||||||
do
|
|
||||||
let index++
|
let index++
|
||||||
printf " %d | ${display:16:4} | ${gMonitor:22:2}${gMonitor:20:2}\n" $index
|
printf " %d | ${display:16:4} | ${gMonitor:22:2}${gMonitor:20:2}\n" $index
|
||||||
done
|
done
|
||||||
|
@ -211,14 +204,14 @@ function get_edid()
|
||||||
case $selection in
|
case $selection in
|
||||||
[[:digit:]]*)
|
[[:digit:]]*)
|
||||||
if ((selection < 1 || selection > index)); then
|
if ((selection < 1 || selection > index)); then
|
||||||
echo "Enter error, bye";
|
echo "Enter error, bye"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
let selection-=1
|
let selection-=1
|
||||||
gMonitor=${gDisplayInf[$selection]}
|
gMonitor=${gDisplayInf[$selection]}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Enter error, bye";
|
echo "Enter error, bye"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -235,7 +228,8 @@ function get_edid()
|
||||||
|
|
||||||
get_edid
|
get_edid
|
||||||
|
|
||||||
rootPath="../../../../../.."
|
rootPath="../.."
|
||||||
|
restorePath="${rootPath}/Library/Displays/Contents/Resources/Overrides"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "(1) Disable HIDPI on this monitor"
|
echo "(1) Disable HIDPI on this monitor"
|
||||||
|
@ -244,13 +238,20 @@ echo ""
|
||||||
|
|
||||||
read -p "Enter your choice [1~2]: " input
|
read -p "Enter your choice [1~2]: " input
|
||||||
case ${input} in
|
case ${input} in
|
||||||
1) ${rootPath}/usr/libexec/plistbuddy -c "Delete :vendors:${Vid}:products:${Pid}" ../Icons.plist
|
1)
|
||||||
|
if [[ -f "${restorePath}/Icons.plist" ]]; then
|
||||||
|
${rootPath}/usr/libexec/plistbuddy -c "Delete :vendors:${Vid}:products:${Pid}" "${restorePath}/Icons.plist"
|
||||||
|
fi
|
||||||
|
if [[ -d "${restorePath}/DisplayVendorID-${Vid}" ]]; then
|
||||||
|
rm -rf "${restorePath}/DisplayVendorID-${Vid}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
2) rm -rf ${rootPath}/Library/Displays
|
2)
|
||||||
|
rm -rf "${restorePath}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
echo "Enter error, bye";
|
echo "Enter error, bye"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -258,15 +259,13 @@ esac
|
||||||
echo "HIDPI Disabled"
|
echo "HIDPI Disabled"
|
||||||
CCC
|
CCC
|
||||||
|
|
||||||
sudo mv ${currentDir}/tmp/disable ${targetDir}/HIDPI/
|
chmod +x "$(cd && pwd)/.hidpi-disable"
|
||||||
sudo chmod +x ${targetDir}/HIDPI/disable
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# choose_icon
|
# choose_icon
|
||||||
function choose_icon()
|
function choose_icon() {
|
||||||
{
|
|
||||||
#
|
|
||||||
rm -rf ${currentDir}/tmp/
|
rm -rf ${currentDir}/tmp/
|
||||||
mkdir -p ${currentDir}/tmp/
|
mkdir -p ${currentDir}/tmp/
|
||||||
mkdir -p ${currentDir}/tmp/DisplayVendorID-${Vid}
|
mkdir -p ${currentDir}/tmp/DisplayVendorID-${Vid}
|
||||||
|
@ -284,26 +283,31 @@ function choose_icon()
|
||||||
echo "(5) Pro Display XDR"
|
echo "(5) Pro Display XDR"
|
||||||
echo "(6) ${langNotChange}"
|
echo "(6) ${langNotChange}"
|
||||||
echo ""
|
echo ""
|
||||||
#
|
|
||||||
read -p "${langInputChoice} [1~6]: " logo
|
read -p "${langInputChoice} [1~6]: " logo
|
||||||
case ${logo} in
|
case ${logo} in
|
||||||
1) Picon=${imacicon}
|
1)
|
||||||
|
Picon=${imacicon}
|
||||||
RP=("33" "68" "160" "90")
|
RP=("33" "68" "160" "90")
|
||||||
curl -fsSL "${downloadHost}/displayIcons/iMac.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
curl -fsSL "${downloadHost}/displayIcons/iMac.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
||||||
;;
|
;;
|
||||||
2) Picon=${mbicon}
|
2)
|
||||||
|
Picon=${mbicon}
|
||||||
RP=("52" "66" "122" "76")
|
RP=("52" "66" "122" "76")
|
||||||
curl -fsSL "${downloadHost}/displayIcons/MacBook.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
curl -fsSL "${downloadHost}/displayIcons/MacBook.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
||||||
;;
|
;;
|
||||||
3) Picon=${mbpicon}
|
3)
|
||||||
|
Picon=${mbpicon}
|
||||||
RP=("40" "62" "147" "92")
|
RP=("40" "62" "147" "92")
|
||||||
curl -fsSL "${downloadHost}/displayIcons/MacBookPro.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
curl -fsSL "${downloadHost}/displayIcons/MacBookPro.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
||||||
;;
|
;;
|
||||||
4) Picon=${lgicon}
|
4)
|
||||||
|
Picon=${lgicon}
|
||||||
RP=("11" "47" "202" "114")
|
RP=("11" "47" "202" "114")
|
||||||
cp ${sysDisplayDir}/DisplayVendorID-1e6d/DisplayProductID-5b11.icns ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
cp ${sysDisplayDir}/DisplayVendorID-1e6d/DisplayProductID-5b11.icns ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
||||||
;;
|
;;
|
||||||
5) Picon=${proxdricon}
|
5)
|
||||||
|
Picon=${proxdricon}
|
||||||
RP=("5" "45" "216" "121")
|
RP=("5" "45" "216" "121")
|
||||||
curl -fsSL "${downloadHost}/displayIcons/ProDisplayXDR.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
curl -fsSL "${downloadHost}/displayIcons/ProDisplayXDR.icns" -o ${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}.icns
|
||||||
if [[ ! -f ${targetDir}/DisplayVendorID-610/DisplayProductID-ae2f_Landscape.tiff ]]; then
|
if [[ ! -f ${targetDir}/DisplayVendorID-610/DisplayProductID-ae2f_Landscape.tiff ]]; then
|
||||||
|
@ -311,11 +315,12 @@ case ${logo} in
|
||||||
Picon=${Overrides}"\/DisplayVendorID\-${Vid}\/DisplayProductID\-${Pid}\.tiff"
|
Picon=${Overrides}"\/DisplayVendorID\-${Vid}\/DisplayProductID\-${Pid}\.tiff"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
6) rm -rf ${currentDir}/tmp/Icons.plist
|
6)
|
||||||
|
rm -rf ${currentDir}/tmp/Icons.plist
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
echo "${langEnterError}";
|
echo "${langEnterError}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -335,13 +340,11 @@ fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
function main()
|
function main() {
|
||||||
{
|
|
||||||
sudo mkdir -p ${currentDir}/tmp/DisplayVendorID-${Vid}
|
sudo mkdir -p ${currentDir}/tmp/DisplayVendorID-${Vid}
|
||||||
dpiFile=${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}
|
dpiFile=${currentDir}/tmp/DisplayVendorID-${Vid}/DisplayProductID-${Pid}
|
||||||
sudo chmod -R 777 ${currentDir}/tmp/
|
sudo chmod -R 777 ${currentDir}/tmp/
|
||||||
|
|
||||||
#
|
|
||||||
cat >"${dpiFile}" <<-\CCC
|
cat >"${dpiFile}" <<-\CCC
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
@ -369,41 +372,46 @@ echo ${langChooseResOp5}
|
||||||
echo ${langChooseResOpCustom}
|
echo ${langChooseResOpCustom}
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
#
|
|
||||||
read -p "${langInputChoice}: " res
|
read -p "${langInputChoice}: " res
|
||||||
case ${res} in
|
case ${res} in
|
||||||
1 ) create_res_1 1680x945 1440x810 1280x720 1024x576
|
1)
|
||||||
|
create_res_1 1680x945 1440x810 1280x720 1024x576
|
||||||
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
||||||
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
||||||
create_res_4 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
create_res_4 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
||||||
;;
|
;;
|
||||||
2 ) create_res_1 1680x945 1424x802 1280x720 1024x576
|
2)
|
||||||
|
create_res_1 1680x945 1424x802 1280x720 1024x576
|
||||||
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
||||||
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
||||||
create_res_4 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
create_res_4 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
||||||
;;
|
;;
|
||||||
3 ) create_res_1 1680x1050 1440x900 1280x800 1024x640
|
3)
|
||||||
|
create_res_1 1680x1050 1440x900 1280x800 1024x640
|
||||||
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
||||||
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
||||||
create_res_4 1680x1050 1440x900 1280x800 1024x640 960x540 840x472 800x450 640x360
|
create_res_4 1680x1050 1440x900 1280x800 1024x640 960x540 840x472 800x450 640x360
|
||||||
;;
|
;;
|
||||||
4 ) create_res_1 2560x1440 2048x1152 1920x1080 1760x990 1680x945 1440x810 1360x765 1280x720
|
4)
|
||||||
|
create_res_1 2560x1440 2048x1152 1920x1080 1760x990 1680x945 1440x810 1360x765 1280x720
|
||||||
create_res_2 1360x765 1280x800 1280x720 1024x576 960x600 960x540 640x360
|
create_res_2 1360x765 1280x800 1280x720 1024x576 960x600 960x540 640x360
|
||||||
create_res_3 960x540 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
create_res_3 960x540 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
||||||
create_res_4 2048x1152 1920x1080 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
create_res_4 2048x1152 1920x1080 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
||||||
;;
|
;;
|
||||||
5 ) create_res_1 3000x2000 2880x1920 2250x1500 1920x1280 1680x1050 1440x900 1280x800 1024x640
|
5)
|
||||||
|
create_res_1 3000x2000 2880x1920 2250x1500 1920x1280 1680x1050 1440x900 1280x800 1024x640
|
||||||
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
create_res_2 1280x800 1280x720 960x600 960x540 640x360
|
||||||
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
||||||
create_res_4 1920x1280 1680x1050 1440x900 1280x800 1024x640 960x540 840x472 800x450 640x360
|
create_res_4 1920x1280 1680x1050 1440x900 1280x800 1024x640 960x540 840x472 800x450 640x360
|
||||||
;;
|
;;
|
||||||
6 ) custom_res
|
6)
|
||||||
|
custom_res
|
||||||
create_res_2 1360x765 1280x800 1280x720 960x600 960x540 640x360
|
create_res_2 1360x765 1280x800 1280x720 960x600 960x540 640x360
|
||||||
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
create_res_3 840x472 800x450 720x405 640x360 576x324 512x288 420x234 400x225 320x180
|
||||||
create_res_4 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
create_res_4 1680x945 1440x810 1280x720 1024x576 960x540 840x472 800x450 640x360
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "${langEnterError}";
|
echo "${langEnterError}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -421,8 +429,7 @@ FFF
|
||||||
}
|
}
|
||||||
|
|
||||||
# end
|
# end
|
||||||
function end()
|
function end() {
|
||||||
{
|
|
||||||
sudo chown -R root:wheel ${currentDir}/tmp/
|
sudo chown -R root:wheel ${currentDir}/tmp/
|
||||||
sudo chmod -R 0755 ${currentDir}/tmp/
|
sudo chmod -R 0755 ${currentDir}/tmp/
|
||||||
sudo chmod 0644 ${currentDir}/tmp/DisplayVendorID-${Vid}/*
|
sudo chmod 0644 ${currentDir}/tmp/DisplayVendorID-${Vid}/*
|
||||||
|
@ -434,16 +441,14 @@ function end()
|
||||||
}
|
}
|
||||||
|
|
||||||
# custom resolution
|
# custom resolution
|
||||||
function custom_res()
|
function custom_res() {
|
||||||
{
|
|
||||||
echo "${langCustomRes}"
|
echo "${langCustomRes}"
|
||||||
read -p ":" res
|
read -p ":" res
|
||||||
create_res ${res}
|
create_res ${res}
|
||||||
}
|
}
|
||||||
|
|
||||||
# create resolution
|
# create resolution
|
||||||
function create_res()
|
function create_res() {
|
||||||
{
|
|
||||||
for res in $@; do
|
for res in $@; do
|
||||||
width=$(echo ${res} | cut -d x -f 1)
|
width=$(echo ${res} | cut -d x -f 1)
|
||||||
height=$(echo ${res} | cut -d x -f 2)
|
height=$(echo ${res} | cut -d x -f 2)
|
||||||
|
@ -456,8 +461,7 @@ OOO
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_res_1()
|
function create_res_1() {
|
||||||
{
|
|
||||||
for res in $@; do
|
for res in $@; do
|
||||||
width=$(echo ${res} | cut -d x -f 1)
|
width=$(echo ${res} | cut -d x -f 1)
|
||||||
height=$(echo ${res} | cut -d x -f 2)
|
height=$(echo ${res} | cut -d x -f 2)
|
||||||
|
@ -469,8 +473,7 @@ OOO
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_res_2()
|
function create_res_2() {
|
||||||
{
|
|
||||||
for res in $@; do
|
for res in $@; do
|
||||||
width=$(echo ${res} | cut -d x -f 1)
|
width=$(echo ${res} | cut -d x -f 1)
|
||||||
height=$(echo ${res} | cut -d x -f 2)
|
height=$(echo ${res} | cut -d x -f 2)
|
||||||
|
@ -482,8 +485,7 @@ OOO
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_res_3()
|
function create_res_3() {
|
||||||
{
|
|
||||||
for res in $@; do
|
for res in $@; do
|
||||||
width=$(echo ${res} | cut -d x -f 1)
|
width=$(echo ${res} | cut -d x -f 1)
|
||||||
height=$(echo ${res} | cut -d x -f 2)
|
height=$(echo ${res} | cut -d x -f 2)
|
||||||
|
@ -495,8 +497,7 @@ OOO
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_res_4()
|
function create_res_4() {
|
||||||
{
|
|
||||||
for res in $@; do
|
for res in $@; do
|
||||||
width=$(echo ${res} | cut -d x -f 1)
|
width=$(echo ${res} | cut -d x -f 1)
|
||||||
height=$(echo ${res} | cut -d x -f 2)
|
height=$(echo ${res} | cut -d x -f 2)
|
||||||
|
@ -509,8 +510,7 @@ done
|
||||||
}
|
}
|
||||||
|
|
||||||
# enable
|
# enable
|
||||||
function enable_hidpi()
|
function enable_hidpi() {
|
||||||
{
|
|
||||||
choose_icon
|
choose_icon
|
||||||
main
|
main
|
||||||
sed -i "" "/.*IODisplayEDID/d" ${dpiFile}
|
sed -i "" "/.*IODisplayEDID/d" ${dpiFile}
|
||||||
|
@ -519,8 +519,7 @@ function enable_hidpi()
|
||||||
}
|
}
|
||||||
|
|
||||||
# patch
|
# patch
|
||||||
function enable_hidpi_with_patch()
|
function enable_hidpi_with_patch() {
|
||||||
{
|
|
||||||
choose_icon
|
choose_icon
|
||||||
main
|
main
|
||||||
|
|
||||||
|
@ -536,8 +535,7 @@ function enable_hidpi_with_patch()
|
||||||
}
|
}
|
||||||
|
|
||||||
# disable
|
# disable
|
||||||
function disable()
|
function disable() {
|
||||||
{
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "${langDisableOpt1}"
|
echo "${langDisableOpt1}"
|
||||||
echo "${langDisableOpt2}"
|
echo "${langDisableOpt2}"
|
||||||
|
@ -545,13 +543,20 @@ function disable()
|
||||||
|
|
||||||
read -p "${langInputChoice} [1~2]: " input
|
read -p "${langInputChoice} [1~2]: " input
|
||||||
case ${input} in
|
case ${input} in
|
||||||
1) sudo /usr/libexec/plistbuddy -c "Delete :vendors:${Vid}:products:${Pid}" ${targetDir}/Icons.plist
|
1)
|
||||||
|
if [[ -f "${targetDir}/Icons.plist" ]]; then
|
||||||
|
sudo /usr/libexec/plistbuddy -c "Delete :vendors:${Vid}:products:${Pid}" "${targetDir}/Icons.plist"
|
||||||
|
fi
|
||||||
|
if [[ -d "${targetDir}/DisplayVendorID-${Vid}" ]]; then
|
||||||
|
sudo rm -rf "${targetDir}/DisplayVendorID-${Vid}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
2) sudo rm -rf ${libDisplaysDir}
|
2)
|
||||||
|
sudo rm -rf "${targetDir}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
echo "${langEnterError}";
|
echo "${langEnterError}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -560,8 +565,7 @@ function disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
function start()
|
function start() {
|
||||||
{
|
|
||||||
init
|
init
|
||||||
echo ""
|
echo ""
|
||||||
echo ${langEnableOp1}
|
echo ${langEnableOp1}
|
||||||
|
@ -572,15 +576,18 @@ function start()
|
||||||
#
|
#
|
||||||
read -p "${langInputChoice} [1~3]: " input
|
read -p "${langInputChoice} [1~3]: " input
|
||||||
case ${input} in
|
case ${input} in
|
||||||
1) enable_hidpi
|
1)
|
||||||
|
enable_hidpi
|
||||||
;;
|
;;
|
||||||
2) enable_hidpi_with_patch
|
2)
|
||||||
|
enable_hidpi_with_patch
|
||||||
;;
|
;;
|
||||||
3) disable
|
3)
|
||||||
|
disable
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
echo "${langEnterError}";
|
echo "${langEnterError}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue