Last active
July 28, 2023 23:51
-
-
Save Jeff-Soares/4a5f5ca7f8d67e7b57fa6a34985b8236 to your computer and use it in GitHub Desktop.
powershell script to change device pixel density and font scale through shortcuts (target: pwsh -command "& 'C:\..\density.ps1' +")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$param = $args[0] | |
$density_output = adb shell wm density | |
$matches = ([regex]'\d+').Matches($density_output) | |
$current_density = [int] $matches[$matches.size - 1].Value | |
if ($param -eq "-") { | |
adb shell wm density ($current_density - 50) | |
} elseif ($param -eq "+") { | |
adb shell wm density ($current_density + 50) | |
} else { | |
adb shell wm density reset | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$param = $args[0] | |
$current_font_scale = [float] (adb shell settings get system font_scale) | |
if ($param -eq "-") { | |
adb shell settings put system font_scale ($current_font_scale - 0.15) | |
} elseif ($param -eq "+") { | |
adb shell settings put system font_scale ($current_font_scale + 0.15) | |
} else { | |
adb shell settings put system font_scale 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment