2024-09-19 14:19:46 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Victor Fuentes <vmfuentes64@gmail.com>
|
|
|
|
Date: Thu, 1 Aug 2024 16:03:14 -0400
|
|
|
|
Subject: [PATCH] Fix setting the kayboard layout on GNOME wayland.
|
|
|
|
|
|
|
|
By default the module uses the setxkbmap, which will not change the
|
|
|
|
keyboard
|
|
|
|
---
|
|
|
|
src/modules/keyboard/Config.cpp | 7 ++++++-
|
|
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp
|
2024-09-19 14:19:46 +00:00
|
|
|
index ad6bee6f7..4d43abe53 100644
|
2022-06-16 17:23:12 +00:00
|
|
|
--- a/src/modules/keyboard/Config.cpp
|
|
|
|
+++ b/src/modules/keyboard/Config.cpp
|
2024-04-21 15:54:59 +00:00
|
|
|
@@ -307,7 +307,10 @@ Config::xkbApply()
|
|
|
|
xkbmap_layout_args( { m_additionalLayoutInfo.additionalLayout, m_selectedLayout },
|
2022-06-16 17:23:12 +00:00
|
|
|
{ m_additionalLayoutInfo.additionalVariant, m_selectedVariant },
|
|
|
|
m_additionalLayoutInfo.groupSwitcher ) );
|
|
|
|
-
|
|
|
|
+ QString xkbmap = QString( "[('xkb','%1\%2'),('xkb','%3\%4')]").arg(
|
2024-04-21 15:54:59 +00:00
|
|
|
+ m_selectedLayout, ((!m_selectedVariant.isEmpty()) ? "+" + m_selectedVariant : ""),
|
|
|
|
+ m_additionalLayoutInfo.additionalLayout, ((!m_additionalLayoutInfo.additionalVariant.isEmpty()) ? "+" + m_additionalLayoutInfo.additionalVariant : ""));
|
2022-06-16 17:23:12 +00:00
|
|
|
+ QProcess::execute( "sh", { "-c", "if command -v gsettings; then gsettings set org.gnome.desktop.input-sources sources \"$0\"; fi", xkbmap });
|
|
|
|
cDebug() << "xkbmap selection changed to: " << m_selectedLayout << '-' << m_selectedVariant << "(added "
|
|
|
|
<< m_additionalLayoutInfo.additionalLayout << "-" << m_additionalLayoutInfo.additionalVariant
|
|
|
|
<< " since current layout is not ASCII-capable)";
|
2024-04-21 15:54:59 +00:00
|
|
|
@@ -315,6 +318,8 @@ Config::xkbApply()
|
2022-06-16 17:23:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
QProcess::execute( "setxkbmap", xkbmap_layout_args( m_selectedLayout, m_selectedVariant ) );
|
|
|
|
+ QString xkbmap = QString( "[('xkb','%1\%2')]").arg( m_selectedLayout, ((!m_selectedVariant.isEmpty()) ? "+" + m_selectedVariant : "") );
|
|
|
|
+ QProcess::execute( "sh", { "-c", "if command -v gsettings; then gsettings set org.gnome.desktop.input-sources sources \"$0\"; fi", xkbmap });
|
|
|
|
cDebug() << "xkbmap selection changed to: " << m_selectedLayout << '-' << m_selectedVariant;
|
|
|
|
}
|
|
|
|
m_setxkbmapTimer.disconnect( this );
|