hyprsession 0.1.6

Saves hyprland sessions
Documentation
# Hyprsession
## Overview
Implements session persistance for Hyprland. While the program is running it periodicly saves the command, workspace and other properties of running clients found by `hyprctl clients`. These are then saved to a file formatted as a Hyprland config file which can then be sourced so that the session is restored when Hyprland is restarted.

<a href="https://www.buymeacoffee.com/joshurtree" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" alt="Buy Me A Coffee" height="41" width="174"></a>

## Installation
#### Manual
As root run the command 
```
cargo install --root /usr/local hyprsession
``` 
Or install as a user by replacing `/usr/local` with your home directory. 

#### Arch Linux
Hyprsession can be installed via the AUR. By either running your aur package manager of choice or manually by running
```
git clone https://aur.archlinux.org/hyprsession.git
cd hyprsession
makepkg -i
```
#### NixOS
Add the input to your `flake.nix`
```
hyprsession.url = "github:joshurtree/hyprsession"
```

Then either add the package to your `configuration.nix` or use `${inputs.hyprsession.packages.${pkgs.system}.hyprsession}/bin/hyprsession` in place of `hyprsession` to run the program.

## Usage
To automaticly run the program in future sessions add the following line to your Hyprland config file (Usually at ~/.config/hypr/hyprland.conf)
```
exec-once = hyprsession
```
The same line can be added to your `home.nix` hyprland configuration if your are using Nix Home Manager.
If you want to save a session that is already running then run
```
hyprsession --mode save-only &
```
or
```
hyprsession --mode save-and-exit
```

## Options
Various options can be used to modify the behavior of Hyprsession.

### --mode <mode>
Sets the mode the program runs in 
* Default - Loads the session at startup the saves the current session at regular intervals.
* SaveOnly - As above but skips loading the session
* LoadAndExit - Load the saved session then immediatly exit
* SaveAndExit - Save the current session then exit

### --save-interval n
This sets the interval in seconds between session saves. The default is 60 seconds.

### --session-path
This allows the user to save the session config in an alternative directory, by default its ~/.local/share/hyprsession. 

## TODO
* Create and use a rules file for alternative handling of applications (i.e. do not reload, ignore parameters, additional parameters etc).
* Handle application that create windows in forked processes by creating temporary window rules.

## Change log
### 0.1.1
* Changed --session-path option to point at base directory of session file
### 0.1.2
* Fixed bug which would crash program if no session file existed
### 0.1.3
* Fix fatal bug on Hyprland 0.4 that crashed the program while saving the session  
### 0.1.4
* Changed fullscreen dispatcher to use fullscreenmode and fixed FullscreenMode type issue (#2)
* Updated to latest alpha version of hyprland crate. Fixes panic on fetching clients (#1)
### 0.1.5
* Skip saving clients with duplicate pids (i.e. generated by the same application)
* Add option to retain clients with duplicate pids

## Thanks

Thank you to the following people for helping to improve this project

* Tie C (ticia)
* Isaac Hesslegrave (HeadedBranch)