nix/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix
2023-09-29 12:46:20 +09:00

97 lines
2.8 KiB
Nix

{ theme, ... }: {
home.file = {
".config/hypr/hyprland.conf" = {
enable = true;
text = ''
# Laptop specific:
monitor=,highrr,auto,1.25
# Set up the FN keys:
# F1 - Mute
# bind = , XF86AudioMute, exec, amixer set Master toggle && swayosd --output-volume=mute-toggle
bind = , XF86AudioMute, exec, swayosd --output-volume=mute-toggle
# F2 - Volume Down
# binde = , XF86AudioLowerVolume, exec, amixer set Master 3%-
binde = , XF86AudioLowerVolume, exec, swayosd --output-volume=lower
# F3 - Volume Up
# binde = , XF86AudioRaiseVolume, exec, amixer set Master 3%+
binde = , XF86AudioRaiseVolume, exec, swayosd --output-volume=raise
# F4 - Mute Microphone
# bind = , XF86AudioMicMute, exec, amixer set Capture toggle
bind = , XF86AudioMicMute, exec, swayosd --input-volume=mute-toggle
# F5 - Brightness Down
# binde = , XF86MonBrightnessDown, exec, light -U 5
binde = , XF86MonBrightnessDown, exec, swayosd --brightness=lower
# F6 - Brightness Up
# binde = , XF86MonBrightnessUp, exec, light -A 5
binde = , XF86MonBrightnessUp, exec, swayosd --brightness=raise
# F7 - External Displays
# bind = , XF86
# F8 - Airplane Mode
# bind = , XF86
# F9 - Notifications?
# bind = , XF86
# F10 - Call Answer?
# bind = , XF86
# F11 - Call Hang Up?
# bind = , XF86
# F12 - Favorites?
# bind = , XF86
# Use rofi as an alt-tab switcher
# bind = ALT, TAB, exec, rofi -show window
# Start the config:
exec-once=bash ~/.config/hypr/start.sh
'';
};
# Set the custom launcher script
".config/hypr/start.sh" = {
enable = true;
executable = true;
text = ''
#!/usr/bin/env bash
# https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
# Set the wallpaper
swww init
# Waybar
waybar &
# Set up the idle management daemon
swayidle -w \
timeout 120 'swaylock -f && playerctl pause' \
timeout 180 'hyprctl dispatch dpms off' \
timeout 300 'systemctl suspend-then-hibernate' \
resume 'hyprctl dispatch dpms on' \
before-sleep 'swaylock -f' \
before-sleep 'playerctl pause' &
# Automatic device mounting
udiskie &
DIR=/etc/nixos/git/wallpapers/${theme}
IMG=`ls $DIR | shuf -n 1`
swww img $DIR/$IMG -t random &
# Notification listener
mako
'';
};
};
}