feat(wm): add saving/loading of layouts to file

This commit expands on the autosave/load functionality to allow saving
and loading layouts from any file.

Handling relative paths and paths with ~ on Windows is a little tricky
so I added a helper fn to komorebic to deal with this, ensuring all the
processing happens in komorebic before the messages get sent to komorebi
for processing.

There will still some lingering uses of ContextCompat around the
codebase which I also took the opportunity to clean up and replace with
ok_or_else + anyhow!().

windows-rs is also updated to 0.20.1 in the lockfile.

resolve #41
This commit is contained in:
LGUG2Z
2021-09-22 08:27:04 -07:00
parent 80bcb51f75
commit b9a40924a8
8 changed files with 154 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
#![allow(clippy::missing_errors_doc)]
use std::path::PathBuf;
use std::str::FromStr;
use clap::ArgEnum;
@@ -54,6 +55,8 @@ pub enum SocketMessage {
Retile,
QuickSave,
QuickLoad,
Save(PathBuf),
Load(PathBuf),
FocusMonitorNumber(usize),
FocusWorkspaceNumber(usize),
ContainerPadding(usize, usize, i32),