Merge pull request #172967 from vlinkz/calamares_waylandkbd

calamares: fix keyboard switching on GNOME wayland
main
Jörg Thalheim 2 years ago committed by GitHub
commit 2b1f703bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      pkgs/tools/misc/calamares/default.nix
  2. 25
      pkgs/tools/misc/calamares/waylandkbd.patch

@ -33,6 +33,9 @@ mkDerivation rec {
./uimod.patch
# Remove options for unsupported partition types
./partitions.patch
# Fix setting the kayboard layout on GNOME wayland
# By default the module uses the setxkbmap, which will not change the keyboard
./waylandkbd.patch
];
nativeBuildInputs = [ cmake extra-cmake-modules ];
@ -57,7 +60,7 @@ mkDerivation rec {
sed -e "s,pkexec calamares,calamares," \
-i calamares.desktop
sed -e "s,X-AppStream-Ignore=true,&\nStartupWMClass=io.calamares.calamares," \
sed -e "s,X-AppStream-Ignore=true,&\nStartupWMClass=calamares," \
-i calamares.desktop
# Fix desktop reference with wayland

@ -0,0 +1,25 @@
diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp
index 720588810..af0dd1c8d 100644
--- a/src/modules/keyboard/Config.cpp
+++ b/src/modules/keyboard/Config.cpp
@@ -219,7 +219,10 @@ Config::xkbApply()
{ m_additionalLayoutInfo.additionalVariant, m_selectedVariant },
m_additionalLayoutInfo.groupSwitcher ) );
-
+ QString xkbmap = QString( "[('xkb','%1\%2'),('xkb','%3\%4')]").arg(
+ m_selectedLayout, ((!m_selectedVariant.isEmpty()) ? "+" + m_selectedVariant : ""),
+ m_additionalLayoutInfo.additionalLayout, ((!m_additionalLayoutInfo.additionalVariant.isEmpty()) ? "+" + m_additionalLayoutInfo.additionalVariant : ""));
+ 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)";
@@ -227,6 +230,8 @@ Config::xkbApply()
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 );
Loading…
Cancel
Save