nix-config/modules/home/hyprland/default.nix

451 lines
14 KiB
Nix
Raw Permalink Normal View History

2024-05-28 04:08:06 -04:00
{
pkgs,
config,
lib,
...
}: let
palette = config.colorScheme.palette;
betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)";
in
with pkgs; {
home.packages = [
wl-clipboard-rs
];
programs = {
rofi = {
enable = true;
catppuccin.enable = true;
package = pkgs.rofi-wayland;
extraConfig = {
modi = "run,drun,window";
icon-theme = "Oranchelo";
show-icons = true;
terminal = "wezterm";
drun-display-format = "{icon} {name}";
location = 0;
disable-history = false;
hide-scrollbar = true;
display-drun = " Apps ";
display-run = " Run ";
display-window = " 󰍲 Window";
display-Network = " 󰤨 Network";
sidebar-mode = true;
};
theme = {
"*".font = "Maple Mono NF 14";
window.border-radius = 10;
};
};
waybar = {
enable = true;
package = pkgs.waybar;
settings = [
{
layer = "top";
position = "top";
modules-left = [
"custom/startmenu"
2024-06-13 02:30:20 -04:00
"hyprland/workspaces"
2024-05-28 04:08:06 -04:00
"hyprland/window"
"pulseaudio"
];
modules-right = [
2024-06-13 02:30:20 -04:00
"battery"
2024-05-28 04:08:06 -04:00
"network"
"custom/notification"
"tray"
"clock"
];
"hyprland/workspaces" = {
format = "{name}";
format-icons = {
default = " ";
active = " ";
urgent = " ";
};
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
};
"clock" = {
format = " {:L%I:%M %p}";
tooltip = true;
tooltip-format = "<big>{:%A, %d.%B %Y }</big>\n<tt><small>{calendar}</small></tt>";
};
"hyprland/window" = {
max-length = 22;
separate-outputs = false;
rewrite = {
"" = "Desktop";
};
};
"memory" = {
interval = 5;
format = " {}%";
tooltip = true;
};
"cpu" = {
interval = 5;
format = " {usage:2}%";
tooltip = true;
};
"disk" = {
format = " {free}";
tooltip = true;
};
2024-06-13 02:30:20 -04:00
"battery" = {
format = " {}%";
tooltip = true;
};
2024-05-28 04:08:06 -04:00
"network" = {
format-icons = [
"󰤯"
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
format-ethernet = " {bandwidthDownOctets}";
format-wifi = "{icon} {essid}";
format-disconnected = "󰤮";
tooltip = false;
};
"tray" = {
spacing = 12;
};
"pulseaudio" = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "󰅶 {icon} {format_source}";
format-muted = "󰅶 {format_source}";
format-source = " {volume}%";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "󰋎";
phone = "";
portable = "";
car = "";
default = [
""
""
""
];
};
on-click = "sleep 0.1 && pavucontrol";
};
"custom/startmenu" = {
tooltip = false;
format = "";
on-click = "rofi -show drun";
};
"custom/notification" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
exec = "swaync-client -swb";
on-click = "swaync-client -t &";
escape = true;
};
}
];
style = lib.concatStrings [
''
* {
border: none;
border-radius: 0px;
font-family: Maple Mono NF;
font-size: 16px;
min-height: 0px;
}
window#waybar {
background-color: #${palette.base00};
}
#workspaces {
background: #${palette.base01};
border-radius: 16px;
color: #${palette.base00};
margin: 4px 4px;
padding: 8px 5px;
}
#workspaces button {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0E}, #${palette.base0F}, #${palette.base0D}, #${palette.base09});
background-size: 300% 300%;
border-radius: 16px;
color: #${palette.base00};
font-weight: bold;
margin: 0px 3px;
opacity: 0.5;
padding: 0px 5px;
transition: ${betterTransition};
}
#workspaces button.active {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0E}, #${palette.base0F}, #${palette.base0D}, #${palette.base09});
background-size: 300% 300%;
border-radius: 16px;
color: #${palette.base00};
font-weight: bold;
margin: 0px 3px;
min-width: 40px;
opacity: 1.0;
padding: 0px 5px;
transition: ${betterTransition};
}
#workspaces button:hover {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0E}, #${palette.base0F}, #${palette.base0D}, #${palette.base09});
background-size: 300% 300%;
border-radius: 16px;
color: #${palette.base00};
font-weight: bold;
opacity: 0.8;
transition: ${betterTransition};
}
@keyframes gradient_horizontal {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
@keyframes swiping {
0% { background-position: 0% 200%; }
100% { background-position: 200% 200%; }
}
tooltip {
background: #${palette.base00};
border: 1px solid #${palette.base0E};
border-radius: 12px;
}
tooltip label {
color: #${palette.base07};
}
#window, #pulseaudio, #cpu, #memory, #idle_inhibitor {
background: #${palette.base01};
border-radius: 24px 10px 24px 10px;
color: #${palette.base05};
font-weight: bold;
margin: 4px 0px;
margin-left: 7px;
padding: 0px 18px;
}
#custom-startmenu {
background: #${palette.base01};
border-radius: 0px 0px 40px 0px;
color: #${palette.base0D};
font-size: 28px;
margin: 0px;
padding: 0px 30px 0px 15px;
}
2024-06-13 02:30:20 -04:00
#battery, #network, #custom-notification, #tray {
2024-05-28 04:08:06 -04:00
background: #${palette.base01};
border-radius: 10px 24px 10px 24px;
color: #${palette.base05};
font-weight: bold;
margin: 4px 0px;
margin-right: 7px;
padding: 0px 18px;
}
#clock {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0C}, #${palette.base0F}, #${palette.base0B}, #${palette.base08});
background-size: 300% 300%;
border-radius: 0px 0px 0px 40px;
color: #${palette.base00};
font-weight: bold;
margin: 0px;
padding: 0px 15px 0px 30px;
}
''
];
};
};
2024-06-13 02:30:20 -04:00
services.swaync = {
enable = true;
style = builtins.fetchurl {
url = "https://github.com/catppuccin/swaync/releases/download/v0.2.3/mocha.css";
sha256 = "1xr1wkg4zb467b35xhsfqiwhimfnn88i3ml5rf173rkm7fyby9qy";
2024-05-28 04:08:06 -04:00
};
};
wayland.windowManager.hyprland = {
enable = true;
systemd.variables = ["--all"];
settings = let
mod = "SUPER";
modC = "SUPER CTRL";
modS = "SUPER SHIFT";
2024-06-13 02:30:20 -04:00
browser = "firefox";
2024-06-13 02:49:37 -04:00
colorPicker = "notify-send -e -i gtk-color-picker $(${hyprpicker}/bin/hyprpicker -a) 'Copied to clipboard.'";
2024-05-28 04:08:06 -04:00
fileManager = "nautilus";
launcher = "rofi -show drun";
terminal = "wezterm";
screenshot = mode: "${
hyprshot.overrideAttrs {
# Fixes cursors showing in region shots
src = pkgs.fetchFromGitHub {
owner = "BenCarmichael01";
repo = "Hyprshot";
rev = "84e2adcd5dd9060178d0d028ad032734797fba23";
hash = "sha256-XDKwBiUMWvxoWpkdJ0EK4kEqPSTZLcF6axHjom3c5Jk=";
};
}
}/bin/hyprshot --clipboard-only -m ${mode}";
in {
decoration.rounding = 10;
dwindle.preserve_split = true;
gestures.workspace_swipe = true;
input.touchpad.natural_scroll = true;
2024-06-13 02:30:20 -04:00
xwayland.force_zero_scaling = true;
2024-05-28 04:08:06 -04:00
layerrule = [
"dimaround, rofi"
];
animations = {
enabled = true;
bezier = [
"overshot,0.7,0.6,0.1,1.1"
"bounce,1,1.6,0.1,0.85"
];
animation = [
"windows,1,5,bounce,popin"
"border,1,20,default"
"fade,1,5,default"
"workspaces,1,5,overshot,slide"
];
};
general = {
border_size = 2;
gaps_in = 10;
resize_on_border = true;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
};
exec-once = [
"waybar"
2024-06-13 02:30:20 -04:00
"${mpvpaper}/bin/mpvpaper -vp -o 'no-audio loop panscan=1.0' eDP-1 ${builtins.toString ./wall.mp4}"
2024-05-28 04:08:06 -04:00
];
misc = {
force_default_wallpaper = 0;
disable_hyprland_logo = true;
};
monitor = [
2024-06-13 02:30:20 -04:00
"eDP-1, 2560x1664@60, auto, 1.6"
2024-05-28 04:08:06 -04:00
];
bindm = [
"${mod}, mouse:272, movewindow"
"${mod}, mouse:273, resizewindow"
];
bind =
[
# Apps
"${mod}, c, exec, ${colorPicker}"
"${mod}, w, exec, ${browser}"
"${mod}, e, exec, ${fileManager}"
"${mod}, r, exec, ${launcher}"
"${mod}, Return, exec, ${terminal}"
# Screenshots
"${modS}, s, exec, ${screenshot "window"}"
"${modC}, 3, exec, ${screenshot "output -c"}"
"${modC}, 4, exec, ${screenshot "region -C 0,0"}"
# Mouse controls
"${mod}, mouse_down, workspace, e-1"
"${mod}, mouse_up, workspace, e+1"
# Quitting
"${mod}, q, killactive"
"${modS}, q, exit"
# Toggles
"${mod}, j, togglesplit"
"${mod}, Space, togglefloating"
# Focus movements
"${mod}, h, movefocus, l"
"${mod}, j, movefocus, d"
"${mod}, k, movefocus, u"
"${mod}, l, movefocus, r"
# Window movements
"${modS}, h, movewindow, l"
"${modS}, j, movewindow, d"
"${modS}, k, movewindow, u"
"${modS}, l, movewindow, r"
]
++ (
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in [
# Workspaces
"${mod}, ${ws}, workspace, ${builtins.toString (x + 1)}"
"${modS}, ${ws}, movetoworkspace, ${builtins.toString (x + 1)}"
]
)
10)
);
};
};
}