hyrpland: refactor into modules
This commit is contained in:
parent
71732127de
commit
ef797eb971
|
@ -6,11 +6,6 @@ let
|
||||||
script = pkgs.writeScriptBin filename (builtins.readFile (./scripts/search-window.sh));
|
script = pkgs.writeScriptBin filename (builtins.readFile (./scripts/search-window.sh));
|
||||||
path = "${script}/bin/${filename}";
|
path = "${script}/bin/${filename}";
|
||||||
};
|
};
|
||||||
init-wallpaper = rec {
|
|
||||||
filename = "init-wallpaper.sh";
|
|
||||||
script = pkgs.writeScriptBin filename (builtins.readFile (./scripts/init-wallpaper.sh));
|
|
||||||
path = "${script}/bin/${filename}";
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
@ -25,6 +20,9 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
systemd.variables = [ "all" ];
|
systemd.variables = [ "all" ];
|
||||||
settings = {
|
settings = {
|
||||||
|
exec-once = lib.mkOrder 5 [
|
||||||
|
''${pkgs.dbus}/bin/dbus-update-activation-environment --all''
|
||||||
|
];
|
||||||
# window decors
|
# window decors
|
||||||
general = {
|
general = {
|
||||||
gaps_in = 10;
|
gaps_in = 10;
|
||||||
|
@ -205,11 +203,8 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
extraConfig = /*hyprlang*/ ''
|
extraConfig = /*hyprlang*/ ''
|
||||||
exec-once=dbus-update-activation-environment --all
|
|
||||||
exec-once=foot --server
|
exec-once=foot --server
|
||||||
|
|
||||||
exec-once=${init-wallpaper.path} ${./wallpaper.jpeg}
|
|
||||||
exec-once=wallust run ${config.home.homeDirectory}/.cache/wallpaper/current
|
|
||||||
exec-once=swww-daemon
|
exec-once=swww-daemon
|
||||||
exec-once=bash -c "sleep 10; hypridle"
|
exec-once=bash -c "sleep 10; hypridle"
|
||||||
exec-once=waybar
|
exec-once=waybar
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#/usr/bin/bash
|
|
||||||
|
|
||||||
secret_file=$1
|
|
||||||
|
|
||||||
cat "$secret_file" | gnome-keyring-daemon --unlock
|
|
||||||
gnome-keyring-daemon --start --components=pkcs11,secrets,ssh
|
|
|
@ -1,26 +0,0 @@
|
||||||
#/usr/bin/env bash
|
|
||||||
|
|
||||||
# This shell script ensures there are wallpaper files in expected locations
|
|
||||||
# where hyprland ecosystem expected them to find.
|
|
||||||
#
|
|
||||||
# Requirements:
|
|
||||||
# - GraphicsMagick for the 'gm' command.
|
|
||||||
|
|
||||||
if [ "$1" == "" ]; then
|
|
||||||
echo "Initial image path is required"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
init_wallpaper="$1"
|
|
||||||
cache_file="$HOME/.cache/wallpaper/current"
|
|
||||||
blurred="$HOME/.cache/wallpaper/blurred.png"
|
|
||||||
|
|
||||||
mkdir -p $HOME/.cache/wallpaper
|
|
||||||
|
|
||||||
if [ ! -f "$cache_file" ]; then
|
|
||||||
cp "$init_wallpaper" "$cache_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "$blurred" ]; then
|
|
||||||
gm convert -resize 75% -blur 50x30 "$cache_file" "$blurred"
|
|
||||||
fi
|
|
|
@ -1,105 +1,122 @@
|
||||||
{ pkgs, unstable, lib, config, ... }:
|
{ pkgs, unstable, lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.profile.hyprland;
|
cfg = config.profile.hyprland;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
wallust = cfg.wallust;
|
wallust = cfg.wallust;
|
||||||
|
wallpaperDir = "${config.home.homeDirectory}/.cache/wallpaper";
|
||||||
|
initWallPaperScript = pkgs.writeShellScriptBin "init-wallpaper.sh" ''
|
||||||
|
init_wallpaper="${./wallpaper.jpeg}"
|
||||||
|
cache_file="${wallpaperDir}/current"
|
||||||
|
blurred="${wallpaperDir}/blurred"
|
||||||
|
|
||||||
|
mkdir -p "${wallpaperDir}"
|
||||||
|
|
||||||
|
if [ ! -f "$cache_file" ]; then
|
||||||
|
cp "$init_wallpaper" "$cache_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$blurred" ]; then
|
||||||
|
${pkgs.imagemagick}/bin/gm convert -resize 75% -blur 50x30 "$cache_file" "$blurred"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "${config.home.homeDirectory}/.cache/wallust/sequences" ]; then
|
||||||
|
wallust run "$cache_file"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
pkgs.imagemagick
|
pkgs.imagemagick
|
||||||
# unstable.wallust
|
unstable.wallust
|
||||||
(pkgs.callPackage ./wallust-build.nix { })
|
|
||||||
];
|
];
|
||||||
|
|
||||||
home. file.".config/wallust/templates" = {
|
wayland.windowManager.hyprland.settings.exec-once = lib.mkOrder 10 ([
|
||||||
|
(getExe initWallPaperScript)
|
||||||
|
]);
|
||||||
|
|
||||||
|
home.file.".config/wallust/templates" = {
|
||||||
source = ./wallust-templates;
|
source = ./wallust-templates;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".config/wallust/wallust.toml".source =
|
home.file.".config/wallust/wallust.toml".source = ((pkgs.formats.toml { }).generate "wallust.toml" {
|
||||||
let
|
# See https://codeberg.org/explosion-mental/wallust/src/branch/master/wallust.toml
|
||||||
tomlFormat = pkgs.formats.toml { };
|
# for more information about the configuration options.
|
||||||
in
|
|
||||||
tomlFormat.generate
|
# How the image is parse, in order to get the colors:
|
||||||
"wallust.toml"
|
# full - resized - wal - thumb - fastresize - kmeans
|
||||||
|
backend = wallust.backend;
|
||||||
|
|
||||||
|
# What color space to use to produce and select the most prominent colors:
|
||||||
|
# lab - labmixed - lch - lchmixed
|
||||||
|
color_space = wallust.colorSpace;
|
||||||
|
threshold = wallust.threshold;
|
||||||
|
|
||||||
|
# Use the most prominent colors in a way that makes sense, a scheme color palette:
|
||||||
|
# dark - dark16 - darkcomp - darkcomp16
|
||||||
|
# light - light16 - lightcomp - lightcomp16
|
||||||
|
# harddark - harddark16 - harddarkcomp - harddarkcomp16
|
||||||
|
# softdark - softdark16 - softdarkcomp - softdarkcomp16
|
||||||
|
# softlight - softlight16 - softlightcomp - softlightcomp16
|
||||||
|
palette = wallust.palette;
|
||||||
|
|
||||||
|
# Ensures a "readable contrast" (OPTIONAL, disabled by default)
|
||||||
|
# Should only be enabled when you notice an unreadable contrast frequently happening
|
||||||
|
# with your images. The reference color for the contrast is the background color.
|
||||||
|
check_contrast = wallust.checkContrast;
|
||||||
|
|
||||||
|
# Color saturation, between [1% and 100%] (OPTIONAL, disabled by default)
|
||||||
|
# usually something higher than 50 increases the saturation and below
|
||||||
|
# decreases it (on a scheme with strong and vivid colors)
|
||||||
|
# saturation = 50;
|
||||||
|
|
||||||
|
# Alpha value for templating, by default 100 (no other use whatsoever)
|
||||||
|
alpha = wallust.alpha;
|
||||||
|
|
||||||
|
templates =
|
||||||
|
# Templates requires certain syntax
|
||||||
|
#
|
||||||
|
# See: https://codeberg.org/explosion-mental/wallust/wiki/wallust.1-Man-Page
|
||||||
|
# Note that the documentation is for 3.x and above.
|
||||||
|
let
|
||||||
|
out = config.home.homeDirectory + "/.cache/wallust";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# See https://codeberg.org/explosion-mental/wallust/src/branch/master/wallust.toml
|
waybar = {
|
||||||
# for more information about the configuration options.
|
template = "waybar.css";
|
||||||
|
# target = out + "/waybar.css";
|
||||||
# How the image is parse, in order to get the colors:
|
target = "${config.home.homeDirectory}/.config/waybar/style.css";
|
||||||
# full - resized - wal - thumb - fastresize - kmeans
|
};
|
||||||
backend = wallust.backend;
|
wlogout = {
|
||||||
|
template = "wlogout.css";
|
||||||
# What color space to use to produce and select the most prominent colors:
|
target = out + "/wlogout.css";
|
||||||
# lab - labmixed - lch - lchmixed
|
};
|
||||||
color_space = wallust.colorSpace;
|
hyprland = {
|
||||||
threshold = wallust.threshold;
|
template = "hyprland.conf";
|
||||||
|
target = out + "/hyprland.conf";
|
||||||
# Use the most prominent colors in a way that makes sense, a scheme color palette:
|
};
|
||||||
# dark - dark16 - darkcomp - darkcomp16
|
kitty = {
|
||||||
# light - light16 - lightcomp - lightcomp16
|
template = "kitty.conf";
|
||||||
# harddark - harddark16 - harddarkcomp - harddarkcomp16
|
target = "${config.home.homeDirectory}/.config/kitty/kitty.d/99-colors.conf";
|
||||||
# softdark - softdark16 - softdarkcomp - softdarkcomp16
|
};
|
||||||
# softlight - softlight16 - softlightcomp - softlightcomp16
|
base16-nvim = {
|
||||||
palette = wallust.palette;
|
template = "base16-nvim.lua";
|
||||||
|
target = out + "/base16-nvim.lua";
|
||||||
# Ensures a "readable contrast" (OPTIONAL, disabled by default)
|
};
|
||||||
# Should only be enabled when you notice an unreadable contrast frequently happening
|
rofi = {
|
||||||
# with your images. The reference color for the contrast is the background color.
|
template = "rofi.rasi";
|
||||||
check_contrast = wallust.checkContrast;
|
target = out + "/rofi.rasi";
|
||||||
|
};
|
||||||
# Color saturation, between [1% and 100%] (OPTIONAL, disabled by default)
|
alacritty = {
|
||||||
# usually something higher than 50 increases the saturation and below
|
template = "alacritty.toml";
|
||||||
# decreases it (on a scheme with strong and vivid colors)
|
target = out + "/alacritty.toml";
|
||||||
# saturation = 50;
|
};
|
||||||
|
foot = {
|
||||||
# Alpha value for templating, by default 100 (no other use whatsoever)
|
template = "foot.ini";
|
||||||
alpha = wallust.alpha;
|
target = "${config.home.homeDirectory}/.config/foot/colors.ini";
|
||||||
|
};
|
||||||
templates =
|
|
||||||
# Templates requires certain syntax
|
|
||||||
#
|
|
||||||
# See: https://codeberg.org/explosion-mental/wallust/wiki/wallust.1-Man-Page
|
|
||||||
# Note that the documentation is for 3.x and above.
|
|
||||||
let
|
|
||||||
out = config.home.homeDirectory + "/.cache/wallust";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
waybar = {
|
|
||||||
template = "waybar.css";
|
|
||||||
# target = out + "/waybar.css";
|
|
||||||
target = "${config.home.homeDirectory}/.config/waybar/style.css";
|
|
||||||
};
|
|
||||||
wlogout = {
|
|
||||||
template = "wlogout.css";
|
|
||||||
target = out + "/wlogout.css";
|
|
||||||
};
|
|
||||||
hyprland = {
|
|
||||||
template = "hyprland.conf";
|
|
||||||
target = out + "/hyprland.conf";
|
|
||||||
};
|
|
||||||
kitty = {
|
|
||||||
template = "kitty.conf";
|
|
||||||
target = "${config.home.homeDirectory}/.config/kitty/kitty.d/99-colors.conf";
|
|
||||||
};
|
|
||||||
base16-nvim = {
|
|
||||||
template = "base16-nvim.lua";
|
|
||||||
target = out + "/base16-nvim.lua";
|
|
||||||
};
|
|
||||||
rofi = {
|
|
||||||
template = "rofi.rasi";
|
|
||||||
target = out + "/rofi.rasi";
|
|
||||||
};
|
|
||||||
alacritty = {
|
|
||||||
template = "alacritty.toml";
|
|
||||||
target = out + "/alacritty.toml";
|
|
||||||
};
|
|
||||||
foot = {
|
|
||||||
template = "foot.ini";
|
|
||||||
target = "${config.home.homeDirectory}/.config/foot/colors.ini";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue