Escape character help required

I am trying to do the following in home.nix:

services.sxhkd.keybindings = {
  "ctrl + Escape" = "rofi -show run -theme-str 'window { width: 20%; }'";
};

but am getting the following error in rofi:

Error while parsing theme: window  width: 20% ;
Parser error: syntax error, unexpected invalid element name, expecting "bracket open ('{')" or "Selector separator (',')"

I’m sure I need to do some escaping, but everything I have tried hasn’t worked.

do any of the escaping in these examples help?

https://sourcegraph.com/search?q=context:global+services.sxhkd.keybindings&patternType=literal

and

you made a typo!

); instead of };

oh yeah… well spotted… you get cookie.

:cookie:

1 Like

Yes I did, and I just edited my post, but that is not related my issue.

this doesn’t look like a problem with escaping at the nix level, but escaping at the sxhkd level. from a cursory check of the arch wiki it looks like {} need to be escaped with \, ie write \\{ ... \\} in your config

2 Likes

Awesome. Thanks @pennae . You nailed it.