refactor arguments to options

also change theme to colorscheme
This commit is contained in:
Noah Masur
2022-05-05 23:01:56 -04:00
parent 531c78ebe0
commit 417623965e
33 changed files with 415 additions and 347 deletions

View File

@ -10,11 +10,35 @@
./rofi.nix
];
options = {
launcherCommand = lib.mkOption {
type = lib.types.str;
description = "Command to use for launching";
options = with lib; {
gui = {
enable = mkEnableOption {
description = "Enable graphics";
default = false;
};
compositor.enable = mkEnableOption {
description = "Enable transparency, blur, shadows";
default = false;
};
launcherCommand = mkOption {
type = types.str;
description = "Command to use for launching";
};
gtkTheme = mkOption {
type = types.str;
description = "Theme for GTK applications";
};
colorscheme = mkOption {
type = types.attrs;
description = "Base16 color scheme";
};
wallpaper = mkOption {
type = types.path;
description = "Wallpaper background image file";
};
};
};
}

View File

@ -1,11 +1,11 @@
{ config, pkgs, lib, identity, ... }:
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user}.home.packages = [ pkgs.dmenu ];
launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ];
gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
};

View File

@ -1,13 +1,12 @@
{ pkgs, lib, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
fonts.fonts = with pkgs;
[
pkgs."${gui.font.package}" # Used for Vim and Terminal
# siji # More icons for Polybar
pkgs.victor-mono # Used for Vim and Terminal
];
fonts.fontconfig.defaultFonts.monospace = [ gui.font.name ];
fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ];
};

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf config.services.xserver.enable {
@ -15,7 +15,7 @@
playerctl # Media control
];
home-manager.users.${identity.user}.xsession.windowManager.i3 = {
home-manager.users.${config.user}.xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
config = let
@ -40,19 +40,16 @@
};
bars = [{ command = "echo"; }]; # Disable i3bar
colors = let
background = "#2f343f";
inactiveBackground = "#2f343f";
border = "#2f343f";
inactiveBorder = "#2f343f";
# border = "#F0C674";
# inactiveBorder = "#E2B860";
text = "#f3f4f5";
inactiveText = "#676E7D";
urgentBackground = "#E53935";
# indicator = "#00ff00";
background = config.gui.colorscheme.base00;
inactiveBackground = config.gui.colorscheme.base01;
border = config.gui.colorscheme.base01;
inactiveBorder = config.gui.colorscheme.base01;
text = config.gui.colorscheme.base07;
inactiveText = config.gui.colorscheme.base04;
urgentBackground = config.gui.colorscheme.base08;
indicator = "#00000000";
in {
background = background;
background = config.gui.colorscheme.base00;
focused = {
inherit background indicator text border;
childBorder = background;
@ -117,12 +114,13 @@
# Launchers
"${modifier}+Return" = "exec alacritty";
"${modifier}+space" =
"exec --no-startup-id ${config.launcherCommand}";
"exec --no-startup-id ${config.gui.launcherCommand}";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = ''
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = ''exec i3lock --color "#2f343f"'';
"${modifier}+Shift+x" =
''exec i3lock --color "${config.gui.colorscheme.base00}"'';
"${modifier}+Shift+t" = "exec alacritty";
# Window options
@ -202,8 +200,7 @@
};
startup = [
{
command =
"feh --bg-fill ${builtins.toString config.theme.wallpaper}";
command = "feh --bg-fill ${builtins.toString config.gui.wallpaper}";
always = true;
notification = false;
}

View File

@ -1,48 +1,49 @@
{ config, lib, identity, ... }: {
{ config, lib, ... }: {
config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user} = {
config =
lib.mkIf (config.services.xserver.enable && config.gui.compositor.enable) {
home-manager.users.${config.user} = {
services.picom = {
enable = true;
blur = true;
blurExclude = [ ];
# extraOptions = ''
# shadow-radius = 20
# '';
extraOptions = ''
shadow-radius = 20
corner-radius = 10
blur-size = 20
rounded-corners-exclude = [
"window_type = 'dock'",
"class_g = 'i3-frame'"
]
'';
fade = false;
experimentalBackends = true;
inactiveDim = "0.05";
inactiveOpacity = "1.0";
menuOpacity = "1.0";
noDNDShadow = false;
noDockShadow = false;
opacityRule = [
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
];
shadow = true;
shadowExclude = [ ];
shadowOffsets = [ (-10) (-10) ];
shadowOpacity = "0.5";
vSync = false;
};
xsession.windowManager.i3.config.startup = [{
command = "systemctl --user restart picom";
always = true;
notification = false;
}];
services.picom = {
enable = false;
blur = true;
blurExclude = [ ];
# extraOptions = ''
# shadow-radius = 20
# '';
extraOptions = ''
shadow-radius = 20
corner-radius = 10
blur-size = 20
rounded-corners-exclude = [
"window_type = 'dock'",
"class_g = 'i3-frame'"
]
'';
fade = false;
experimentalBackends = true;
inactiveDim = "0.05";
inactiveOpacity = "1.0";
menuOpacity = "1.0";
noDNDShadow = false;
noDockShadow = false;
opacityRule = [
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
];
shadow = true;
shadowExclude = [ ];
shadowOffsets = [ (-10) (-10) ];
shadowOpacity = "0.5";
vSync = false;
};
xsession.windowManager.i3.config.startup = [{
command = "systemctl --user restart picom";
always = true;
notification = false;
}];
};
};
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf config.services.xserver.enable {
@ -6,7 +6,7 @@
fonts.fonts = with pkgs;
[ (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) ];
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
services.polybar = {
enable = true;
@ -16,17 +16,7 @@
githubSupport = true;
};
script = "polybar &";
config = let
colors = {
background = "#282828";
background-alt = "#373B41";
foreground = "#C5C8C6";
primary = "#F0C674";
secondary = "#8ABEB7";
alert = "#A54242";
disabled = "#707880";
};
in {
config = {
"bar/main" = {
bottom = false;
width = "100%";
@ -35,14 +25,14 @@
# offset-y = -5;
# offset-y = "5%";
# dpi = 96;
background = config.theme.colors.primary.background;
foreground = config.theme.colors.primary.foreground;
background = config.gui.colorscheme.base00;
foreground = config.gui.colorscheme.base07;
line-size = "3pt";
border-top-size = 0;
border-right-size = 0;
border-left-size = 0;
border-bottom-size = "4pt";
border-color = config.theme.colors.cursor.text;
border-color = config.gui.colorscheme.base02;
padding-left = 2;
padding-right = 2;
module-margin = 1;
@ -68,17 +58,17 @@
"module/xworkspaces" = {
type = "internal/xworkspaces";
label-active = "%name%";
label-active-background = config.theme.colors.primary.foreground;
label-active-foreground = config.theme.colors.primary.background;
label-active-background = config.gui.colorscheme.base07;
label-active-foreground = config.gui.colorscheme.base00;
# label-active-underline = config.theme.colors.normal.yellow;
label-active-padding = 1;
label-occupied = "%name%";
label-occupied-padding = 1;
label-urgent = "%name%";
label-urgent-background = config.theme.colors.bright.red;
label-urgent-background = config.gui.colorscheme.base08;
label-urgent-padding = 1;
label-empty = "%name%";
label-empty-foreground = config.theme.colors.normal.white;
label-empty-foreground = config.gui.colorscheme.base06;
label-empty-padding = 1;
};
"module/xwindow" = {
@ -100,10 +90,10 @@
format-volume = "<ramp-volume> <label-volume>";
# format-volume-background = colors.background;
# label-volume-background = colors.background;
format-volume-foreground = config.theme.colors.primary.foreground;
format-volume-foreground = config.gui.colorscheme.base07;
label-volume = "%percentage%%";
label-muted = " ---";
label-muted-foreground = config.theme.colors.bright.black;
label-muted-foreground = config.gui.colorscheme.base03;
ramp-volume-0 = "";
ramp-volume-1 = "";
ramp-volume-2 = "";

View File

@ -1,16 +1,16 @@
{ config, pkgs, lib, identity, ... }:
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user}.programs.rofi = {
home-manager.users.${config.user}.programs.rofi = {
enable = true;
cycle = true;
location = "center";
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ];
};
launcherCommand = "${pkgs.rofi}/bin/rofi -show run";
gui.launcherCommand = "${pkgs.rofi}/bin/rofi -show run";
};

View File

@ -1,10 +1,10 @@
{ config, pkgs, lib, identity, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
# Enable the X11 windowing system.
services.xserver = {
enable = gui.enable;
enable = config.gui.enable;
# Enable touchpad support
libinput.enable = true;
@ -15,7 +15,7 @@
enable = config.services.xserver.enable;
# Make the login screen dark
greeters.gtk.theme.name = gui.gtkTheme;
greeters.gtk.theme.name = config.gui.gtkTheme;
};
};
@ -27,7 +27,7 @@
xclip # Clipboard
];
home-manager.users.${identity.user}.programs.fish.shellAliases = {
home-manager.users.${config.user}.programs.fish.shellAliases = {
pbcopy = "xclip -selection clipboard -in";
pbpaste = "xclip -selection clipboard -out";
};