onionshot 0.3.1

Screenshot utility for Hyprland
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::{env, path::PathBuf};

pub fn screenshot_dir() -> PathBuf {
    env::var("ONIONSHOT_DIR")
        .or_else(|_| env::var("XDG_PICTURES_DIR"))
        .map(|x| x.into())
        .unwrap_or(env::home_dir().unwrap_or("/".into()).join("Pictures"))
}

pub fn ensure_screenshot_dir() {
    if !screenshot_dir().exists() {
        std::fs::create_dir_all(screenshot_dir())
            .expect("failed to create screenshot directories");
    }
}