Wait for Logitech G Hub to be installed
do {
Start-Sleep -Seconds 1
} until (Get-Command "LogiOverlay.exe" -ErrorAction SilentlyContinue)
Set DPI to 800 at a report rate of 1000
GHubExePath = (Get-ChildItem "C:\Program Files\LGHUB\app\*" -Include "lghub_agent.exe" -Recurse -ErrorAction SilentlyContinue).FullName
& GHubExePath /commands='{"settings":{"dpi_value":"800","dpi_report_rate":"1000"}}'
Remove other DPI settings
GHubProfilePath=Join−Path(Get−ChildItem"env:LOCALAPPDATA\LGHUB\profiles*" | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName "profile.json"
(Get-Content GHubProfilePath -Raw) | ConvertFrom-Json |
ForEach-Object { .settings.dpi = [ordered]@{ "1" = _.settings.dpi."1" }; } |
ConvertTo-Json -Depth 5 | Set-Content $GHubProfilePath -Force
Disable DPI shift button
& $GHubExePath /commands='{"settings":{"dpi_shift_button_type":"0"}}'
Create "Win D" macro
& $GHubExePath /commands='{"macros":[{"name":"Win D","commands":[{"type":1,"value":"{KEY_WIN DOWN}{KEY_D DOWN}{KEY_WIN UP}{KEY_D UP}"}]}]}'
Create "Discord" macro
& $GHubExePath /commands='{"macros":[{"name":"Discord","commands":[{"type":1,"value":"{KEY_SHIFT DOWN}{KEY_F12 DOWN}{KEY_SHIFT UP}{KEY_F12 UP}"}]}]}'
Set lighting to red
& $GHubExePath /commands='{"settings":{"lighting":{"color":{"color_id":"19"},"devices":[{"zone":"logo","mode_id":"14"},{"zone":"side_lighting","mode_id":"14"}]}}}'