Skip to content

Commit

Permalink
fix(deck): Use super + 1/2 for Overlay/QAM (#1724)
Browse files Browse the repository at this point in the history
* fix(deck): Use super 1/2 for overlay/qam

* fix(deck): fix filename in spec files

* fix(deck): fix filename in spec files

* fix(deck): keep ctrl modifier as an option, default on
  • Loading branch information
AkazaRenn authored Oct 7, 2024
1 parent 3874ec2 commit cb4cddb
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 42 deletions.
2 changes: 1 addition & 1 deletion spec_files/gamescope/gamescope-legacy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Source2: https://github.com/Joshua-Ashton/reshade/archive/%{reshade_commi
Patch0: 0001-cstdint.patch

# https://hhd.dev/
Patch1: v2-0001-always-send-ctrl-1-2-to-steam-s-wayland-session.patch
Patch1: v2-0001-steam-overlay-hotkeys.patch

# ChimeraOS
Patch2: legacy-720p.patch
Expand Down
2 changes: 1 addition & 1 deletion spec_files/gamescope/gamescope.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Patch1: chimeraos.patch

# https://hhd.dev/
Patch2: disable-steam-touch-click-atom.patch
Patch3: v2-0001-always-send-ctrl-1-2-to-steam-s-wayland-session.patch
Patch3: v2-0001-steam-overlay-hotkeys.patch

# https://github.com/ValveSoftware/gamescope/issues/1369
Patch4: revert-299bc34.patch
Expand Down

This file was deleted.

44 changes: 44 additions & 0 deletions spec_files/gamescope/v2-0001-steam-overlay-hotkeys.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 3535c9b..d29a3d5 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -290,6 +290,9 @@ static void wlserver_handle_modifiers(struct wl_listener *listener, void *data)
bump_input_counter();
}

+// false if GS_ENABLE_CTRL_12 exists and is 0, true otherwise
+bool env_gs_enable_ctrl_12 = getenv("GS_ENABLE_CTRL_12") ? (getenv("GS_ENABLE_CTRL_12")[0] != '0') : true;
+
static void wlserver_handle_key(struct wl_listener *listener, void *data)
{
struct wlserver_keyboard *keyboard = wl_container_of( listener, keyboard, key );
@@ -310,7 +313,14 @@ static void wlserver_handle_key(struct wl_listener *listener, void *data)
keysym == XKB_KEY_XF86AudioLowerVolume ||
keysym == XKB_KEY_XF86AudioRaiseVolume ||
keysym == XKB_KEY_XF86PowerOff;
- if ( ( event->state == WL_KEYBOARD_KEY_STATE_PRESSED || event->state == WL_KEYBOARD_KEY_STATE_RELEASED ) && forbidden_key )
+
+ // Check for steam overlay key (ctrl/super + 1/2)
+ bool is_steamshortcut =
+ ((env_gs_enable_ctrl_12 && (keyboard->wlr->modifiers.depressed & WLR_MODIFIER_CTRL)) ||
+ (keyboard->wlr->modifiers.depressed & WLR_MODIFIER_LOGO)) &&
+ (keysym == XKB_KEY_1 || keysym == XKB_KEY_2);
+
+ if ( ( event->state == WL_KEYBOARD_KEY_STATE_PRESSED || event->state == WL_KEYBOARD_KEY_STATE_RELEASED ) && (forbidden_key || is_steamshortcut) )
{
// Always send volume+/- to root server only, to avoid it reaching the game.
struct wlr_surface *old_kb_surf = wlserver.kb_focus_surface;
@@ -319,6 +329,13 @@ static void wlserver_handle_key(struct wl_listener *listener, void *data)
{
wlserver_keyboardfocus( new_kb_surf, false );
wlr_seat_set_keyboard( wlserver.wlr.seat, keyboard->wlr );
+ if (is_steamshortcut)
+ {
+ // send ctrl down modifier to trigger the overlay
+ wlr_keyboard_modifiers ctrl_down_modifier;
+ ctrl_down_modifier.depressed = WLR_MODIFIER_CTRL;
+ wlr_seat_keyboard_notify_modifiers(wlserver.wlr.seat, &ctrl_down_modifier);
+ }
wlr_seat_keyboard_notify_key( wlserver.wlr.seat, event->time_msec, event->keycode, event->state );
wlserver_keyboardfocus( old_kb_surf, false );
return;
3 changes: 3 additions & 0 deletions system_files/deck/shared/etc/environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ EDITOR=/usr/bin/vim

# Disable Brew auto-update
HOMEBREW_NO_AUTO_UPDATE=1

# Passthrough ctrl + 1/2 ingame
#GS_ENABLE_CTRL_12=0

0 comments on commit cb4cddb

Please sign in to comment.