From e844062edaeda9965da0192566be7e8042e2b74e Mon Sep 17 00:00:00 2001 From: pin Date: Sun, 6 Aug 2023 17:23:06 +0200 Subject: [PATCH] fix: add NetBSD support --- README.md | 13 ++++++++++++- src/util/reload.rs | 2 +- src/util/wallpaper.rs | 10 +++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7ae91d1..de8b1a8 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ Matugen is a cross-platform tool that generates a colorscheme either from an ima - Windows - Linux - MacOS ->**Warning** Matugen only supports setting the wallpaper and restarting apps on Linux for now. +- NetBSD +>**Warning** Matugen only supports setting the wallpaper and restarting apps on Linux and NetBSD for now. ## Roadmap @@ -84,6 +85,16 @@ in { } ``` +### NetBSD +```shell +pkgin install matugen +``` +or, if you prefer to build it from source +```shell +cd /usr/pkgsrc/graphics/matugen +make install +``` + ## Usage >**Note** For some reason the output of the colors is a bit weird in the gifs, here is how the output actually looks: diff --git a/src/util/reload.rs b/src/util/reload.rs index 8e801ef..c24a978 100644 --- a/src/util/reload.rs +++ b/src/util/reload.rs @@ -2,7 +2,7 @@ use super::{arguments::Cli, config::ConfigFile}; use color_eyre::{eyre::Result, Report}; use std::process::Command; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "netbsd"))] pub fn reload_apps_linux(args: &Cli, config: &ConfigFile) -> Result<(), Report> { reload_app("kitty", "SIGUSR1")?; reload_app("waybar", "SIGUSR2")?; diff --git a/src/util/wallpaper.rs b/src/util/wallpaper.rs index e3840fd..46f0b8b 100644 --- a/src/util/wallpaper.rs +++ b/src/util/wallpaper.rs @@ -8,7 +8,7 @@ use super::{ reload::reload_app, }; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "netbsd"))] pub fn set_wallaper(config: &ConfigFile, args: &Cli) -> Result<(), Report> { let wallpaper_tool = match &config.config.wallpaper_tool { Some(wallpaper_tool) => wallpaper_tool, @@ -32,7 +32,7 @@ pub fn set_wallaper(config: &ConfigFile, args: &Cli) -> Result<(), Report> { } } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "netbsd"))] fn set_wallaper_swaybg(path: &String) -> Result<(), Report> { reload_app("swaybg", "SIGUSR1")?; @@ -45,7 +45,7 @@ fn set_wallaper_swaybg(path: &String) -> Result<(), Report> { Ok(()) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "netbsd"))] fn set_wallaper_swwww(config: &ConfigFile, path: &String) -> Result<(), Report> { let mut binding = Command::new("swww"); let cmd = binding.stdout(Stdio::null()).stderr(Stdio::null()); @@ -62,7 +62,7 @@ fn set_wallaper_swwww(config: &ConfigFile, path: &String) -> Result<(), Report> Ok(()) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "netbsd"))] fn set_wallaper_nitrogen(path: &String) -> Result<(), Report> { let mut binding = Command::new("nitrogen"); let cmd = binding.stdout(Stdio::null()).stderr(Stdio::null()); @@ -72,7 +72,7 @@ fn set_wallaper_nitrogen(path: &String) -> Result<(), Report> { Ok(()) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "netbsd"))] fn set_wallaper_feh(config: &ConfigFile, path: &String) -> Result<(), Report> { let mut binding = Command::new("feh"); let cmd = binding.stdout(Stdio::null()).stderr(Stdio::null());