Added nix config

This commit is contained in:
Alejandro Angulo 2022-09-18 12:42:30 -07:00
commit 20bcd44cc1
29 changed files with 1978 additions and 0 deletions

View file

@ -0,0 +1,160 @@
{
config,
pkgs,
...
}: let
cfg = config.wayland.windowManager.sway.config;
nag = "swaynag";
leaveModeKeys = {
"Insert" = "mode default";
"Escape" = "mode default";
"Return" = "mode default";
};
in {
config.wayland.windowManager.sway.config = {
modes = {
resize =
{
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
"${cfg.left}" = "resize shrink width 50px";
"${cfg.down}" = "resize grow height 50px";
"${cfg.up}" = "resize shrink height 50px";
"${cfg.right}" = "resize grow width 50px";
# Ditto, with arrow keys
"Left" = "resize shrink width 50px";
"Down" = "resize grow height 50px";
"Up" = "resize shrink height 50px";
"Right" = "resize grow width 50px";
}
// leaveModeKeys;
nag = {
"Ctrl+d" = "mode default";
"Ctrl+c" = "exec ${nag} --exit";
"q" = "exec ${nag} --exit";
"Escape" = "exec ${nag} --exit";
"Return" = "exec ${nag} --confirm";
"j" = "exec ${nag} --next";
"Tab" = "exec ${nag} --next";
"Up" = "exec ${nag} --next";
"k" = "exec ${nag} --prev";
"Shift+Tab" = "exec ${nag} prev";
"Down" = "exec ${nag} prev";
};
};
keybindings = {
# Activate modes
"${cfg.modifier}+s" = "mode resize";
# Misc
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+c" = "kill";
"${cfg.modifier}+p" = "exec ${cfg.menu}";
"${cfg.modifier}+z" = "reload";
"${cfg.modifier}+x" = "exec swaylock -i ${config.home.homeDirectory}/wallpaper.png";
# Volume control
"XF86AudioRaiseVolume" = " exec 'pamixer --increase 5'";
"XF86AudioLowerVolume" = " exec 'pamixer --decrease 5'";
"XF86AudioMute" = " exec 'pamixer --toggle-mute'";
# Music player control
"XF86AudioPrev" = "exec 'playerctl previous'";
"XF86AudioNext" = "exec 'playerctl next'";
"XF86AudioPlay" = "exec 'playerctl play-pause'";
"${cfg.modifier}+Down" = "exec 'playerctl pause'";
"${cfg.modifier}+Up" = "exec 'playerctl play'";
"${cfg.modifier}+Right" = "exec 'playerctl next'";
"${cfg.modifier}+Left" = "exec 'playerctl previous'";
# Backlight keys
"XF86MonBrightnessDown" = "exec 'light -U 5'";
"XF86MonBrightnessUp" = "exec 'light -A 5'";
# Navigation
## Focus
### Move your focus around
"${cfg.modifier}+${cfg.left}" = "focus left";
"${cfg.modifier}+${cfg.down}" = "focus down";
"${cfg.modifier}+${cfg.up}" = "focus up";
"${cfg.modifier}+${cfg.right}" = "focus right";
### Move the focused window with the same, but add Shift
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
## Workspaces
### Switch to a workspace
"${cfg.modifier}+q" = "workspace number 1";
"${cfg.modifier}+w" = "workspace number 2";
"${cfg.modifier}+e" = "workspace number 3";
"${cfg.modifier}+r" = "workspace number 4";
"${cfg.modifier}+t" = "workspace number 5";
"${cfg.modifier}+y" = "workspace number 6";
"${cfg.modifier}+u" = "workspace number 7";
"${cfg.modifier}+i" = "workspace number 8";
"${cfg.modifier}+o" = "workspace number 9";
### Move focused container to workspace
"${cfg.modifier}+Shift+q" = "move container to workspace number 1";
"${cfg.modifier}+Shift+w" = "move container to workspace number 2";
"${cfg.modifier}+Shift+e" = "move container to workspace number 3";
"${cfg.modifier}+Shift+r" = "move container to workspace number 4";
"${cfg.modifier}+Shift+t" = "move container to workspace number 5";
"${cfg.modifier}+Shift+y" = "move container to workspace number 6";
"${cfg.modifier}+Shift+u" = "move container to workspace number 7";
"${cfg.modifier}+Shift+i" = "move container to workspace number 8";
"${cfg.modifier}+Shift+o" = "move container to workspace number 9";
# Layout
## Split direction
"${cfg.modifier}+v" = "splith";
"${cfg.modifier}+g" = "splitv";
## Switch the current container between different layout styles
"${cfg.modifier}+b" = "layout stacking";
"${cfg.modifier}+n" = "layout tabbed";
"${cfg.modifier}+m" = "layout toggle split";
## Make the current focus fullscreen
"${cfg.modifier}+f" = "fullscreen";
## move container between displays
"${cfg.modifier}+semicolon" = "move workspace to output right";
## Toggle the current focus between tiling and floating mode
"${cfg.modifier}+Shift+f" = "floating toggle";
## Swap focus between the tiling area and the floating area
"${cfg.modifier}+space" = "focus mode_toggle";
## Move focus to the parent container
"${cfg.modifier}+a" = "focus parent";
# Scratchpad
# Move the currently focused window to the scratchpad
"${cfg.modifier}+Shift+minus" = "move scratchpad";
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
"${cfg.modifier}+minus" = "scratchpad show";
# Exit sway (logs you out of your Wayland session)
"${cfg.modifier}+Shift+z" = "exec ${nag} -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' -b 'Reload' 'swaymsg reload'";
};
};
}

View file

@ -0,0 +1,88 @@
{
config,
pkgs,
...
}: {
imports = [
./keybindings.nix
./waybar.nix
];
home.packages = with pkgs; [
#light # TODO: Not enough to have this package, need it enabled in system config.
pamixer
playerctl
rofi
swaylock
wl-clipboard
];
services.playerctld.enable = true;
services.swayidle = {
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock}/bin/swaylock -i ${config.home.homeDirectory}/wallpaper.png";
}
{
timeout = 600;
command = "${pkgs.swaymsg}/bin/swaymsg 'ouput * dpms off'";
resumeCommand = "${pkgs.swaymsg}/bin/swaymsg 'output * dpms on'";
}
];
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock";
}
];
};
wayland.windowManager.sway = {
enable = true;
swaynag.enable = true;
wrapperFeatures.gtk = true; # so that gtk works properly
config = {
modifier = "Mod4";
terminal = "alacritty"; # TODO: include in packages above?
menu = "rofi -show run";
colors = {
focused = {
border = "#484848";
background = "#2B3C44";
text = "#FFFFFF";
indicator = "#333333";
childBorder = "#000000";
};
focusedInactive = {
border = "#484848";
background = "#333333";
text = "#FFFFFF";
indicator = "#000000";
childBorder = "#000000";
};
unfocused = {
border = "#484848";
background = "#333333";
text = "#FFFFFF";
indicator = "#000000";
childBorder = "#000000";
};
};
output = {
"*".bg = "${config.home.homeDirectory}/wallpaper.png fill";
"eDP-1".scale = "1";
"Dell Inc. DELL S2721QS 47W7M43" = {
transform = "270";
position = "1920 0";
};
"Dell Inc. DELL S2721QS 4FR7M43".position = "4080 830";
};
};
};
}

View file

@ -0,0 +1,148 @@
{
config,
pkgs,
options,
...
}: {
home.packages = with pkgs; [
#pactl
waybar
];
programs.waybar = {
enable = true;
systemd.enable = true;
style = builtins.readFile ./waybar_style.css;
settings = [
{
layer = "top";
position = "top";
height = 20;
modules-left = ["sway/workspaces"];
modules-center = ["clock"];
modules-right = [
"idle_inhibitor"
"temperature"
"cpu"
"pulseaudio"
"battery"
"memory"
"backlight"
"network"
"tray"
];
"sway/workspaces" = {
disable-scroll = false;
all-outputs = true;
format = "{icon}";
format-icons = {
"1" = "q";
"2" = "w";
"3" = "e";
"4" = "r";
"5" = "t";
"6" = "y";
"7" = "u";
"8" = "i";
"9" = "o";
urgent = " ";
focused = " ";
default = " ";
};
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " ";
deactivated = " ";
};
};
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [" " " " " "];
};
cpu = {
format = "{usage}% ";
tooltip = false;
};
pulseaudio = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{icon} {volume}% {format_source}";
format-bluetooth-muted = " {volume}% {format_source}";
format-muted = " {format_source}";
format-source = " ";
format-source-muted = " ";
format-icons = {
headphone = " ";
hands-free = " ";
headset = " ";
phone = " ";
portable = " ";
car = " ";
default = [" " " " " "];
};
tooltip-format = "{desc}, {volume}%";
# TODO: Figure out how to get pactl binary?
on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
on-click-right = "pactl set-source-mute @DEFAULT_SOURCE@ toggle";
on-click-middle = "pavucontrol";
};
battery = {
states = {
warning = 30;
critical = 1;
};
format = "{icon} {capacity}%";
tooltip-format = "{timeTo}, {capacity}%";
format-charging = " {capacity}%";
format-plugged = " ";
format-alt = "{time} {icon}";
format-icons = ["" "" "" "" ""];
};
memory = {
format = "{}% ";
};
backlight = {
format = "{icon} {percent}%";
format-icons = [" " " "];
on-scroll-up = "light -A 1";
on-scroll-down = "light -U 1";
};
network = {
format-wifi = " ";
format-ethernet = "{ifname}: {ipaddr}/{cidr} ";
format-linked = "{ifname} (No IP) ";
format-disconnected = " ";
format-alt = "{ifname}: {ipaddr}/{cidr}";
tooltip-format = "{essid} {signalStrength}%";
};
tray = {
spacing = 10;
};
}
];
};
wayland.windowManager.sway.config.bars = [];
#wayland.windowManager.sway.config.bars = [
#{
#position = "top";
#statusCommand = "${pkgs.waybar}/bin/waybar";
#workspaceNumbers = false;
#workspaceButtons = false;
#}
#];
}

View file

@ -0,0 +1,132 @@
* {
border: none;
font-family: Hack Nerd Font, sans-serif;
font-size: 10px;
}
window#waybar {
background-color: rgba(29, 32, 33, 0.9);
border-bottom: 3px solid #1d2021;
color: #ffffdf;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces,
#mode,
#cpu,
#memory,
#temperature,
#clock,
#idle_inhibitor,
#language,
#pulseaudio,
#backlight,
#battery,
#network,
#tray {
background-color: #303030;
padding: 0 10px;
margin: 3px;
border: 3px solid rgba(0, 0, 0, 0);
border-radius: 90px;
background-clip: padding-box;
}
#workspaces button {
padding: 0 5px;
min-width: 20px;
color: #87afaf;
}
#workspaces button:hover {
background-color: rgba(0, 0, 0, 1)
}
#workspaces button.focused {
color: #ffaf00;
}
#workspaces button.urgent {
color: #e06c75;
}
#clock {
color: #61afef;
}
#idle_inhibitor {
color: #abb2bf;
}
#idle_inhibitor.activated {
background-color: #abb2bf;
color: #1e222a;
}
#temperature {
color: #fb4934;
}
#temperature.critical {
color: #1d2021;
background-color: #9d0006;
}
#cpu {
color: #ff8700;
}
#memory {
color: #87af87;
}
#battery {
color: #b8bb26;
}
#battery.charging, #battery.plugged {
background-color: #1f321c;
color: #ffffaf;
}
@keyframes blink {
to {
background-color: #1f321c;
color: #ffffaf;
}
}
#battery.critical:not(.charging) {
background-color: #afaf00;
color: #303030;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#pulseaudio {
color: #fabd2f;
}
#pulseaudio.muted {
color: #b57614;
}
#backlight {
color: #17ccd5;
}
#network {
color: #d787af;
}
#network.disconnected {
color: #875f87;
}