Using Variables

Do you want one config to rule them all? Then consider using variables:

~/x11.wks
:var "PASTE_COMMAND" "xclip -o -selection clipboard"
~/wayland.wks
:var "PASTE_COMMAND" "wl-paste"
~/main.wks
:include "wayland.wks"
u "Url Handler"
{
    f "Firefox" %{{firefox "$(%(PASTE_COMMAND))"}}
    m "mpv"     %{{mpv     "$(%(PASTE_COMMAND))"}}
}
~/main.wks
u "Url Handler"
{
    f "Firefox" %{{firefox "$(wl-paste)"}}
    m "mpv"     %{{mpv     "$(wl-paste)"}}
}

In this example, we use a variable to represent an abstract PASTE_COMMAND. We define this variable in an environment-specific wks file. Now, it’s easy to move between environments by simply changing the included wks file.

See also

Read the complete documentation on the :var macro here.