Skip to content

Commit

Permalink
feat(darkman): fix config & sync gtk, waybar
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowinston committed May 3, 2024
1 parent 9bd186b commit cc8a463
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 69 deletions.
23 changes: 18 additions & 5 deletions home/apps/colorscheme-sync.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
inherit (pkgs.stdenv) isDarwin isLinux;

vividBuilder = flavor:
pkgs.runCommand "vivid-${flavor}" {
nativeBuildInputs = [pkgs.vivid];
} ''
pkgs.runCommand "vivid-${flavor}" {nativeBuildInputs = [pkgs.vivid];} ''
vivid generate ${pkgs.vivid.src}/themes/catppuccin-${flavor}.yml > $out
'';
vividLatte = vividBuilder "latte";
Expand All @@ -19,7 +17,10 @@ in {
home.packages = [
(pkgs.writeShellApplication {
name = "dark-mode-ternary";
runtimeInputs = lib.optionals isLinux [pkgs.dbus pkgs.gnugrep];
runtimeInputs = lib.optionals isLinux [
pkgs.dbus
pkgs.gnugrep
];
text = let
queryCommand =
if isLinux
Expand All @@ -43,9 +44,21 @@ in {
enable = isLinux;
settings = {
lat = config.location.latitude;
lon = config.location.longitude;
lng = config.location.longitude;
useGeoclue = false;
};
lightModeScripts = {
gtk-theme = ''
${pkgs.dconf}/bin/dconf write \
/org/gnome/desktop/interface/color-scheme "'prefer-light'"
'';
};
darkModeScripts = {
gtk-theme = ''
${pkgs.dconf}/bin/dconf write \
/org/gnome/desktop/interface/color-scheme "'prefer-dark'"
'';
};
};

programs.zsh = {
Expand Down
151 changes: 87 additions & 64 deletions home/apps/waybar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
margin = "2";

modules-center = ["hyprland/window"];
modules-right = ["tray" "idle_inhibitor" "pulseaudio" "clock"];
modules-right = [
"tray"
"idle_inhibitor"
"pulseaudio"
"clock"
];

idle_inhibitor = {
format = "{icon}";
Expand All @@ -27,10 +32,86 @@

pulseaudio = {
format = "{icon} {volume}%";
format-icons.default = ["" "" ""];
format-icons.default = [
""
""
""
];
on-click = "pavucontrol";
};
};

darkColors = ''
@define-color red #f38ba8;
@define-color pink #f5c2e7;
@define-color crust #11111c;
@define-color base #1e1e2e;
@define-color text #cdd6f4;
@define-color surface0 #313244;
@define-color surface2 #585b70;
'';
lightColors = ''
@define-color red #d20f39;
@define-color pink #ea76cb;
@define-color crust #dce0e8;
@define-color base #eff1f5;
@define-color text #4c4f69;
@define-color surface0 #ccd0da;
@define-color surface2 #acb0be;
'';
style = ''
* {
font-family: Symbols Nerd Font, IBM Plex Sans;
font-size: 16px;
color: @text;
}
window#waybar {
background-color: @base;
border: 2px solid @crust;
border-radius: 5px;
}
#workspaces button:first-child {
padding: 0 5px;
border-radius: 5px 0 0 5px;
border-left: 2px solid @crust;
}
#workspaces button.active:first-child {
padding: 0 5px;
box-shadow: unset;
border-radius: 5px 0 0 5px;
border-left: 2px solid @pink;
border-top: 2px solid @pink;
border-bottom: 2px solid @pink;
}
#workspaces button {
padding: 0 5px;
border-radius: 0;
border-top: 2px solid @crust;
border-bottom: 2px solid @crust;
}
#workspaces button:hover {
background: @surface2;
}
#workspaces button.active {
color: @pink;
background: @surface0;
border-top: 2px solid @pink;
border-bottom: 2px solid @pink;
}
#workspaces button.urgent {
background-color: @red;
}
#clock, #network, #pulseaudio, #tray, #idle_inhibitor {
padding: 0 10px;
}
'';
in {
config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux) {
programs.waybar = {
Expand Down Expand Up @@ -60,68 +141,10 @@ in {
};
};
};

style = ''
@define-color red #f38ba8;
@define-color pink #f5c2e7;
@define-color crust #11111c;
@define-color base #1e1e2e;
@define-color text #cdd6f4;
@define-color surface0 #313244;
@define-color surface2 #585b70;
* {
font-family: Symbols Nerd Font, IBM Plex Sans;
font-size: 16px;
color: @text;
}
window#waybar {
background-color: @base;
border: 2px solid @crust;
border-radius: 5px;
}
#workspaces button:first-child {
padding: 0 5px;
border-radius: 5px 0 0 5px;
border-left: 2px solid @crust;
}
#workspaces button.active:first-child {
padding: 0 5px;
box-shadow: unset;
border-radius: 5px 0 0 5px;
border-left: 2px solid @pink;
border-top: 2px solid @pink;
border-bottom: 2px solid @pink;
}
#workspaces button {
padding: 0 5px;
border-radius: 0;
border-top: 2px solid @crust;
border-bottom: 2px solid @crust;
}
#workspaces button:hover {
background: @surface2;
}
#workspaces button.active {
color: @pink;
background: @surface0;
border-top: 2px solid @pink;
border-bottom: 2px solid @pink;
}
#workspaces button.urgent {
background-color: @red;
}
#clock, #network, #pulseaudio, #tray, #idle_inhibitor {
padding: 0 10px;
}
'';
};
xdg.configFile = {
"waybar/style-dark.css".text = darkColors + style;
"waybar/style-light.css".text = lightColors + style;
};
};
}

0 comments on commit cc8a463

Please sign in to comment.