mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
Merge pull request #1928 from r3claimer/next
Add hotkey support to swap the outout display on devices like the thor
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
FIRMWARE=""
|
||||
|
||||
# Additional packages to install
|
||||
ADDITIONAL_PACKAGES="u-boot"
|
||||
ADDITIONAL_PACKAGES="u-boot screen-switch"
|
||||
|
||||
# Debug tty path
|
||||
DEBUG_TTY="/dev/ttyMSM0"
|
||||
|
||||
16
projects/ROCKNIX/packages/apps/screen-switch/package.mk
Normal file
16
projects/ROCKNIX/packages/apps/screen-switch/package.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
|
||||
|
||||
PKG_NAME="screen-switch"
|
||||
PKG_VERSION="1.0"
|
||||
PKG_LICENSE="GPLv3"
|
||||
PKG_DEPENDS_TARGET="toolchain sway"
|
||||
PKG_LONGDESC="A simple script to swap sway output screens"
|
||||
PKG_TOOLCHAIN="manual"
|
||||
PKG_PATCH_DIRS+="${DEVICE}"
|
||||
|
||||
makeinstall_target() {
|
||||
mkdir -p ${INSTALL}/usr/bin
|
||||
cp -rf ${PKG_DIR}/scripts/screen_switch ${INSTALL}/usr/bin
|
||||
chmod 0755 ${INSTALL}/usr/bin/*
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/profile
|
||||
|
||||
# Get the active app_id
|
||||
ACTIVE_APPID=$(swaymsg -t get_tree | awk '
|
||||
/"focused": true/ {focused=1}
|
||||
focused && /app_id/ {gsub(/.*"app_id": *"/,""); gsub(/".*/,""); print; exit}
|
||||
')
|
||||
|
||||
UDSI=$(swaymsg -t get_tree | jq -r '.. | objects | select(.type == "output" and .name != "__i3") | select(.nodes[].nodes | length == 0) | .name')
|
||||
|
||||
swaymsg [app_id=\"${ACTIVE_APPID}\"] move window to output ${UDSI}
|
||||
@@ -69,6 +69,7 @@ FUNCTION_HOTKEY_C_EVENT='*('${BTN_HOTKEY_C_MODIFIER}'), value *'
|
||||
|
||||
FUNCTION_HOTKEY_BTN_WEST_EVENT="*(BTN_WEST), value 1*"
|
||||
FUNCTION_HOTKEY_BTN_EAST_EVENT="*(BTN_EAST), value 1*"
|
||||
FUNCTION_HOTKEY_BTN_BACK_EVENT="*(BTN_BACK), value 1*"
|
||||
|
||||
FUNCTION_HOTKEY_TOUCH_EVENT="*(BTN_TOUCH), value 1*"
|
||||
|
||||
@@ -456,5 +457,11 @@ set +e
|
||||
/usr/bin/mangohud_set toggle
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
(${FUNCTION_HOTKEY_BTN_BACK_EVENT})
|
||||
if [ "${HOTKEY_A_PRESSED}" = true ]; then
|
||||
${DEBUG} && log $0 "${FUNCTION_HOTKEY_BTN_BACK_EVENT}: Switch Screen Output"
|
||||
/usr/bin/screen_switch
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user