Implement dynamic-colors for sway
This commit is contained in:
parent
af91a9979c
commit
02f4aeb248
2 changed files with 31 additions and 32 deletions
|
|
@ -1,6 +1,11 @@
|
||||||
{ nixosConfig, lib, config, pkgs, ... }:
|
{ nixosConfig, lib, config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
loadSwayTheme = pkgs.writeShellScript "load-sway-theme" ''
|
||||||
|
while IFS= read -r line; do
|
||||||
|
${pkgs.sway}/bin/swaymsg "$line"
|
||||||
|
done < "$1"
|
||||||
|
'';
|
||||||
applicationConfig = [
|
applicationConfig = [
|
||||||
{
|
{
|
||||||
dir = "~/.config/alacritty";
|
dir = "~/.config/alacritty";
|
||||||
|
|
@ -14,12 +19,20 @@ let
|
||||||
dark = "color-dark";
|
dark = "color-dark";
|
||||||
target = "color";
|
target = "color";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
dir = "~/.config/sway";
|
||||||
|
light = "light-theme";
|
||||||
|
dark = "dark-theme";
|
||||||
|
target = "theme";
|
||||||
|
exec = [ loadSwayTheme "theme" ];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
dynamic-colors = pkgs.writers.writePython3Bin "dynamic-colors" { } ''
|
dynamic-colors = pkgs.writers.writePython3Bin "dynamic-colors" { } ''
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -49,6 +62,9 @@ let
|
||||||
|
|
||||||
os.symlink(entry['light'], target)
|
os.symlink(entry['light'], target)
|
||||||
|
|
||||||
|
if 'exec' in entry:
|
||||||
|
subprocess.run(entry['exec'], cwd=directory)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,19 @@ in
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
xdg.configFile."sway/light-theme".text = with solarized; ''
|
||||||
|
client.focused ${base01.hex} ${blue.hex} ${base3.hex} ${blue.hex} ${blue.hex}
|
||||||
|
client.focused_inactive ${base2.hex} ${base2.hex} ${base01.hex} ${base0.hex} ${base2.hex}
|
||||||
|
client.unfocused ${base2.hex} ${base3.hex} ${base01.hex} ${base2.hex} ${base2.hex}
|
||||||
|
client.urgent ${red.hex} ${red.hex} ${base3.hex} ${red.hex} ${red.hex}
|
||||||
|
'';
|
||||||
|
xdg.configFile."sway/dark-theme".text = with solarized; ''
|
||||||
|
client.focused ${base1.hex} ${blue.hex} ${base03.hex} ${blue.hex} ${blue.hex}
|
||||||
|
client.focused_inactive ${base02.hex} ${base02.hex} ${base1.hex} ${base03.hex} ${base02.hex}
|
||||||
|
client.unfocused ${base02.hex} ${base03.hex} ${base1.hex} ${base02.hex} ${base02.hex}
|
||||||
|
client.urgent ${red.hex} ${red.hex} ${base03.hex} ${red.hex} ${red.hex}
|
||||||
|
'';
|
||||||
|
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
|
@ -269,37 +282,6 @@ in
|
||||||
border = 1;
|
border = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
colors = {
|
|
||||||
focused = rec {
|
|
||||||
border = solarized.base1.hex;
|
|
||||||
background = solarized.base2.hex;
|
|
||||||
text = solarized.base1.hex;
|
|
||||||
indicator = solarized.cyan.hex;
|
|
||||||
childBorder = background;
|
|
||||||
};
|
|
||||||
focusedInactive = rec {
|
|
||||||
border = solarized.base0.hex;
|
|
||||||
background = solarized.base03.hex;
|
|
||||||
text = solarized.base0.hex;
|
|
||||||
indicator = solarized.cyan.hex;
|
|
||||||
childBorder = background;
|
|
||||||
};
|
|
||||||
unfocused = rec {
|
|
||||||
border = solarized.base0.hex;
|
|
||||||
background = solarized.base03.hex;
|
|
||||||
text = solarized.base0.hex;
|
|
||||||
indicator = solarized.cyan.hex;
|
|
||||||
childBorder = background;
|
|
||||||
};
|
|
||||||
urgent = rec {
|
|
||||||
border = solarized.base02.hex;
|
|
||||||
background = solarized.red.hex;
|
|
||||||
text = solarized.base02.hex;
|
|
||||||
indicator = solarized.cyan.hex;
|
|
||||||
childBorder = background;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
fonts = {
|
fonts = {
|
||||||
names = [ "monospace" ];
|
names = [ "monospace" ];
|
||||||
style = "Regular";
|
style = "Regular";
|
||||||
|
|
@ -308,6 +290,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
include ~/.config/sway/theme
|
||||||
# Cursor
|
# Cursor
|
||||||
seat seat0 xcursor_theme Adwaita
|
seat seat0 xcursor_theme Adwaita
|
||||||
'' + (
|
'' + (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue