omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy-refresh-hyprland breaks kb_layout

Open y0no opened this issue 1 year ago • 5 comments

System details

Omarchy 3.0.2

What's wrong?

The command "omarchy-refresh-hyprland" reapply input.conf which overwrite kb_layout defined during installation by "install/config/detect-keyboard-layout.sh".

Maybe it could be interesting to modify omarchy-refresh-hyprland to handle this kind of case ?

y0no avatar Oct 17 '25 15:10 y0no

omarchy menu > update > config is for replacing user config with default config. In case you make wrong changes and want to revert to default.

Your config is renamed with .bak so you check what's wrong. You can literally see "Use default config" in the menu, in case you could read.

wekauwau avatar Oct 19 '25 04:10 wekauwau

I understand, but "omarchy-refresh-hyprland" is also used in some migrations.

The kb_layout is a default configuration applied by "install/config/detect-keyboard-layout.sh", maybe it could be a good idea to call this script after "omarchy-refresh-hyprland" no ?

y0no avatar Oct 19 '25 17:10 y0no

This is a really bad bug in my opinion. I was trying to learn Omarchy and Hyprland and I believe I selected Setup / Hyprland expecting it to open a configuration file where I could edit the Hyprland configuration to explore the options. Instead it quickly flashed a message saying my config was overwriten and where it was backed up to. I didn't get a change to see the backup location before the notification disappeared. Then I was left with US keyboard layout. Normally not a problem on any other Linux distribution as you would just select the correct layout in the taksbar or a graphical setup utility but on a distribution like Omarchy where keyboard input is the way to configure this leaves you in a bad position. My keyboard is not even US layout (it's a German layout) so now even the symbols on the keys are wrong and I don't know where the punctutanion keys are like ':' etc (which makes using Neovim extremely difficult). I have no reliable way to type anything as dvorak is the layout I normally use. So now trying to find out where this backup file is and trying to guess each character I type. It's very painful. I did manage to solve it in the end but it took many hours and keystroke guesses. I needed to add back the kb_variant = dvorak to the input.conf file.

Ether Omarchy needs to have an easy graphical way to configure the keyboard layout so that users can recover and still configure their system using the keyboard or the keyboard layout should never be reset directly from the main menu while the user is trying to explore all the Omarchy setup. A direct way to break your keyboard in 2 clicks from the main launcher menu without an easy way to recover is not a good idea.

NickJAllen avatar Nov 10 '25 06:11 NickJAllen

All settings in ~/.config/hypr/ are overwritten if needed (a backup copy is made).

A better approach may be to deliver the new config files with .new (analogous to .rpmnew). The problem with the suddenly changed keyboard layout would get fixed with this. But I don't know if it is essential to change the config files due to a new version of hypr.

qwertologe avatar Nov 21 '25 22:11 qwertologe

I implemented a workaround for me which relies on using git for your home or ~/.config. I start it if updating changed config files in hypr* or waybar.

#!/bin/bash -eu

cd ~/.config

dirs=(hypr waybar)
todos=()

echo '# Creating tar file...'
tar cfz backup.tar.gz ${dirs[*]}

for dir in ${dirs[*]}; do
  for bak_file in $(find $dir -name '*.bak.*'); do
    echo "# Processing $bak_file"
    config_file=${bak_file%.bak.*}
    upstream_file=$config_file.upstream
    mv $config_file $upstream_file 
    mv $bak_file $config_file
    if git ls-files --error-unmatch $upstream_file &>/dev/null; then
      if git diff -q $upstream_file; then
        echo "Upstream file $upstream_file is not modified"
      else
        if git diff $upstream_file | patch $config_file; then
          echo "Patching $config_file successful"
          todos+=("git difftool $config_file # verify changes")
        else
          echo "Patching $config_file failed"
          todos+=("meld $upstream_file $config_file # patch manually")
        fi
      fi
    else
      echo "Upstream file $upstream_file is not under version control - next time"
      todos+=("meld $upstream_file $config_file # patch manually")
    fi
  done
done

echo
echo '# TODO'
echo 'cd ~/.config'
printf '%s\n' "${todos[@]}"
echo "git status ${dirs[*]} # ..."

Don't use it if you don't understand how the script works and how to fix problems which might occur.

After using the script, you may need to restart services.

qwertologe avatar Nov 23 '25 21:11 qwertologe