Skip to content

Add lightweight hook mode

Compare
Choose a tag to compare
@Misterio77 Misterio77 released this 02 Mar 07:08
· 76 commits to master since this release

Hey folks, a quick and small feature i noticed was interesting when trying out fzf as a scheme chooser.

You can now specify whether configuration items are lightweight or not. They default to light=true, that is, all items are light enough unless you explicitly tell flavours otherwise.
When running apply, you can use flavours apply --light to only run lightweight hooks, that is, skip any hooks you marked as heavy-duty.

This enables you to do some pretty cool stuff, such as using fzf's --preview to seamlessly (really, flavours is insanely fast) preview schemes on the fly (while skipping hooks that take a second or so to run, such as sway's reload), and only run the non-lightweight hooks after you're done selecting.

How it looks:
Usage

For anyone interested, this fuzzy selector can easily be done with:
flavours list -l | fzf --preview='flavours apply -l {}'

If you want something more advanced (revert to previous scheme when fzf is closed with esc, run flavours apply on non-lightweight mode after selecting), it's quite simple too:

old="$(flavours current)"
flavours list -l | fzf --preview='flavours apply -l {}' || \
flavours apply "${old}" && \
flavours apply "$(flavours current)"