nix/home-manager/hosts/nixos-framework/desktops/hyprland/default.nix

109 lines
3.3 KiB
Nix
Raw Normal View History

2023-08-31 13:22:44 +02:00
{ theme, ... }: {
2023-09-29 05:46:20 +02:00
home.file = {
".config/hypr/hyprland.conf" = {
enable = true;
text = ''
# Laptop specific:
monitor=,highrr,auto,1.25
2023-09-29 14:21:35 +02:00
$mainMod = SUPER
2023-09-29 05:46:20 +02:00
# 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
2023-11-12 14:30:26 +01:00
# F4 - Previous Track
2023-09-29 05:46:20 +02:00
# bind = , XF86AudioMicMute, exec, amixer set Capture toggle
2023-11-12 14:30:26 +01:00
bind = , XF86AudioPrev, exec, playerctl previous
2023-09-29 05:46:20 +02:00
2023-11-12 14:30:26 +01:00
# F5 - Play/Pause
2023-09-29 05:46:20 +02:00
# binde = , XF86MonBrightnessDown, exec, light -U 5
2023-11-12 14:30:26 +01:00
binde = , XF86AudioPlay, exec, playerctl play-pause
2023-09-29 05:46:20 +02:00
2023-11-12 14:30:26 +01:00
# F6 - Next Track
2023-09-29 05:46:20 +02:00
# binde = , XF86MonBrightnessUp, exec, light -A 5
2023-11-12 14:30:26 +01:00
binde = , XF86AudioNext, exec, playerctl next
# F7 - Brightness Down
2023-09-29 05:46:20 +02:00
# bind = , XF86
2023-11-12 14:30:26 +01:00
binde = , XF86MonBrightnessDown, exec, light -U 5
2023-09-29 05:46:20 +02:00
2023-11-12 14:30:26 +01:00
# F8 - Brightness Up
2023-09-29 05:46:20 +02:00
# bind = , XF86
2023-11-12 14:30:26 +01:00
binde = , XF86MonBrightnessUp, exec, light -A 5
# F9 - External Displays
2023-09-29 05:46:20 +02:00
# bind = , XF86
2023-11-12 14:30:26 +01:00
# F10 - Airplane Mode
2023-09-29 05:46:20 +02:00
# bind = , XF86
2023-11-12 14:30:26 +01:00
# F11 - PRT SCR
2023-09-29 05:46:20 +02:00
# bind = , XF86
2023-11-12 14:30:26 +01:00
# F12 - "Framework Button"
2023-09-29 05:46:20 +02:00
# bind = , XF86
# Use rofi as an alt-tab switcher
# bind = ALT, TAB, exec, rofi -show window
2023-09-29 13:53:21 +02:00
# Lid closure:
# trigger when the switch is toggled
# bindl=,switch:[switch name],exec,swaylock
# trigger when the switch is turning on
bindl=,switch:on:1241ec0,exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1"
# trigger when the switch is turning off
bindl=,switch:off:1241ec0,exec,hyprctl keyword monitor "eDP-1, disable"
2023-09-29 05:46:20 +02:00
# 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
'';
};
};
}