Skip to content

Latest commit

 

History

History
84 lines (71 loc) · 2.64 KB

InputSwitchHotkey.md

File metadata and controls

84 lines (71 loc) · 2.64 KB

Setup Hotkey to Switch Dell monitor between PCs

Windows PC

1) Install Dell Display Manager (DDM)

Currently here:

2) Install DDM Hotkey Manager (DDMHKM)

Currently here:

3) Configure the Hotkey

  • Run the downloaded ddmhkm.exe to start the DDM Hotkey Manager.
  • In the DDM command-line parameters box, type /1:SetActiveInput HDMI.
  • Click in the Select system-wide-hotkey, and press the hotkey combination.
  • Close the DDM Hotkey Manager.
  • Exit & Restart the Dell Display Manager.

Linux PC

1) Install ddcutil

sudo bash
apt install ddcutil

2) Allow runnning of ddcutil without Administrator prompt

cat <<EOF >/usr/share/polkit-1/actions/sh.fabi.pkexec.ddcutil.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>

    <action id="sh.fabi.pkexec.ddcutil">
    <message>Authentication is required to run the ddcutil</message>
    <icon_name>CHOOSEAGOODLOGO</icon_name>
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/ddcutil</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
  </action>

</policyconfig>
EOF
cat <<EOF >/usr/share/polkit-1/rules.d/49-ddcutil_nopass_tony.rules
polkit.addRule(function(action, subject) {
    if (action.id == "sh.fabi.pkexec.ddcutil" && subject.user == "tony") {
        return polkit.Result.YES;
    }
});
EOF

3) Create script to Switch Inputs

cat <<EOF >/usr/local/bin/switch-monitor-to-displayport.sh
#!/bin/bash
pkexec ddcutil setvcp 60 0x0f
EOF
chmod +x /usr/local/bin/switch-monitor-to-displayport.sh

4) Setup the Global Hotkey

Varies depending on Linux distro.

For Linux Mint:

  • Open Keyboard Settings > Shortcuts > Custom Shortcuts
  • Press Add custom shortcut button
  • In the Name: box, enter something like Switch Monitor To DisplayPort
  • In the Command: box, enter /usr/local/bin/switch-monitor-to-displayport.sh
  • Press the Add button
  • In the Keyboard bindings list, click on first unassigned slot
  • Press the hotkey combination