Upgraded snowfall lib

This commit is contained in:
Alejandro Angulo 2023-10-04 20:36:21 -07:00
parent 7e87dbc55b
commit a1709f033f
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
58 changed files with 22 additions and 19 deletions

View file

@ -0,0 +1,51 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.addons.alacritty;
in {
options.aa.desktop.addons.alacritty = with types; {
enable = mkEnableOption "alacritty";
};
config = mkIf cfg.enable {
aa.system.fonts.enable = true;
# alacritty won't start without opengl
hardware.opengl.enable = true;
aa.home = {
extraOptions = {
programs.alacritty = {
enable = true;
settings = {
window.opacity = 0.95;
font = {
size = 12.0;
normal = {
family = "Hack Nerd Font";
style = "Regular";
};
bold = {
family = "Hack Nerd Font";
style = "Bold";
};
italic = {
family = "Hack Nerd Font";
style = "Italic";
};
bold_italic = {
family = "Hack Nerd Font";
style = "Bold Italic";
};
};
};
};
};
};
};
}

View file

@ -0,0 +1,25 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.addons.gammastep;
in {
options.aa.desktop.addons.gammastep = with types; {
enable = mkEnableOption "gammastep";
};
config = mkIf cfg.enable {
services.geoclue2.enable = true;
aa.home.extraOptions = {
services.gammastep = {
enable = true;
provider = "geoclue2";
};
};
};
}

View file

@ -0,0 +1,35 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.addons.mako;
in {
options.aa.desktop.addons.mako = with types; {
enable = mkEnableOption "mako";
};
config = mkIf cfg.enable {
aa.system.fonts.enable = true;
environment.systemPackages = with pkgs; [mako libnotify];
aa.home.extraOptions = {
services.mako = {
enable = true;
font = "'Hack Nerd Font' Regular 9";
backgroundColor = "#1D2021F0";
textColor = "#FFFFDF";
borderColor = "#1C1C1C";
borderRadius = 10;
padding = "10";
};
};
};
}

View file

@ -0,0 +1,22 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.addons.playerctl;
in {
options.aa.desktop.addons.playerctl = with types; {
enable = mkEnableOption "playerctl";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [playerctl];
aa.home.extraOptions = {
services.playerctld.enable = true;
};
};
}

View file

@ -0,0 +1,27 @@
{
options,
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.aa.desktop.addons.rofi;
in {
options.aa.desktop.addons.rofi = with types; {
enable = mkEnableOption "rofi";
};
config = mkIf cfg.enable {
aa.home.extraOptions = {
programs.rofi = {
enable = true;
font = "Hack Nerd Font 10";
theme = "gruvbox-dark-hard";
extraConfig = {
show-icons = true;
};
};
};
};
}

View file

@ -0,0 +1,41 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.addons.swayidle;
in {
options.aa.desktop.addons.swayidle = with types; {
enable = mkEnableOption "swayidle";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [swayidle];
aa.home.extraOptions = {
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock}/bin/swaylock";
}
{
timeout = 600;
command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'";
resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'";
}
];
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock";
}
];
};
};
};
}

View file

@ -0,0 +1,29 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.addons.swaylock;
user_cfg = config.home-manager.users.${config.aa.user.name};
in {
options.aa.desktop.addons.swaylock = with types; {
enable = mkEnableOption "swaylock";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [swaylock];
aa.home.extraOptions = {
programs.swaylock.settings = {
image = "${user_cfg.xdg.dataHome}/${config.aa.desktop.sway.wallpaperPath}";
};
};
# Workaround for https://github.com/NixOS/nixpkgs/issues/158025
# This comment specifically: https://github.com/NixOS/nixpkgs/issues/158025#issuecomment-1344766809
security.pam.services.swaylock = {};
};
}

View file

@ -0,0 +1,155 @@
{
options,
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.aa.desktop.addons.waybar;
in {
options.aa.desktop.addons.waybar = with types; {
enable = mkEnableOption "waybar";
thermal-zone = mkOption {
type = int;
default = 0;
description = "The thermal zone, as in `/sys/class/thermal/`.";
};
};
config = mkIf cfg.enable {
aa.system.fonts.enable = true;
aa.home = {
extraOptions = {
programs.waybar = {
enable = true;
systemd.enable = true;
style = builtins.readFile ./waybar_style.css;
settings = [
{
layer = "top";
position = "bottom";
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";
};
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " ";
deactivated = " ";
};
};
temperature = {
critical-threshold = 80;
format = "{icon}{temperatureC}°C";
format-icons = [" " " " " "];
thermal-zone = cfg.thermal-zone;
};
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 = [];
};
};
};
}

View file

@ -0,0 +1,132 @@
* {
border: none;
font-family: Hack Nerd Font, sans-serif;
font-size: 1em;
}
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;
}

View file

@ -0,0 +1,319 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.desktop.sway;
user_cfg = config.home-manager.users.${config.aa.user.name};
nag = "swaynag";
left = "h";
right = "l";
up = "k";
down = "j";
modifier = "Mod4";
# TODO: This assume I'll be using rofi and alacritty. Should make more
# generic.
menu = "rofi -show run";
terminal = "alacritty";
generate_grimshot_command = target: ''exec mkdir -p ~/screenshots && ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save ${target} ~/screenshots/"$(date -u --iso-8601=seconds)".png'';
in {
options.aa.desktop.sway = with types; {
enable = mkEnableOption "sway";
wallpaperPath = mkOption {
type = str;
default = "sway/wallpaper.jpg";
description = ''
Path to wallpaper, relative to config.home-home-manager.users.<username>.xdg.dataHome
'';
};
verticalWallpaperPath = mkOption {
type = str;
default = "sway/skull.png";
description = ''
Path to vertical wallpaper, relative to config.home-home-manager.users.<username>.xdg.dataHome
'';
};
};
config = mkIf cfg.enable {
aa.desktop.addons = {
alacritty.enable = true;
gammastep.enable = true;
mako.enable = true;
playerctl.enable = true;
rofi.enable = true;
swayidle.enable = true;
swaylock.enable = true;
waybar.enable = true;
# TODO
# light
};
aa.system.fonts.enable = true;
environment.systemPackages = with pkgs; [
wl-clipboard
grim
slurp
xdg-utils
xdg-desktop-portal-wlr
sway-contrib.grimshot
wev
];
# For screen sharing to work
xdg.portal = {
enable = true;
extraPortals = with pkgs; [xdg-desktop-portal-gtk];
wlr.enable = true;
};
aa.home.dataFile = {
${cfg.wallpaperPath}.source = ./wallpaper.jpg;
${cfg.verticalWallpaperPath}.source = ./vertical.png;
};
aa.home.extraOptions = {
wayland.windowManager.sway = {
enable = true;
swaynag.enable = true;
wrapperFeatures.gtk = true; # so that gtk works properly
systemd.enable = true; # needed this for screen sharing to work
config = {
inherit (terminal menu left right up down modifier);
workspaceAutoBackAndForth = true;
colors = {
focused = {
border = "#2B3C44";
background = "#4E3D45";
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";
};
};
window = {
titlebar = true;
commands = [
{
command = "inhibit_idle fullscreen";
criteria = {class = ".*";};
}
];
};
focus.followMouse = false;
fonts = {
names = ["Hack Nerd Font"];
size = 10.0;
};
# TODO: Should this live at the system configuration level?
output = {
# TODO: Set up wallpaper
"*".bg = "${user_cfg.xdg.dataHome}/${cfg.wallpaperPath} fill";
"eDP-1".scale = "1.25";
"ASUSTek COMPUTER INC ASUS VG24V 0x00007AAC" = {
mode = "1920x1080@120Hz";
position = "0 830";
};
"Dell Inc. DELL S2721QS 47W7M43" = {
transform = "270";
position = "1920 0";
bg = "${user_cfg.xdg.dataHome}/${cfg.verticalWallpaperPath} fill";
};
"Dell Inc. DELL S2721QS 4FR7M43".position = "4080 830";
};
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
"${left}" = "resize shrink width 50px";
"${down}" = "resize grow height 50px";
"${up}" = "resize shrink height 50px";
"${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";
# Exit resize mode
"Insert" = "mode default";
"Escape" = "mode default";
"Return" = "mode default";
};
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
"${modifier}+s" = "mode resize";
# Misc
"${modifier}+Return" = "exec ${terminal}";
"${modifier}+c" = "kill";
"${modifier}+p" = "exec ${menu}";
"${modifier}+z" = "reload";
"${modifier}+x" = "exec swaylock";
# 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'";
"${modifier}+Down" = "exec 'playerctl pause'";
"${modifier}+Up" = "exec 'playerctl play'";
"${modifier}+Right" = "exec 'playerctl next'";
"${modifier}+Left" = "exec 'playerctl previous'";
# Backlight keys
"XF86MonBrightnessDown" = "exec 'light -U 5'";
"XF86MonBrightnessUp" = "exec 'light -A 5'";
# Navigation
## Focus
### Move your focus around
"${modifier}+${left}" = "focus left";
"${modifier}+${down}" = "focus down";
"${modifier}+${up}" = "focus up";
"${modifier}+${right}" = "focus right";
### Move the focused window with the same, but add Shift
"${modifier}+Shift+${left}" = "move left";
"${modifier}+Shift+${down}" = "move down";
"${modifier}+Shift+${up}" = "move up";
"${modifier}+Shift+${right}" = "move right";
## Workspaces
### Switch to a workspace
"${modifier}+q" = "workspace number 1";
"${modifier}+w" = "workspace number 2";
"${modifier}+e" = "workspace number 3";
"${modifier}+r" = "workspace number 4";
"${modifier}+t" = "workspace number 5";
"${modifier}+y" = "workspace number 6";
"${modifier}+u" = "workspace number 7";
"${modifier}+i" = "workspace number 8";
"${modifier}+o" = "workspace number 9";
### Move focused container to workspace
"${modifier}+Shift+q" = "move container to workspace number 1";
"${modifier}+Shift+w" = "move container to workspace number 2";
"${modifier}+Shift+e" = "move container to workspace number 3";
"${modifier}+Shift+r" = "move container to workspace number 4";
"${modifier}+Shift+t" = "move container to workspace number 5";
"${modifier}+Shift+y" = "move container to workspace number 6";
"${modifier}+Shift+u" = "move container to workspace number 7";
"${modifier}+Shift+i" = "move container to workspace number 8";
"${modifier}+Shift+o" = "move container to workspace number 9";
# Layout
## Split direction
"${modifier}+v" = "splith";
"${modifier}+g" = "splitv";
## Switch the current container between different layout styles
"${modifier}+b" = "layout stacking";
"${modifier}+n" = "layout tabbed";
"${modifier}+m" = "layout toggle split";
## Make the current focus fullscreen
"${modifier}+f" = "fullscreen";
## move container between displays
"${modifier}+semicolon" = "move workspace to output right";
## Toggle the current focus between tiling and floating mode
"${modifier}+Shift+f" = "floating toggle";
## Swap focus between the tiling area and the floating area
"${modifier}+space" = "focus mode_toggle";
## Move focus to the parent container
"${modifier}+a" = "focus parent";
# Screenshots
## Current window
"${modifier}+period" = generate_grimshot_command "active";
## Area selection
"${modifier}+Shift+period" = generate_grimshot_command "area";
## Current output
"${modifier}+Alt+period" = generate_grimshot_command "output";
## Window selection
"${modifier}+Ctrl+period" = generate_grimshot_command "window";
# Scratchpad
# Move the currently focused window to the scratchpad
"${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.
"${modifier}+minus" = "scratchpad show";
# Exit sway (logs you out of your Wayland session)
"${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'";
};
};
};
};
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB