migrate hyprland to nix

This commit is contained in:
Benjamin Palko 2024-07-21 10:06:50 -04:00
parent 62ed20d1f5
commit 5db1a379e4
15 changed files with 250 additions and 283 deletions

View file

@ -0,0 +1,22 @@
{
input = {
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_options = "";
kb_rules = "";
follow_mouse = 1;
touchpad = {
natural_scroll = "no";
};
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
};
device = {
name = "epic-mouse-v1";
sensitivity = -0.5;
};
}

View file

@ -0,0 +1,81 @@
{
bind =
[
"$mainMod, T, exec, $terminal"
"$mainMod, X, killactive,"
"$mainMod, ESCAPE, exit,"
"$mainMod, E, exec, $fileManager"
"$mainMod, F, togglefloating,"
"$mainMod, R, exec, $menu"
"$mainMod, P, pseudo," # dwindle
"$mainMod, V, togglesplit," # dwindle
"$mainMod, L, exec, $lockScreen" # hyprlock
"$mainMod, period, exec, emote"
"$mainMod, B, exec, firefox"
"$mainMod CTRL, F, fullscreen"
", PRINT, exec, grim -g \"$(slurp)\" - | swappy -f -"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
###############################################################################
# Special workspaces
###############################################################################
# Scratchpad
"CTRL SHIFT, S, togglespecialworkspace, magic"
"CTRL $mainMod, S, movetoworkspace, special:magic"
# Terminal
"CTRL SHIFT, T, togglespecialworkspace, terminal"
"CTRL $mainMod, T, movetoworkspace, special:terminal"
# Music
"CTRL SHIFT, M, togglespecialworkspace, music"
"CTRL $mainMod, M, movetoworkspace, special:music"
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
# Switch workspaces
"CTRL ALT, right, workspace, e+1"
"CTRL ALT, left, workspace, e-1"
# Audio keybinds
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioStop, exec,"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioNext, exec, playerctl next"
]
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (
builtins.genList (
x:
let
ws =
let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in
[
# Switch workspaces with mainMod + [0-9]
"$mainMod, ${ws}, workspace, ${toString (x + 1)}"
# Move active window to a workspace with mainMod + SHIFT + [0-9]
"$mainMod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
]
) 10
)
);
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
}

View file

@ -0,0 +1,71 @@
{
general = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 10;
gaps_out = 20;
border_size = 3;
"col.active_border" = "$color4 $color13 45deg";
"col.inactive_border" = "$color0";
layout = "dwindle";
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = true;
};
decoration = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10;
blur = {
enabled = true;
size = 3;
passes = 1;
ignore_opacity = true;
};
drop_shadow = "yes";
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";
};
animations = {
enabled = "yes";
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
animation = [
"windows, 1, 7, myBezier"
"windowsOut, 1, 7, default, popin 80%"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = "yes"; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = "yes"; # you probably want this
};
master = {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
};
gestures = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = "off";
};
misc = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
force_default_wallpaper = 0; # Set to 0 or 1 to disable the anime mascot wallpapers
};
}

View file

@ -0,0 +1,12 @@
{
env = [
"XCURSOR_SIZE,24"
"QT_QPA_PLATFORM,wayland"
"WLR_NO_HARDWARE_CURSORS,1"
"LIBVA_DRIVER_NAME,nvidia"
"XDG_SESSION_TYPE,wayland"
"GBM_BACKEND,nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
];
}

View file

@ -0,0 +1,19 @@
{
windowrule = [
"float, title:rofi"
"workspace special:terminal, kitty"
"workspace special:music, title:^Spotify Premium$"
"workspace 1, discord"
"opacity 0.999, discord"
"workspace 1, Caprine"
"opacity 0.999, Caprine"
"workspace 2, firefox"
"opacity 0.999, firefox"
"workspace 3, class:^(steam_app_553850)$"
"float, title:Friends List"
];
windowrulev2 = [
"nomaxsize, class:.*"
"opacity 0.85 0.8, initialTitle:^Spotify Premium$"
];
}

View file

@ -0,0 +1,13 @@
{
exec-once = [
''
bash ${builtins.getEnv "PWD"}/dotfiles/home-manager/hyprland/config/scripts/start-swaync.sh
''
"hypridle"
"swww-daemon"
''
bash ${builtins.getEnv "PWD"}/dotfiles/home-manager/hyprland/config/scripts/start-waybar.sh
''
"emote"
];
}

View file

@ -3,6 +3,7 @@
imports = [ imports = [
./gtk.nix ./gtk.nix
./hypridle.nix ./hypridle.nix
./hyprland.nix
./hyprlock.nix ./hyprlock.nix
]; ];
@ -14,15 +15,7 @@
size = 24; size = 24;
}; };
wayland.windowManager.hyprland = {
enable = true;
};
xdg.configFile = { xdg.configFile = {
hypr = {
source = ../../hypr;
recursive = true;
};
rofi = { rofi = {
source = ../../rofi; source = ../../rofi;
recursive = true; recursive = true;

View file

@ -0,0 +1,31 @@
{ lib, ... }:
let
configs = [
./config/input.nix
./config/keybinds.nix
./config/look.nix
./config/nvidia.nix
./config/rules.nix
./config/startup.nix
];
in
{
wayland.windowManager.hyprland = {
enable = true;
extraConfig = builtins.readFile /home/benjamin/.cache/wal/colors-hyprland.conf;
settings = lib.mkMerge (
[
{
monitor = "DP-1,preferred,auto,auto";
"$terminal" = "kitty";
"$fileManager" = "Thunar";
"$menu" = "rofi -show drun";
"$lockScreen" = "hyprlock";
"$mainMod" = "SUPER";
}
]
++ (lib.forEach configs (config: import config))
);
};
}

View file

@ -1,16 +0,0 @@
# -----------------------------------------------------
# Environment Variables
# name: "Nvidia"
# -----------------------------------------------------
# https://wiki.hyprland.org/Nvidia/
env = XCURSOR_SIZE,24
env = QT_QPA_PLATFORM,wayland
env = WLR_NO_HARDWARE_CURSORS,1
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
# env = __GL_VRR_ALLOWED,1
# env = WLR_DRM_NO_ATOMIC,1

View file

@ -1,80 +0,0 @@
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, T, exec, $terminal
bind = $mainMod, X, killactive,
bind = $mainMod, ESCAPE, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, F, togglefloating,
bind = $mainMod, R, exec, $menu
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, V, togglesplit, # dwindle
bind = $mainMod, L, exec, $lockScreen # hyprlock
bind = $mainMod, period, exec, emote
bind = $mainMod, B, exec, firefox
bind = $mainMod CTRL, F, fullscreen
bind = , PRINT, exec, grim -g "$(slurp)" - | swappy -f -
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
###############################################################################
# Special workspaces
###############################################################################
# Scratchpad
bind = CTRL SHIFT, S, togglespecialworkspace, magic
bind = CTRL $mainMod, S, movetoworkspace, special:magic
# Terminal
bind = CTRL SHIFT, T, togglespecialworkspace, terminal
bind = CTRL $mainMod, T, movetoworkspace, special:terminal
# Music
bind = CTRL SHIFT, M, togglespecialworkspace, music
bind = CTRL $mainMod, M, movetoworkspace, special:music
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Switch workspaces
bind = CTRL ALT, right, workspace, e+1
bind = CTRL ALT, left, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
# Audio keybinds
bind = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+
bind = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-
bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioStop, exec,
bind = , XF86AudioPrev, exec, playerctl previous
bind = , XF86AudioNext, exec, playerctl next

View file

@ -1,30 +0,0 @@
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = nomaxsize, class:.* # You'll probably like this.
# windowrulev2 = opacity 1 0.6, class:.*
# Apps
windowrule = float, title:rofi
windowrule = workspace special:terminal, kitty
windowrule = workspace special:music, title:^Spotify Premium$
windowrulev2 = opacity 0.85 0.8, initialTitle:^Spotify Premium$
windowrule = workspace 1, discord
windowrule = opacity 0.999, discord
windowrule = workspace 1, Caprine
windowrule = opacity 0.999, Caprine
windowrule = workspace 2, firefox
windowrule = opacity 0.999, firefox
windowrule = workspace 3, class:^(steam_app_553850)$
windowrule = float, title:Friends List

View file

@ -1,11 +0,0 @@
# Notification Daemon
exec-once = bash ~/.config/hypr/scripts/start-swaync.sh
# Idle Daemon
exec-once = hypridle
# Status-bar
exec-once = bash ~/.config/hypr/scripts/start-waybar.sh
# Emotes
exec-once = emote
# Wallpaper Daemon
exec-once = swww-daemon

View file

@ -1,138 +0,0 @@
# #######################################################################################
# AUTOGENERATED HYPR CONFIG.
# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
# #######################################################################################
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#
#autogenerated = 1 # remove this line to remove the warning
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=DP-1,preferred,auto,auto
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
source = ~/.config/hypr/config/startup.conf
# PyWal Colors
source = ~/.cache/wal/colors-hyprland.conf
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# Set programs that you use
$terminal = kitty
$fileManager = Thunar
$menu = rofi -show drun
$lockScreen = hyprlock
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
env = XCURSOR_THEME,catpuccin-mocha-light-cursors
env = HYPRCURSOR_THEME,catpuccin-mocha-light-cursors
env = HYPRCURSOR_SIZE,24
source = ~/.config/hypr/config/environments/nvidia.conf
source = ~/.config/hypr/config/keybinds.conf
source = ~/.config/hypr/config/rules.conf
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
touchpad {
natural_scroll = no
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 10
gaps_out = 20
border_size = 3
col.active_border = $color4 $color13 45deg
col.inactive_border = $color0
layout = dwindle
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = true
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur {
enabled = true
size = 3
passes = 1
ignore_opacity = true
}
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off
}
misc {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
device {
name = epic-mouse-v1
sensitivity = -0.5
}