Made a distinct variable for the color scheme name in flake.nix, made a script 'chscheme' that allows one to easily change said variable
This commit is contained in:
@@ -102,6 +102,9 @@
|
||||
self = self;
|
||||
pkgs = pkgs;
|
||||
};
|
||||
chscheme = import ./nix/chscheme.nix {
|
||||
pkgs = pkgs;
|
||||
};
|
||||
nixcommit = import ./nix/nixcommit.nix {
|
||||
host = host;
|
||||
self = self;
|
||||
@@ -114,6 +117,7 @@
|
||||
in {
|
||||
home.packages = [
|
||||
compress
|
||||
chscheme
|
||||
passhelper
|
||||
crs
|
||||
extract
|
||||
|
||||
5
modules/home/scripts/nix/chscheme.nix
Normal file
5
modules/home/scripts/nix/chscheme.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
pkgs,
|
||||
}:
|
||||
pkgs.writeShellScriptBin "chscheme" (builtins.readFile ./chscheme.sh)
|
||||
|
||||
23
modules/home/scripts/nix/chscheme.sh
Executable file
23
modules/home/scripts/nix/chscheme.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
/usr/bin/env ls "$(nix-build '<nixpkgs>' -A base16-schemes)"/share/themes | \
|
||||
sed 's/\.yaml//g' | \
|
||||
fzf --preview 'cat $(nix-build "<nixpkgs>" -A base16-schemes)/share/themes/{}.yaml | \
|
||||
while IFS=": " read -r key value; do \
|
||||
if [[ $key =~ base0[0-9A-F] ]]; then \
|
||||
clean_value=$(echo $value | tr -d "\""); \
|
||||
r=$((16#${clean_value:0:2})); \
|
||||
g=$((16#${clean_value:2:2})); \
|
||||
b=$((16#${clean_value:4:2})); \
|
||||
printf "\033[48;2;%d;%d;%dm %-20s %s \033[0m\n" $r $g $b $key $clean_value; \
|
||||
fi; \
|
||||
done' | xargs -I {} sed -i '/base16scheme \=/s/\".*\"/\"{}\"/' "$HOME"/.sysflake/flake.nix && \
|
||||
echo "Successfully changed system color scheme. Rebuild now?" && \
|
||||
select choice in "Yes" "No"; do
|
||||
case $choice in
|
||||
"Yes")
|
||||
rebuild;exit 0;;
|
||||
"No")
|
||||
echo "Exiting...";exit 0;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user