Skip to content

v0.10.0

Compare
Choose a tag to compare
@vinnymeller vinnymeller released this 01 Jun 06:18
· 20 commits to master since this release
v0.10.0
fd327b8

What's Changed

Performance

twm is multithreaded now, using jwalk instead of WalkDir and using Rayon directly to process workspace matches.

Didn't do any super scientific benchmarks but I've seen anywhere from a 0%-300% improvement depending on configuration and hardware, but more commonly 100%-200%.

In the most extreme cases with search depths of 10+, it can be 10x more performant than before.

Streaming workspaces to the picker asynchronously

The old implementation searched for all workspaces synchronously and then send them to a Skim picker. If you were on slow hardware, had a lot of workspaces, a complicated workspace-search configuration, or just a high max_search_depth, there could be a noticeable delay. Especially if you met multiple of those criteria.

In the new version, we ditched the dependency on Skim and used Helix's Nucleo picker with Ratatui/Crossterm to implement the TUI picker.

The new implementation spawns a second thread for finding workspaces and streams them into the picker, so the picker opens ~instantly always now, no matter your config/hardware. You can type, move around, and make your selection while the background thread is still streaming results in. This has been great for me so far where I have muscle memory and I know that to get to a certain workspace I need to just type .n or z, etc. I can now open those up as fast as I can type the letters

Note: one annoying thing that I haven't found a way to work around yet is that the matching algorithm is different & seemingly less configurable out-of-the-box than Skim's was. This results in a having to relearn muscle memory for some of my workspaces. I will spend more time looking into this to see if I can make it more consistent. I hope it isn't too big of a problem.

Opening a new session in a group without -g

Instead of just pressing Enter on your selection in the main workspace picker, you can use Shift/Ctrl/Alt + Enter to attempt to open the path as a new session in an existing group. If no existing session for that path is found, it is opened normally. If one is found, it opens in a group (same as it would with twm -g).

Open to taking other suggestions for what key(s) should invoke this behavior. It seems that none of these are super consistently supported by Crossterm across platforms&terminals. Alt+Enter seems consistent on Linux. I haven't had a chance to try other OS yet

CLI

--make-default-config
writes a default configuration file and accompanying schema, by default to $XDG_CONFIG_HOME/twm/{twm.yaml,twm.schema.json}. if you pass -p/--path <PATH> with this, it will write to the directory given.

We first check that neither of the files we intend to write, and won't overwrite existing files, asking the user to move/rename existing files and try again.

I originally never wanted to bother adding something like this, but since I discovered the schemars crate to automatically export the configuration file's schema, it feels like there is value here now, since calling this flag will set up a configuration file with up-to-date schema validation for free.

--make-default-layout-config
writes a default config file for a .twm.yaml layout file

This one does not include a .twm.schema.json file, because the whole schema is contained in the default template. If desired, you can use twm --print-layout-config-schema > schema.json

--print-config-schema
prints the JSON-formatted configuration schema to stdout

Useful for same as above. If you update twm every so often you could twm --print-config-schema > ~/.config/twm/twm.schema.json to get updated editor completion/validation when editing your config

--print-layout-config-schema
prints the JSON-formatted layout configuration to stdout

I don't imagine I'd need this that often but just because I don't write custom layouts in .twm.yaml files that often I sometimes forget the exact format.

--print-bash-completion, --print-zsh-completion, --print-fish-completion
prints the respective completion code to stdout

can be used to setup completions manually or by packagers (as is done in this flake) to install the completion files with twm. Adds completion! Pretty self explanatory. Seeing the little completion popups in my terminal for twm just makes me happy

--print-man
prints man(1) page content to stdout

same as above, can install the man page manually or have it be installed with the package. this repo's flake does these for you so if you install twm via nix+this flake there is nothing to set up

Flake

Updates the Nix dependencies & packages the man pages & shell completions with the binary

New Contributors

Full Changelog: v0.9.0...v0.10.0