mirror of
https://github.com/xzhih/one-key-hidpi.git
synced 2026-04-13 01:13:42 +08:00
Provide the sed's full absolute path, fix gnu-sed's issues #17.
This commit is contained in:
31
hidpi-zh.sh
31
hidpi-zh.sh
@@ -13,6 +13,11 @@ cat << EEF
|
|||||||
| | | | _| |_ | |__| | | | _| |_
|
| | | | _| |_ | |__| | | | _| |_
|
||||||
|_| |_| |_____| |_____/ |_| |_____|
|
|_| |_| |_____| |_____/ |_| |_____|
|
||||||
|
|
||||||
|
============================================
|
||||||
|
|
||||||
|
注:由于我手头没有外置显示器做测试,如果你有多个显示器,
|
||||||
|
请在单显示器运行脚本,笔记本外接显示器时请盒盖
|
||||||
|
|
||||||
============================================
|
============================================
|
||||||
EEF
|
EEF
|
||||||
#
|
#
|
||||||
@@ -24,7 +29,7 @@ EEF
|
|||||||
Pid=$(echo "obase=16;$ProductID" | bc | tr 'A-Z' 'a-z')
|
Pid=$(echo "obase=16;$ProductID" | bc | tr 'A-Z' 'a-z')
|
||||||
|
|
||||||
edID=$(echo $EDID | sed 's/../b5/21')
|
edID=$(echo $EDID | sed 's/../b5/21')
|
||||||
EDid=$(echo $edID | xxd -r -p | base64)
|
EDid=$(printf $edID | xxd -r -p | base64)
|
||||||
|
|
||||||
thisDir=$(dirname $0)
|
thisDir=$(dirname $0)
|
||||||
thatDir="/System/Library/Displays/Contents/Resources/Overrides"
|
thatDir="/System/Library/Displays/Contents/Resources/Overrides"
|
||||||
@@ -93,14 +98,14 @@ exit 0
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ $Picon ]]; then
|
if [[ $Picon ]]; then
|
||||||
sed -i '' "s/VID/$Vid/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/VID/$Vid/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/PID/$Pid/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/PID/$Pid/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPX/${RP[0]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPX/${RP[0]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPY/${RP[1]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPY/${RP[1]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPW/${RP[2]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPW/${RP[2]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPH/${RP[3]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPH/${RP[3]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/PICON/$Picon/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/PICON/$Picon/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/DICON/$DICON/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/DICON/$DICON/g" $thisDir/tmp/Icons.plist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -162,8 +167,8 @@ cat >> "$dpiFile" <<-\FFF
|
|||||||
</plist>
|
</plist>
|
||||||
FFF
|
FFF
|
||||||
|
|
||||||
sed -i '' "s/VID/$VendorID/g" $dpiFile
|
/usr/bin/sed -i "" "s/VID/$VendorID/g" $dpiFile
|
||||||
sed -i '' "s/PID/$ProductID/g" $dpiFile
|
/usr/bin/sed -i "" "s/PID/$ProductID/g" $dpiFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# 擦屁股
|
# 擦屁股
|
||||||
@@ -173,7 +178,7 @@ function end()
|
|||||||
sudo rm -rf $thisDir/tmp
|
sudo rm -rf $thisDir/tmp
|
||||||
echo "开启成功,重启生效"
|
echo "开启成功,重启生效"
|
||||||
echo "首次重启开机logo会变得巨大,之后就不会了"
|
echo "首次重启开机logo会变得巨大,之后就不会了"
|
||||||
say "妖怪,哪里跑"
|
# say "妖怪,哪里跑"
|
||||||
}
|
}
|
||||||
|
|
||||||
#自定义分辨率
|
#自定义分辨率
|
||||||
@@ -266,7 +271,7 @@ function enable_hidpi_with_patch()
|
|||||||
{
|
{
|
||||||
choose_icon
|
choose_icon
|
||||||
main
|
main
|
||||||
sed -i '' "s:EDid:${EDid}:g" $dpiFile
|
/usr/bin/sed -i "" "s:EDid:${EDid}:g" $dpiFile
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
hidpi.sh
30
hidpi.sh
@@ -14,6 +14,14 @@ cat << EEF
|
|||||||
|_| |_| |_____| |_____/ |_| |_____|
|
|_| |_| |_____| |_____/ |_| |_____|
|
||||||
|
|
||||||
============================================
|
============================================
|
||||||
|
|
||||||
|
Note: I don't have an external monitor to
|
||||||
|
test the script.If you have multiple monitors,
|
||||||
|
please run the script on a single monitor,
|
||||||
|
or cover the notebook when it is connected to the monitor.
|
||||||
|
|
||||||
|
============================================
|
||||||
|
|
||||||
EEF
|
EEF
|
||||||
#
|
#
|
||||||
VendorID=$(ioreg -l | grep "DisplayVendorID" | awk '{print $NF}')
|
VendorID=$(ioreg -l | grep "DisplayVendorID" | awk '{print $NF}')
|
||||||
@@ -91,14 +99,14 @@ exit 0
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ $Picon ]]; then
|
if [[ $Picon ]]; then
|
||||||
sed -i '' "s/VID/$Vid/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/VID/$Vid/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/PID/$Pid/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/PID/$Pid/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPX/${RP[0]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPX/${RP[0]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPY/${RP[1]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPY/${RP[1]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPW/${RP[2]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPW/${RP[2]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/RPH/${RP[3]}/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/RPH/${RP[3]}/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/PICON/$Picon/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/PICON/$Picon/g" $thisDir/tmp/Icons.plist
|
||||||
sed -i '' "s/DICON/$DICON/g" $thisDir/tmp/Icons.plist
|
/usr/bin/sed -i "" "s/DICON/$DICON/g" $thisDir/tmp/Icons.plist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -160,8 +168,8 @@ cat >> "$dpiFile" <<-\FFF
|
|||||||
</plist>
|
</plist>
|
||||||
FFF
|
FFF
|
||||||
|
|
||||||
sed -i '' "s/VID/$VendorID/g" $dpiFile
|
/usr/bin/sed -i "" "s/VID/$VendorID/g" $dpiFile
|
||||||
sed -i '' "s/PID/$ProductID/g" $dpiFile
|
/usr/bin/sed -i "" "s/PID/$ProductID/g" $dpiFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# end
|
# end
|
||||||
@@ -264,7 +272,7 @@ function enable_hidpi_with_patch()
|
|||||||
{
|
{
|
||||||
choose_icon
|
choose_icon
|
||||||
main
|
main
|
||||||
sed -i '' "s:EDid:${EDid}:g" $dpiFile
|
/usr/bin/sed -i "" "s:EDid:${EDid}:g" $dpiFile
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user