hosts/modules/gui/theme: lift my sway background up into its own package

This commit is contained in:
Colin 2024-05-28 15:48:37 +00:00
parent cefd6c0534
commit 95dc395925
9 changed files with 41 additions and 34 deletions

View File

@ -107,6 +107,7 @@
./sane-open.nix
./sane-screenshot.nix
./sane-scripts.nix
./sane-theme.nix
./sanebox.nix
./schlock.nix
./sfeed.nix

View File

@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
{
sane.programs.sane-theme = {
packageUnwrapped = null;
suggestedPrograms = [
"sane-backgrounds"
];
};
sane.programs.sane-backgrounds = {
sandbox.enable = false; #< no binaries
};
environment.pathsToLink = lib.mkIf config.sane.programs.sane-backgrounds.enabled [
"/share/backgrounds"
];
}

View File

@ -87,9 +87,6 @@ in
bindsym --locked XF86AudioLowerVolume exec $volume_down
'';
};
background = mkOption {
type = types.path;
};
font = mkOption {
type = types.str;
default = "pango:monospace 11";
@ -138,6 +135,7 @@ in
"s6-rc" # used by sway config
"sane-screenshot"
"sane-open"
"sane-theme"
# "splatmoji" # used by sway config
"sway-contrib.grimshot" # used by sway config
"swayidle" # enable if you need it
@ -204,7 +202,6 @@ in
fs.".config/sway/config".symlink.target = pkgs.substituteAll {
src = ./sway-config;
inherit (cfg.config)
background
extra_lines
font
mod

View File

@ -38,8 +38,7 @@ client.focused_inactive #1f5e54 #5f676a #ffffff
client.unfocused #1f5e54 #1f554c #b4b4b4
client.urgent #ff968b #ff968b #ffffff
# TODO: populate background from /run/current-system/sw/etc/... instead of hard-coded nix path
output '*' bg "@background@" fill
output '*' bg `ls $(echo ${XDG_DATA_DIRS//:/\/backgrounds\/sane-nixos-bg.png })/backgrounds/sane-nixos-bg.png` fill
### pixel boundary between windows
# hide_edge_borders --i3 means that single-window workspaces never show window bar

View File

@ -8,7 +8,6 @@ in
{
imports = [
./gtk.nix
./theme
];
sane.programs.gameApps = declPackageSet [

View File

@ -1,27 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sane.gui.theme.background;
in
{
options = with lib; {
sane.gui.theme.background = {
svg = mkOption {
type = types.path;
default = ./nixos-bg-02.svg;
};
png = mkOption {
type = types.path;
default = pkgs.runCommand
"nixos-bg.png"
{ nativeBuildInputs = [ pkgs.inkscape ]; }
''
inkscape ${cfg.svg} -o $out
'';
};
};
};
config = {
sane.programs.sway.config.background = lib.mkDefault cfg.png;
};
}

View File

@ -0,0 +1,20 @@
{ stdenv
, inkscape
}:
stdenv.mkDerivation {
pname = "sane-backgrounds";
version = "0.3";
src = ./.;
nativeBuildInputs = [ inkscape ];
buildPhase = ''
inkscape sane-nixos-bg.svg -o sane-nixos-bg.png
'';
installPhase = ''
mkdir -p $out/share/backgrounds
cp *.svg *.png $out/share/backgrounds
'';
}

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -65,6 +65,7 @@ let
pipeline = callPackage ./additional/pipeline { };
rtl8723cs-firmware = callPackage ./additional/rtl8723cs-firmware { };
rtl8723cs-wowlan = callPackage ./additional/rtl8723cs-wowlan { };
sane-backgrounds = callPackage ./additional/sane-backgrounds { };
sane-cast = callPackage ./additional/sane-cast { };
sane-die-with-parent = callPackage ./additional/sane-die-with-parent { };
sane-open = callPackage ./additional/sane-open { };