Thursday, January 31, 2019

Logitech Gamepad Windows Control

So I'm posting this in case that someone wants to control Windows with a gamepad. I made this configuration thinking about basic Internet and file browsing. I've been using it for a while and I really like it.
 
There's also room for improvement in case you want to modify it to your needs (for example the thumb stick click buttons can be easily changed to more relevant commands).

Some things you can do with these settings are: control your mouse, navigate through folders also with back and forward buttons, cut/copy (toggle) and paste files, select multiple files (with CTRL+CLICK or the mouse pointer), raise or lower the volume, scroll Internet videos (LEFT/RIGHT D-Pad buttons), open/close/minimize and restore windows or open and close browser tabs.

Also you can delete and rename files via the right click menu. And many other things.

It works with any version of Windows that supports the Logitech Profiler software but it is not limited to Logitech gamepads (it's basically the same as an XBOX gamepad controller), I included a picture that shows how the keys are set up.

So let's get started.

First you need the configuration file, copy this code and save it as Gamepad.xml with a text editor like Notepad. Make sure the file is not saved as a .txt file.

Then open Logitech Profiler from the taskbar and go to "Profile / Import...", find the file and load it. Remember that the gamepad must be set to DirectInput (the letter D on the selector switch) in order to open the profiler.

In the window that pops up make sure it says "Windows" as the name, then in the "Browse" section type "C:\Windows\explorer.exe" or click the "Browse" button and find "explorer.exe". This is the program that Logitech Profiler will apply the profile to. You can select other program but it has to be one that is open and focused all the time you will be using the gamepad to control Windows. This is how Logitech Profiler applies profiles to games or programs.



The icon can be the default one, finally click "OK".

Go to "Options / Global Profiler Settings... / Apply persistent profile" and choose "Windows", click OK.

The controller should be working now, just make sure the Logitech Profiler window is not in focus (click outside of it or close it), otherwise the gamepad won't do anything.

Optional:
Now, to control the volume with the D-Pad we need alternative software since Windows doesn't support volume control via shortcuts, so what we need to do is create a script, the process is relatively easy.

Download and install AutoHotkey from here: https://www.autohotkey.com/download

Then paste this script in a text editor like Notepad:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#NoTrayIcon
#PgUp::Send {Volume_Up 1}
#PgDn::Send {Volume_Down 1}

Save it as volume.ahk (make sure it's not saved as a .txt file) and to compile it simply right click the file and select "Compile Script".

You will get a volume.exe file which is your executable file, place it on this path (you can paste the path in the Windows Explorer adress bar): "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup"

Or for the sake of clarity "C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" (replace USERNAME with you Windows username).

What this does is to load the script automatically every time your computer starts.

Once the "volume.exe" executable file is inside the folder double click it, it should load and the volume keys in the D-Pad (UP/DOWN) should work now. If they don't work just make sure to click a button (A, B, X, or Y) to wake up the controller, clicking D-Pad buttons won't wake it.

Note: You may want to know this in case you have other AutoHotkey shortcuts or other software that manages shortcuts.

For reference, the Gamepad.xml profile has 2 shortcuts that it uses to trigger the the volume keys configured in AutoHotkey ("WINDOWS-LEFT + PAGE-UP" and "WINDOWS-LEFT + PAGE-DOWN"), this shouldn't affect anything negatively because Windows doesn't use those shortcuts for anything since using PAGE-UP and PAGE-DOWN doesn't require WINDOWS-LEFT to be pressed.

I choose those keys because if you don't want to use the AutoHotkey volume script then you can use the D-Pad UP/DOWN keys as regular PAGE-UP and PAGE-DOWN keys without any extra configuration.

If you uninstall AutoHotkey, your script will keep working since it's an executable now and to "uninstall it" you simply remove it from the Startup folder.

No comments: