refactor: rename home modules/general cleanup

This commit is contained in:
ooks-io 2024-01-26 13:43:14 +13:00
parent 16dd61d968
commit 653640b484
86 changed files with 230 additions and 322 deletions

View file

@ -0,0 +1,65 @@
{ config, lib, ... }:
let
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland = {
settings = {
general = {
gaps_in = 10;
gaps_out = 10;
border_size = 2;
cursor_inactive_timeout = 4;
"col.active_border" = "0xff${config.colorscheme.colors.base05}";
"col.inactive_border" = "0xff${config.colorscheme.colors.base02}";
};
group = {
"col.border_active" = "0xff${config.colorscheme.colors.base0B}";
"col.border_inactive" = "0xff${config.colorscheme.colors.base04}";
};
dwindle.split_width_multiplier = 1.35;
decoration = {
active_opacity = 1.0;
inactive_opacity = 1.0;
fullscreen_opacity = 1.0;
rounding = 0;
blur = {
enabled = false;
new_optimizations = true;
ignore_opacity = true;
};
drop_shadow = true;
shadow_range = 12;
shadow_offset = "3 3";
"col.shadow" = "0x44000000";
"col.shadow_inactive" = "0x66000000";
};
animations = {
enabled = true;
bezier = [
"easein,0.11, 0, 0.5, 0"
"easeout,0.5, 1, 0.89, 1"
"easeinback,0.36, 0, 0.66, -0.56"
"easeoutback,0.34, 1.56, 0.64, 1"
];
animation = [
"windowsIn,1,3,easeoutback,slide"
"windowsOut,1,3,easeinback,slide"
"windowsMove,1,3,easeoutback"
"workspaces,1,2,easeoutback,slide"
"fadeIn,1,3,easeout"
"fadeOut,1,3,easein"
"fadeSwitch,1,3,easeout"
"fadeShadow,1,3,easeout"
"fadeDim,1,3,easeout"
"border,1,3,easeout"
];
};
};
};
};
}

View file

@ -0,0 +1,160 @@
{ lib, config, pkgs, ... }:
let
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
notifysend = "${pkgs.libnotify}/bin/notify-send";
#pamixer = "${pkgs.pamixer}/bin/pamixer";
brightnessScript = pkgs.writeShellScriptBin "brightness" ''
#!/bin/sh
if [ "$1" == "up" ]; then
brillo -q -u 30000 -A 5
elif [ "$1" == "down" ]; then
brillo -q -u 30000 -U 5
else
echo "Invalid argument"
exit 1
fi
BRIGHTNESS=$(brillo -G | awk -F'.' '{print$1}')
${notifysend} --app-name="system-notify" -h string:x-canonical-private-synchronous:sys-notify "󰃠 $BRIGHTNESS%"
'';
volumeScript = pkgs.writeShellScriptBin "volume" ''
#!/bin/sh
if [ "$1" == "up" ]; then
pamixer --increase 5
elif [ "$1" == "down" ]; then
pamixer --decrease 5
elif [ "$1" == "mute" ]; then
pamixer --toggle-mute
fi
VOLUME=$(pamixer --get-volume-human)
${notifysend} --app-name="system-notify" -h string:x-canonical-private-synchronous:sys-notify " $VOLUME"
'';
in
{
wayland.windowManager.hyprland.settings = lib.mkIf cfg.enable {
bind = let
terminal = config.home.sessionVariables.TERMINAL;
browser = config.home.sessionVariables.BROWSER;
editor = config.home.sessionVariables.EDITOR;
bright = "${brightnessScript}/bin/brightness";
volume = "${volumeScript}/bin/volume";
swaylock = "${config.programs.swaylock.package}/bin/swaylock";
spotify = "${terminal} -e spotify_player";
spotifyctl = "${pkgs.spotify-player}/bin/spotify_player";
discord = "${pkgs.vesktop}/bin/vesktop";
#makoctl = "${config.services.mako.package}/bin/makoctl";
password = "${pkgs._1password-gui}/bin/1password --enable-features=UseOzonePlatform --ozone-platform=wayland";
#playerctl = "${config.services.playerctld.package}/bin/playerctl";
#playerctld = "${config.services.playerctld.package}/bin/playerctld";
#pactl = "${pkgs.pulseaudio}/bin/pactl";
in [
# Program Launch
"SUPER, b, exec, ${browser}"
"SUPER, return, exec, ${terminal}"
"SUPER, e, exec, ${editor}"
"SUPER, m, exec, ${spotify}"
"SUPERSHIFT, P, exec, ${password}"
"SUPER, d, exec, ${discord}"
# Spotify PLayer Controls
"SUPER, bracketright, exec, ${spotifyctl} playback next"
"SUPER, bracketleft, exec, ${spotifyctl} playback previous"
"SUPER, backslash, exec, ${spotifyctl} playback play-pause"
# Brightness
",XF86MonBrightnessUp, exec, ${bright} up"
",XF86MonBrightnessDown, exec, ${bright} down"
# Volume
",XF86AudioRaiseVolume, exec, ${volume} up"
",XF86AudioLowerVolume, exec, ${volume} down"
",XF86AudioMute, exec, ${volume} mute"
# Window Management
"SUPER, Q, killactive"
"SUPER CTRL, backspace, killactive"
"SUPERSHIFT ALT, delete, exit"
"SUPER, F, fullscreen"
"SUPER, Space, togglefloating"
"SUPER, P, pseudo" # dwindle
"SUPER, S, togglesplit" # dwindle
# Focus
"SUPER, left, movefocus,l"
"SUPER, right, movefocus,r"
"SUPER, up, movefocus,u"
"SUPER, down, movefocus,d"
# Move
"SUPERSHIFT, left, movewindow,l"
"SUPERSHIFT, right, movewindow,r"
"SUPERSHIFT, up, movewindow,u"
"SUPERSHIFT, down, movewindow,d"
#Resize
"SUPER CTRL, left, resizeactive,-20 0"
"SUPERCTRL, right, resizeactive,20 0"
"SUPER CTRL, up, resizeactive,0 -20"
"SUPERCTRL, down, resizeactive,0 20"
# Switch workspace
"SUPER, 1, workspace,1"
"SUPER, 2, workspace,2"
"SUPER, 3, workspace,3"
"SUPER, 4, workspace,4"
"SUPER, 5, workspace,5"
"SUPER, 6, workspace,6"
"SUPER, 7, workspace,7"
"SUPER, 8, workspace,8"
"SUPER, 9, workspace,9"
"SUPER, 0, workspace,10"
"SUPER, comma, workspace,e+1"
"SUPER, period, workspace,e-1"
"SUPER, tab, focusCurrentOrLast"
# Move workspace
"SUPERSHIFT, 1, movetoworkspace,1"
"SUPERSHIFT, 2, movetoworkspace,2"
"SUPERSHIFT, 3, movetoworkspace,3"
"SUPERSHIFT, 4, movetoworkspace,4"
"SUPERSHIFT, 5, movetoworkspace,5"
"SUPERSHIFT, 6, movetoworkspace,6"
"SUPERSHIFT, 7, movetoworkspace,7"
"SUPERSHIFT, 8, movetoworkspace,8"
"SUPERSHIFT, 9, movetoworkspace,9"
"SUPERSHIFT, 0, movetoworkspace,10"
# Lock Screen
"SUPER, Backspace, exec, ${swaylock}"
];
# Mouse
bindm = [
"SUPER, mouse:272, movewindow"
"SUPER, mouse:273, resizewindow"
];
};
}

View file

@ -0,0 +1,65 @@
{ lib, config, pkgs, ... }:
let
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
in
{
imports = [
./binds.nix #hyprland keybindings
./appearance.nix
./rules.nix
./exec.nix
];
config = lib.mkIf cfg.enable {
xdg.portal = {
extraPortals = [ pkgs.inputs.hyprland.xdg-desktop-portal-hyprland ];
configPackages = [ pkgs.inputs.hyprland.hyprland ];
};
home.packages = with pkgs; [
inputs.hyprwm-contrib.grimblast
hyprpicker
light
hyprshade
];
wayland.windowManager.hyprland = {
enable = true;
package = pkgs.inputs.hyprland.hyprland;
systemd = {
enable = true;
extraCommands = lib.mkBefore [
"systemctl --user stop graphical-session.target"
"systemctl --user start hyprland-session.target"
];
};
settings = {
input = {
kb_layout = "us";
touchpad = {
disable_while_typing = false;
};
};
misc = {
vrr = true;
disable_hyprland_logo = true;
force_default_wallpaper = 0;
};
gestures = {
workspace_swipe = true;
workspace_swipe_forever = true;
};
monitor = lib.concatMap (m: let
resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}";
position = "${toString m.x}x${toString m.y}";
basicConfig = "${m.name},${if m.enabled then "${resolution},${position},1" else "disable"}";
in
[ basicConfig ] ++ (if m.transform != 0 then ["${m.name},transform,${toString m.transform}"] else [])
) (config.monitors);
};
};
};
}

View file

@ -0,0 +1,38 @@
{ config, lib, ... }:
{
home = lib.mkIf config.homeModules.desktop.wayland.windowManager.hyprland.enable {
sessionVariables = {
# GTK_IM_MODULE = "fcitx5";
# QT_IM_MODULE = "fcitx5";
# XMODIFIERS = "@im=fcitx5";
#QT_QPA_PLATFORMTHEME = "gtk3";
QT_SCALE_FACTOR = "1";
#MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
WLR_DRM_DEVICES = "/dev/dri/card1:/dev/dri/card0";
WLR_NO_HARDWARE_CURSORS = "1"; # if no cursor,uncomment this line
WLR_RENDERER_ALLOW_SOFTWARE = "1";
NIXOS_OZONE_WL = "1";
# GBM_BACKEND = "nvidia-drm";
CLUTTER_BACKEND = "wayland";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
LIBVA_DRIVER_NAME = "nvidia";
WLR_RENDERER = "vulkan";
# __NV_PRIME_RENDER_OFFLOAD = "1";
XCURSOR_SIZE = "24";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share";
};
};
}

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
let
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
in
{
config = {
wayland.windowManager.hyprland.settings = lib.mkIf cfg.enable {
exec = [
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
"${pkgs.swaybg}/bin/swaybg -i ${config.wallpaper} --mode fill"
];
exec-once = [
"${pkgs._1password-gui}/bin/1password --silent"
"${pkgs.live-buds-cli}/bin/earbuds -d"
"eww daemon && eww open bar"
"systemctl --user start clight"
];
};
};
}

View file

@ -0,0 +1,20 @@
{ lib, config, ... }:
let
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
in
{
config = {
wayland.windowManager.hyprland.settings = lib.mkIf cfg.enable {
windowrulev2 = [
"float,move 191 15,size 924 396,class:(1Password)"
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
"rounding 0, xwayland:1"
"center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$"
"size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$"
];
};
};
}