Skip to content

Commit

Permalink
Ally keybindings #3549
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Jan 5, 2025
1 parent 5273813 commit 2c4a065
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions app/Ally/AllyControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ public class AllyControl
public const string BindBrightnessUp = "04-04-8C-88-8A-06";
public const string BindXGM = "04-04-8C-88-8A-04";
public const string BindToggleMode = "04-04-8C-88-8A-0C";
public const string BindToggleTouchScreen = "04-04-8C-88-8A-0B";

public const string BindOverlay = "04-03-8C-88-44";

public const string BindShiftTab = "04-02-88-0D";
public const string BindAltTab = "04-02-8A-0D";
public const string BindWinTab = "04-02-82-0D";

public const string BindVolUp = "05-03";
public const string BindVolDown = "05-02";
Expand Down Expand Up @@ -156,6 +158,7 @@ public class AllyControl
{ BindXB, "XBox/Steam" },

{ BindToggleMode, "Controller Mode" },
{ BindToggleTouchScreen, "Toggle TouchScreen" },

{ BindVolUp, "Vol Up" },
{ BindVolDown, "Vol Down" },
Expand All @@ -171,6 +174,7 @@ public class AllyControl
{ BindCloseWindow, "Close Window" },
{ BindShiftTab, "Shift-Tab" },
{ BindAltTab, "Alt-Tab" },
{ BindWinTab, "Win-Tab" },
{ BindXGM, "XGM Toggle" },


Expand Down
23 changes: 16 additions & 7 deletions app/Input/InputDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void RegisterKeys()
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F4);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F6);
}

// FN-Lock group
Expand Down Expand Up @@ -456,6 +457,9 @@ public void KeyPressed(object sender, KeyPressedEventArgs e)
case Keys.F4:
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
break;
case Keys.F6:
ToggleTouchScreen();
break;
case Keys.F7:
SetScreenpad(-10);
break;
Expand Down Expand Up @@ -605,20 +609,25 @@ public static void KeyProcess(string name = "m3")
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
break;
case "touchscreen":
var status = !TouchscreenHelper.GetStatus();
Logger.WriteLine("Touchscreen status: " + status);
if (status is not null)
{
Program.toast.RunToast(Properties.Strings.Touchscreen + " " + ((bool)status ? Properties.Strings.On : Properties.Strings.Off), ToastIcon.Touchpad);
TouchscreenHelper.ToggleTouchscreen((bool)status);
}
ToggleTouchScreen();
break;
default:
break;
}
}


static void ToggleTouchScreen()
{
var status = !TouchscreenHelper.GetStatus();
Logger.WriteLine("Touchscreen status: " + status);
if (status is not null)
{
Program.toast.RunToast(Properties.Strings.Touchscreen + " " + ((bool)status ? Properties.Strings.On : Properties.Strings.Off), ToastIcon.Touchpad);
TouchscreenHelper.ToggleTouchscreen((bool)status);
}
}

static void ToggleMic()
{
bool muteStatus = Audio.ToggleMute();
Expand Down

0 comments on commit 2c4a065

Please sign in to comment.