281 lines
8.5 KiB
Nix
Raw Normal View History

2024-08-26 22:10:44 +03:00
{ pkgs, lib, config, ... }: {
wayland.windowManager.hyprland =
let
2024-08-27 13:53:48 +03:00
colors = config.lib.stylix.colors;
2024-08-26 22:10:44 +03:00
wallpaper_changer = pkgs.writers.writePython3Bin "wallpaper_changer" {
flakeIgnore = [ "E501" "E111" "E701" "E241" "E731" ];
} /*py*/ ''
import requests as requests
from random import choice
from os import system, mkdir, listdir
from os.path import exists
notify = lambda s: system(f"notify-desktop Wallpaper '{s}'")
folder = "/home/sweetbread/Wallpapers"
url = "https://wallhaven.cc/api/v1/collections/sweetbread/1764377"
with open("${config.sops.secrets."tokens/apis/wallhaven".path}") as f:
token = f.read()
notify("Updating wallpaper!")
try:
json = requests.get(url, params={'apikey': token}).json()
wallpaper = choice(json['data'])
link = wallpaper['path']
format = wallpaper['file_type']
id = wallpaper['id']
if format == "image/jpeg": ext = "jpg"
else: ext = "png"
filename = f"{id}.{ext}"
if not exists(f"{folder}/{filename}"):
if not exists(folder):
mkdir(f"{folder}")
notify("Downloading...")
with open(f"{folder}/{filename}", 'wb') as f:
r = requests.get(link)
f.write(r.content)
except requests.exceptions.ConnectionError:
notify("Offline mode")
filename = choice(listdir(folder))
finally:
system(f"swww img {folder}/{filename} --transition-type center")
'';
in {
2024-04-17 05:52:14 +05:00
enable = true;
xwayland.enable = true;
settings = {
"$mainMod" = "SUPER";
2024-09-20 00:41:28 +03:00
monitor = [
"DP-3, 3440x1440@165.00Hz, auto-right, 1"
# "HDMI-A-1, 3840x2160@60.00Hz, auto-left, 2"
"HDMI-A-1, disabled"
",preferred,auto,1"
];
2024-04-17 05:52:14 +05:00
env = [
2024-05-01 15:39:14 +03:00
"LIBVA_DRIVER_NAME,nvidia"
"XDG_SESSION_TYPE,wayland"
"GBM_BACKEND,nvidia"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
"WLR_NO_HARDWARE_CURSORS,1"
2024-04-17 05:52:14 +05:00
"XDG_CURRENT_DESKTOP,Hyprland"
"XDG_SESSION_TYPE,wayland"
"XDG_SESSION_DESKTOP,Hyprland"
"XCURSOR_SIZE,36"
"QT_QPA_PLATFORM,wayland"
"XDG_SCREENSHOTS_DIR,~/screens"
];
debug = {
disable_logs = false;
enable_stdout_logs = true;
};
input = {
kb_layout = "us,ru";
kb_variant = "lang";
kb_options = "grp:caps_toggle";
follow_mouse = 1;
touchpad = {
natural_scroll = false;
};
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
};
general = {
gaps_in = 5;
gaps_out = 20;
border_size = 3;
2024-08-27 13:53:48 +03:00
"col.active_border" = "rgba(${colors.base0C}ee) rgba(${colors.base0B}ee) 45deg";
"col.inactive_border" = "rgba(${colors.base05}aa)";
2024-04-17 05:52:14 +05:00
layout = "dwindle";
};
decoration = {
rounding = 10;
blur = {
enabled = true;
size = 16;
passes = 2;
new_optimizations = true;
};
drop_shadow = true;
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";
};
animations = {
enabled = true;
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
# bezier = "myBezier, 0.33, 0.82, 0.9, -0.08";
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 = {
pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
2024-05-01 15:47:09 +03:00
smart_split = true;
2024-04-17 05:52:14 +05:00
};
master = {
2024-08-26 12:41:53 +03:00
new_status = "master";
2024-04-17 05:52:14 +05:00
};
gestures = {
workspace_swipe = true;
workspace_swipe_fingers = 3;
2024-05-01 15:47:09 +03:00
workspace_swipe_invert = true;
2024-04-17 05:52:14 +05:00
workspace_swipe_distance = 200;
2024-04-18 11:47:37 +05:00
workspace_swipe_forever = true;
2024-04-17 05:52:14 +05:00
};
misc = {
animate_manual_resizes = true;
animate_mouse_windowdragging = true;
enable_swallow = true;
render_ahead_of_time = false;
2024-05-01 15:47:09 +03:00
disable_hyprland_logo = false;
2024-04-17 05:52:14 +05:00
};
windowrule = [
"float, ^(imv)$"
2024-05-01 15:47:09 +03:00
"float, ^(feh)$"
2024-04-17 05:52:14 +05:00
"float, ^(mpv)$"
2024-07-31 21:28:56 +03:00
"float, ^(nmtui)$"
2024-08-26 01:01:46 +03:00
"float, title:^(Список друзей)"
2024-04-17 05:52:14 +05:00
];
exec-once = [
2024-08-26 22:10:44 +03:00
"systemctl --user start plasma-polkit-agent"
"swww init"
"python3 ${lib.getExe wallpaper_changer}"
"waybar"
"wl-paste --type text --watch cliphist store"
"wl-paste --type image --watch cliphist store"
];
2024-04-17 05:52:14 +05:00
bind = [
"$mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy"
"$mainMod, Return, exec, alacritty"
"$mainMod, Q, killactive,"
"$mainMod, M, exit,"
"$mainMod, E, exec, alacritty -e sh -c yazi"
2024-04-17 05:52:14 +05:00
"$mainMod, F, togglefloating,"
"$mainMod, D, exec, wofi --show drun"
"$mainMod, P, pseudo, # dwindle"
"$mainMod, J, togglesplit, # dwindle"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
# Moving windows
"$mainMod SHIFT, left, swapwindow, l"
"$mainMod SHIFT, right, swapwindow, r"
"$mainMod SHIFT, up, swapwindow, u"
"$mainMod SHIFT, down, swapwindow, d"
# Window resizing X Y
"$mainMod CTRL, left, resizeactive, -60 0"
"$mainMod CTRL, right, resizeactive, 60 0"
"$mainMod CTRL, up, resizeactive, 0 -60"
"$mainMod CTRL, down, resizeactive, 0 60"
# Switch workspaces with mainMod + [0-9]
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
# Move active window to a workspace with mainMod + SHIFT + [0-9]
"$mainMod SHIFT, 1, movetoworkspacesilent, 1"
"$mainMod SHIFT, 2, movetoworkspacesilent, 2"
"$mainMod SHIFT, 3, movetoworkspacesilent, 3"
"$mainMod SHIFT, 4, movetoworkspacesilent, 4"
"$mainMod SHIFT, 5, movetoworkspacesilent, 5"
"$mainMod SHIFT, 6, movetoworkspacesilent, 6"
"$mainMod SHIFT, 7, movetoworkspacesilent, 7"
"$mainMod SHIFT, 8, movetoworkspacesilent, 8"
"$mainMod SHIFT, 9, movetoworkspacesilent, 9"
"$mainMod SHIFT, 0, movetoworkspacesilent, 10"
"$mainMod SHIFT, F, fullscreen"
2024-04-17 05:52:14 +05:00
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
# Keyboard backlight
"$mainMod, F3, exec, brightnessctl -d *::kbd_backlight set +33%"
"$mainMod, F2, exec, brightnessctl -d *::kbd_backlight set 33%-"
# Volume and Media Control
", XF86AudioRaiseVolume, exec, pamixer -i 5 "
", XF86AudioLowerVolume, exec, pamixer -d 5 "
", XF86AudioMute, exec, pamixer -t"
", XF86AudioMicMute, exec, pamixer --default-source -m"
2024-04-18 11:38:07 +05:00
# Brightness control
", XF86MonBrightnessDown, exec, brightnessctl set 5%- "
", XF86MonBrightnessUp, exec, brightnessctl set +5% "
2024-04-17 05:52:14 +05:00
# Configuration files
''$mainMod ALT, N, exec, alacritty -e sh -c "rb"''
''$mainMod ALT, C, exec, alacritty -e sh -c "conf"''
2024-05-01 15:43:11 +03:00
''$mainMod ALT, H, exec, alacritty -e sh -c "$EDITOR ~/nix/home-manager/modules/wms/hyprland.nix"''
''$mainMod ALT, W, exec, alacritty -e sh -c "$EDITOR ~/nix/home-manager/modules/wms/waybar.nix"''
2024-04-17 05:52:14 +05:00
'', Print, exec, grim -g "$(slurp)" - | swappy -f -''
# Waybar
"$mainMod, B, exec, pkill -SIGUSR1 waybar"
2024-08-26 22:10:44 +03:00
#"$mainMod, W, exec, pkill -SIGUSR2 waybar"
"$mainMod, W, exec, python3 ${lib.getExe wallpaper_changer}"
2024-04-17 05:52:14 +05:00
# Disable all effects
"$mainMod Shift, G, exec, ~/.config/hypr/gamemode.sh "
];
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
};
};
}