3 Commits

Author SHA1 Message Date
2d7369d46c chore(changelog): update
All checks were successful
Code and build check / Check code (push) Successful in 1m21s
Code and build check / Build with uv (push) Successful in 48s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-11 18:28:27 +05:00
0587cf58ed feat(input_manager): open system overlay by Insert button
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-11 18:20:48 +05:00
58c7541fa3 feat(input_manager): rework gamepad buttons maping
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-11 18:16:08 +05:00
2 changed files with 24 additions and 21 deletions

View File

@@ -24,8 +24,9 @@
- Настройка автоматического перехода в полноэкранный режим при подключении геймпада (по умолчанию отключена) - Настройка автоматического перехода в полноэкранный режим при подключении геймпада (по умолчанию отключена)
- Обработчики для QMenu и QComboBox при управлении геймпадом - Обработчики для QMenu и QComboBox при управлении геймпадом
- Аргумент `--fullscreen` для запуска приложения в полноэкранном режиме - Аргумент `--fullscreen` для запуска приложения в полноэкранном режиме
- Оверлей на кнопку Xbox/PS для закрытия приложения, выключения, перезагрузки и перехода в спящий режим - Оверлей на кнопку Insert или кнопку Xbox/PS на геймпаде для закрытия приложения, выключения, перезагрузки и перехода в спящий режим или между сессиями
- [Gamescope сессия](https://git.linux-gaming.ru/Boria138/gamescope-session-portprotonqt) - [Gamescope сессия](https://git.linux-gaming.ru/Boria138/gamescope-session-portprotonqt)
- Мапинги управления для Dualshock 4 и DualSense
### Changed ### Changed
- Обновлены все иконки - Обновлены все иконки

View File

@@ -34,19 +34,18 @@ class MainWindowProtocol(Protocol):
current_exec_line: str | None current_exec_line: str | None
current_add_game_dialog: QDialog | None current_add_game_dialog: QDialog | None
# Mapping of actions to evdev button codes, includes PlayStation, Xbox controllers # Mapping of actions to evdev button codes, includes Xbox and Playstation controllers
# https://github.com/torvalds/linux/blob/master/drivers/hid/hid-playstation.c # https://github.com/torvalds/linux/blob/master/drivers/hid/hid-playstation.c
# https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c # https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c
BUTTONS = { BUTTONS = {
'confirm': {ecodes.BTN_A, ecodes.BTN_SOUTH}, 'confirm': {ecodes.BTN_A, ecodes.BTN_SOUTH}, # A / Cross
'back': {ecodes.BTN_B, ecodes.BTN_EAST}, 'back': {ecodes.BTN_B, ecodes.BTN_EAST}, # B / Circle
'add_game': {ecodes.BTN_Y, ecodes.BTN_NORTH}, 'add_game': {ecodes.BTN_Y, ecodes.BTN_NORTH}, # Y / Triangle
'prev_tab': {ecodes.BTN_TL}, 'prev_tab': {ecodes.BTN_TL}, # LB / L1
'next_tab': {ecodes.BTN_TR}, 'next_tab': {ecodes.BTN_TR}, # RB / R1
'confirm_stick': {ecodes.BTN_THUMBL, ecodes.BTN_THUMBR}, 'context_menu': {ecodes.BTN_START}, # Start / Options
'context_menu': {ecodes.BTN_START}, 'menu': {ecodes.BTN_SELECT}, # Select / Share
'menu': {ecodes.BTN_SELECT}, 'guide': {ecodes.BTN_MODE}, # Xbox / PS Home
'guide': {ecodes.BTN_MODE, ecodes.KEY_HOMEPAGE},
} }
class InputManager(QObject): class InputManager(QObject):
@@ -149,19 +148,19 @@ class InputManager(QObject):
# Handle QMenu (context menu) # Handle QMenu (context menu)
if isinstance(popup, QMenu): if isinstance(popup, QMenu):
if button_code in BUTTONS['confirm'] or button_code in BUTTONS['confirm_stick']: if button_code in BUTTONS['confirm']:
if popup.activeAction(): if popup.activeAction():
popup.activeAction().trigger() popup.activeAction().trigger()
popup.close() popup.close()
return return
elif button_code in BUTTONS['back'] or button_code in BUTTONS['menu']: elif button_code in BUTTONS['back']:
popup.close() popup.close()
return return
return return
# Handle QComboBox # Handle QComboBox
if isinstance(focused, QComboBox): if isinstance(focused, QComboBox):
if button_code in BUTTONS['confirm'] or button_code in BUTTONS['confirm_stick']: if button_code in BUTTONS['confirm']:
focused.showPopup() focused.showPopup()
return return
@@ -175,7 +174,7 @@ class InputManager(QObject):
break break
parent = parent.parentWidget() parent = parent.parentWidget()
if button_code in BUTTONS['confirm'] or button_code in BUTTONS['confirm_stick']: if button_code in BUTTONS['confirm']:
idx = focused.currentIndex() idx = focused.currentIndex()
if idx.isValid(): if idx.isValid():
if combo: if combo:
@@ -221,18 +220,17 @@ class InputManager(QObject):
return return
# Game launch on detail page # Game launch on detail page
if (button_code in BUTTONS['confirm'] or button_code in BUTTONS['confirm_stick']) and self._parent.currentDetailPage is not None and self._parent.current_add_game_dialog is None: if (button_code in BUTTONS['confirm']) and self._parent.currentDetailPage is not None and self._parent.current_add_game_dialog is None:
if self._parent.current_exec_line: if self._parent.current_exec_line:
self._parent.toggleGame(self._parent.current_exec_line, None) self._parent.toggleGame(self._parent.current_exec_line, None)
return return
# Standard navigation # Standard navigation
if button_code in BUTTONS['confirm'] or button_code in BUTTONS['confirm_stick']: if button_code in BUTTONS['confirm']:
self._parent.activateFocusedWidget() self._parent.activateFocusedWidget()
elif button_code in BUTTONS['back'] or button_code in BUTTONS['menu']: elif button_code in BUTTONS['back']:
self._parent.goBackDetailPage(getattr(self._parent, 'currentDetailPage', None)) self._parent.goBackDetailPage(getattr(self._parent, 'currentDetailPage', None))
elif button_code in BUTTONS['add_game']: elif button_code in BUTTONS['add_game']:
# Only open AddGameDialog if in library tab (index 0)
if self._parent.stackedWidget.currentIndex() == 0: if self._parent.stackedWidget.currentIndex() == 0:
self._parent.openAddGameDialog() self._parent.openAddGameDialog()
elif button_code in BUTTONS['prev_tab']: elif button_code in BUTTONS['prev_tab']:
@@ -493,6 +491,12 @@ class InputManager(QObject):
focused = QApplication.focusWidget() focused = QApplication.focusWidget()
popup = QApplication.activePopupWidget() popup = QApplication.activePopupWidget()
# Open system overlay with Insert
if key == Qt.Key.Key_Insert:
if not popup and not isinstance(QApplication.activeWindow(), QDialog):
self._parent.openSystemOverlay()
return True
# Close application with Ctrl+Q # Close application with Ctrl+Q
if key == Qt.Key.Key_Q and modifiers & Qt.KeyboardModifier.ControlModifier: if key == Qt.Key.Key_Q and modifiers & Qt.KeyboardModifier.ControlModifier:
app.quit() app.quit()
@@ -791,9 +795,7 @@ class InputManager(QObject):
continue continue
now = time.time() now = time.time()
if event.type == ecodes.EV_KEY and event.value == 1: if event.type == ecodes.EV_KEY and event.value == 1:
# Обработка кнопки Select для переключения полноэкранного режима
if event.code in BUTTONS['menu']: if event.code in BUTTONS['menu']:
# Переключаем полноэкранный режим
self.toggle_fullscreen.emit(not self._is_fullscreen) self.toggle_fullscreen.emit(not self._is_fullscreen)
else: else:
self.button_pressed.emit(event.code) self.button_pressed.emit(event.code)