Amethyst icon indicating copy to clipboard operation
Amethyst copied to clipboard

Defaults Collision with Custom Config

Open Indyandie opened this issue 1 year ago • 7 comments

If a command (mod+key) is set in default.amethyst and the same command is reused in a custom configuration file neither will work.

To Reproduce

  1. create a custom config file at ~/.config/amethyst/amethyst.yml
  2. Add this to your file
    select-two-pane-layout:
      mod: mod1
      key: s
    
  3. Relaunch Amethyst
  4. press mod1+s
  5. Nothing happens...

Expected behavior The custom configuration command should override the default without issues.

Versions:

  • macOS: 12.6.3
  • Amethyst: 0.17.0

Additional context Initial discussion #1384

Indyandie avatar Feb 12 '23 05:02 Indyandie

In fact, all defaults are recreated on each relaunch if using custom configuration file ~/.amethyst.yml To Repoduce:

  1. Set any custom configuration file without cycle-layout setting key
  2. Remove shortcut for cycle-layout via in-app preferences
  3. Relaunch amethyst
  4. Check shortcuts via in-app preferences and voilá, the shortcut for cycle-layout is set again to its default.

Expected behavior updated shortcuts via in-app preferences should not be reseted to defaults on each relaunch

Versions:

  • macos 12.5.1
  • amthyst 0.19.0 (103)

final notes: this issue is not reproduced if there is no custom configuration file. shortcuts remains as unset after relaunch, despite has its default

maybe related with #1329

vicmunoz avatar Mar 25 '23 22:03 vicmunoz

Adding my 2 cents, I was struggling because I was trying to configure the 3Column Middle layout to work with mod1+s and thought it was related to this issue. Setting this (as the docs suggest) didn't work:

select-3column-middle-layout:
  mod: mod1
  key: s

But here, the issue is different. The root cause for this is that the layout is named '3Column Middle', but it has configured middle-wide as layoutKey as seen here.

Based on this, configuring the following snippet worked well:

# The default select-wide-layout keybinding is mod1+s, so I need to reassign
# it to another one, so I can later use the original.
select-wide-layout:
  mod: mod2
  key: x

# Assign the desired keybinding to the middle-layout.
# Make sure you have middle-wide in your layout list.
select-middle-wide-layout:
  mod: mod1
  key: s

I'm happy to add more details about this in the README if needed because there's info saying that "3Column Middle" was previously named "Middle Wide", but didn't find something saying that we should configure it that way in our configuration file.

roeeyn avatar Jun 21 '23 04:06 roeeyn

Thanks @roeeyn your solution helped me find a work around for my original issue.

By giving select-wide-layout a new shortcut, the default shortcut becomes available.

select-wide-layout:
  mod: mod1
  key: "0"

select-two-pane-layout:
  mod: mod1
  key: "s"

Indyandie avatar Oct 08 '23 02:10 Indyandie

I am probably experiencing a similar bug but mine isn't the same of the defaults, specifically, this is my file,

amethyst.yml.txt

To ensure the problem isn't stateful, defaults delete com.amethyst.Amethyst.plist is run and the following behavior would still occur:

Namely, I mapped mod1 + a,s,d,f to Select fullscreen layout, Select bsp layout, Select wide layout, Select floating layout respectively, and only the mod1 + s,d work but mod1 + a,f doesn't. The default of the latter is mapping to Select tall layout, Select column layout so it isn't the same as defaults (and in fact I didn't enable tall nor column in my layouts key.)

Even more strangely, at one point this (config file) actually works for mod1 + a,s,d,f, but it has other problems. Restarting Amethyst didn't help (mod2 + z wasn't even registered) and that's when I ran defaults delete com.amethyst.Amethyst.plist and after that I consistently see the above behavior.

Edit: probably unrelated to this issue. See https://github.com/ianyh/Amethyst/issues/1419#issuecomment-1902810820 for fixes in this particular case.

ickc avatar Jan 21 '24 19:01 ickc

FYI, you can unset default values like:

focus-screen-1:
  mod: ""
  key: ""

@Indyandie using the above can you try:

select-wide-layout:
  mod: ""
  key: ""

select-two-pane-layout:
  mod: mod1
  key: s

cowboy-bebug avatar Jan 21 '24 23:01 cowboy-bebug

Perhaps that was replying to me?

Thanks. That works. Perhaps it is unrelated to this issue. Sorry for the noise.

ickc avatar Jan 22 '24 02:01 ickc

it worked for me. Thanks for the hint @cowboy-bebug!

Indyandie avatar Feb 07 '24 06:02 Indyandie