WIP: Changed Hyprland from Hyprland to Lua
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
let
|
||||
super = "SUPER";
|
||||
terminal = "kitty";
|
||||
fileManager = "yazi";
|
||||
theme = "-theme $HOME/.config/rofi/custom.rasi";
|
||||
menu = "rofi -show drun ${theme}";
|
||||
filebrowser = "rofi -show filebrowser ${theme}";
|
||||
power = "rofi -show p -modi p:rofi-power-menu -theme $HOME/.config/rofi/power.rasi";
|
||||
apps = "rofi -show window ${theme}";
|
||||
in
|
||||
{
|
||||
|
||||
imports = [
|
||||
./hypridle.nix
|
||||
./hyprlock.nix
|
||||
@@ -31,7 +20,7 @@ in
|
||||
systemd.user.targets.hyprland-session.Unit.Wants = [ "xdg-desktop-autostart.target" ];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
package = null;
|
||||
enable = true;
|
||||
|
||||
xwayland.enable = true;
|
||||
@@ -42,259 +31,6 @@ in
|
||||
enableXdgAutostart = false;
|
||||
};
|
||||
|
||||
plugins = with inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}; [
|
||||
#hyprbars
|
||||
# hyprexpo
|
||||
];
|
||||
|
||||
settings = {
|
||||
env = [
|
||||
"NIXOS_OZONE_WL,1"
|
||||
"MOZ_ENABLE_WAYLAND,1"
|
||||
"MOZ_WEBRENDER,1"
|
||||
"_JAVA_AWT_WM_NONREPARENTING,1"
|
||||
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
|
||||
"QT_QPA_PLATFORM,wayland"
|
||||
"SDL_VIDEODRIVER,wayland"
|
||||
"GDK_BACKEND,wayland,x11"
|
||||
"XCURSOR_SIZE,24"
|
||||
"EDITOR,nvim"
|
||||
"GSK_RENDERER,gl"
|
||||
"HYPRCURSOR_THEME,catppuccin-mocha-dark"
|
||||
"HYPRCURSOR_SIZE,24"
|
||||
"XCURSOR_THEME,catppuccin-mocha-dark"
|
||||
"XCURSOR_SIZE,24"
|
||||
];
|
||||
|
||||
debug = {
|
||||
disable_logs = false;
|
||||
enable_stdout_logs = false;
|
||||
};
|
||||
|
||||
monitor = [
|
||||
"DP-1, 1920x1080@60, 1920x0, 1"
|
||||
"HDMI-A-2, 1920x1080@60, 0x0, 1"
|
||||
];
|
||||
|
||||
input = {
|
||||
kb_layout = "de";
|
||||
kb_variant = "mac";
|
||||
kb_options = "apple:fn_lock";
|
||||
repeat_rate = 50;
|
||||
repeat_delay = 300;
|
||||
|
||||
accel_profile = "flat";
|
||||
follow_mouse = 1;
|
||||
mouse_refocus = false;
|
||||
sensitivity = 0; # -1.0 to 1.0, 0 means no modification.
|
||||
|
||||
numlock_by_default = 1;
|
||||
touchpad = {
|
||||
natural_scroll = true;
|
||||
tap-to-click = true;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
general = {
|
||||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
gaps_in = 2;
|
||||
gaps_out = 0;
|
||||
border_size = 4;
|
||||
|
||||
"col.active_border" = "$green";
|
||||
"col.inactive_border" = "$red";
|
||||
|
||||
layout = "dwindle";
|
||||
|
||||
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
|
||||
allow_tearing = false;
|
||||
};
|
||||
|
||||
decoration = {
|
||||
rounding = 1;
|
||||
|
||||
shadow = {
|
||||
enabled = false;
|
||||
range = 16;
|
||||
render_power = 4;
|
||||
color = "$green";
|
||||
color_inactive = "$red";
|
||||
};
|
||||
|
||||
blur = {
|
||||
enabled = false;
|
||||
size = 1;
|
||||
passes = 3;
|
||||
new_optimizations = 1;
|
||||
noise = 4.0e-2;
|
||||
};
|
||||
};
|
||||
|
||||
animations = {
|
||||
enabled = "yes";
|
||||
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"
|
||||
];
|
||||
};
|
||||
|
||||
# layerrule = [
|
||||
# "ignorezero,notifications"
|
||||
# "ignorezero,rofi"
|
||||
# ];
|
||||
|
||||
dwindle = {
|
||||
preserve_split = "yes";
|
||||
};
|
||||
|
||||
# gestures = {
|
||||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
# workspace_swipe = true;
|
||||
# workspace_swipe_fingers = 3;
|
||||
# workspace_swipe_distance = 300;
|
||||
# workspace_swipe_invert = false;
|
||||
# workspace_swipe_cancel_ratio = 0.5;
|
||||
# };
|
||||
|
||||
misc = {
|
||||
force_default_wallpaper = 0;
|
||||
disable_hyprland_logo = true;
|
||||
disable_splash_rendering = true;
|
||||
mouse_move_enables_dpms = true;
|
||||
key_press_enables_dpms = true;
|
||||
# vfr = true;
|
||||
vrr = 0;
|
||||
};
|
||||
|
||||
device = {
|
||||
name = "usb-optical-mouse-";
|
||||
sensitivity = 0;
|
||||
};
|
||||
#deprecated
|
||||
# windowrulev2 = [
|
||||
# "suppressevent maximize, class:.*"
|
||||
# "float, class:^(com.obsproject.Studio)$"
|
||||
# "size 1280 800, class:^(com.obsproject.Studio)$"
|
||||
# "float, class:^(xdg-desktop-portal-gtk)$"
|
||||
# "center, class:^(xdg-desktop-portal-gtk)$"
|
||||
# ];
|
||||
|
||||
# windowrule = [
|
||||
# "opacity 0.0 override, class:^(xwaylandvideobridge)$"
|
||||
# "noanim, class:^(xwaylandvideobridge)$"
|
||||
# "noinitialfocus, class:^(xwaylandvideobridge)$"
|
||||
# "maxsize 1 1, class:^(xwaylandvideobridge)$"
|
||||
# "noblur, class:^(xwaylandvideobridge)$"
|
||||
# "nofocus, class:^(xwaylandvideobridge)$"
|
||||
# "noblur, class:^(org\\.gnome\\.|io\\.github\\.|org\\.gtk\\.)"
|
||||
# ];
|
||||
|
||||
exec-once = [
|
||||
"awww-daemon --no-cache & disown"
|
||||
"awww img ~/Pictures/Wallpapers/Ghost_in_the_Shell.png"
|
||||
"waybar &"
|
||||
];
|
||||
|
||||
# Keybindings
|
||||
bind = [
|
||||
|
||||
# Application Bindings
|
||||
"${super}, Q, exec, ${terminal}"
|
||||
"${super}, E, exec, ${fileManager}"
|
||||
"${super}, O, exec, obsidian"
|
||||
"${super}, I, exec, floorp"
|
||||
"${super}, G, exec, thunderbird"
|
||||
", XF86Mail, exec, thunderbird"
|
||||
"${super}, N, exec, nautilus"
|
||||
", XF86Search, exec, nautilus"
|
||||
|
||||
# Lock Screen
|
||||
"${super}, M, exit, "
|
||||
|
||||
# Rofi bindings
|
||||
"${super}, F, exec, ${filebrowser}"
|
||||
"${super}, A, exec, ${apps}"
|
||||
", Menu, exec, ${apps}"
|
||||
"${super}, R, exec, ${menu}"
|
||||
", XF86LaunchA, exec, ${menu}"
|
||||
"${super}, S, exec, ${power}"
|
||||
", XF86LaunchB, exec, ${power}"
|
||||
|
||||
# Move focus with mainMod + arrow keys
|
||||
"${super}, left, movefocus, l"
|
||||
"${super}, right, movefocus, r"
|
||||
"${super}, up, movefocus, u"
|
||||
"${super}, down, movefocus, d"
|
||||
|
||||
# Window Modifiers
|
||||
"${super}, P, pseudo, " # dwindle
|
||||
# "${super}, J, togglesplit, " # dwindle doenst exist
|
||||
"${super}, V, togglefloating, " # dwindle
|
||||
"${super}, C, killactive, "
|
||||
|
||||
# Switch workspaces with mainMod + [0-9]
|
||||
"${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"
|
||||
|
||||
# Move active window to a workspace with mainMod + SHIFT + [0-9]
|
||||
"${super} SHIFT, 1, movetoworkspace, 1"
|
||||
"${super} SHIFT, 2, movetoworkspace, 2"
|
||||
"${super} SHIFT, 3, movetoworkspace, 3"
|
||||
"${super} SHIFT, 4, movetoworkspace, 4"
|
||||
"${super} SHIFT, 5, movetoworkspace, 5"
|
||||
"${super} SHIFT, 6, movetoworkspace, 6"
|
||||
"${super} SHIFT, 7, movetoworkspace, 7"
|
||||
"${super} SHIFT, 8, movetoworkspace, 8"
|
||||
"${super} SHIFT, 9, movetoworkspace, 9"
|
||||
"${super} SHIFT, 0, movetoworkspace, 10"
|
||||
|
||||
# Example special workspace (scratchpad)
|
||||
#"${super}, S, togglespecialworkspace, magic"
|
||||
"${super} SHIFT, S, movetoworkspace, special:magic"
|
||||
|
||||
# Scroll through existing workspaces with mainMod + scroll
|
||||
"${super}, mouse_down, workspace, e+1"
|
||||
"${super}, mouse_up, workspace, e-1"
|
||||
|
||||
# Screenshot
|
||||
''${super}, Z, exec, grim -g "$(slurp)" $HOME/Pictures/Screenshots/$(date +'%s_grim.png')''
|
||||
"${super}, U, exec, grim $HOME/Pictures/Screenshots/$(date +'%s_grim.png')"
|
||||
];
|
||||
|
||||
bindl = [
|
||||
#", XF86AudioMute, exec, amixer set Master toggle
|
||||
", XF86AudioMute, exec, pamixer -t"
|
||||
", XF86AudioPlay, exec, playerctl play-pause" # the stupid key is called play , but it toggles
|
||||
", XF86AudioNext, exec, playerctl next"
|
||||
", XF86AudioPrev, exec, playerctl previous"
|
||||
];
|
||||
|
||||
bindle = [
|
||||
# Multi Media Control
|
||||
", XF86AudioRaiseVolume, exec, pamixer -i 5"
|
||||
", XF86AudioLowerVolume, exec, pamixer -d 5"
|
||||
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
|
||||
", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
|
||||
];
|
||||
|
||||
bindm = [
|
||||
"${super}, mouse:272, movewindow"
|
||||
"${super}, mouse:273, resizewindow"
|
||||
];
|
||||
};
|
||||
extraConfig = builtins.readFile ./hyprland.lua;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
-- hyprland.lua — migrated from hyprlang for Hyprland 0.55+
|
||||
-- https://wiki.hypr.land/Configuring/Start/
|
||||
|
||||
--------------------
|
||||
---- VARIABLES -----
|
||||
--------------------
|
||||
|
||||
local super = "SUPER"
|
||||
local terminal = "kitty"
|
||||
local fileManager = "yazi"
|
||||
local theme = "-theme $HOME/.config/rofi/custom.rasi"
|
||||
local menu = "rofi -show drun " .. theme
|
||||
local filebrowser = "rofi -show filebrowser " .. theme
|
||||
local power = "rofi -show p -modi p:rofi-power-menu -theme $HOME/.config/rofi/power.rasi"
|
||||
local apps = "rofi -show window " .. theme
|
||||
|
||||
--------------------
|
||||
---- MONITORS ------
|
||||
--------------------
|
||||
|
||||
hl.monitor({ output = "DP-1", mode = "1920x1080@60", position = "1920x0", scale = 1 })
|
||||
hl.monitor({ output = "HDMI-A-2", mode = "1920x1080@60", position = "0x0", scale = 1 })
|
||||
|
||||
-----------------------------
|
||||
---- ENVIRONMENT VARIABLES --
|
||||
-----------------------------
|
||||
|
||||
hl.env("NIXOS_OZONE_WL", "1")
|
||||
hl.env("MOZ_ENABLE_WAYLAND", "1")
|
||||
hl.env("MOZ_WEBRENDER", "1")
|
||||
hl.env("_JAVA_AWT_WM_NONREPARENTING", "1")
|
||||
hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1")
|
||||
hl.env("QT_QPA_PLATFORM", "wayland")
|
||||
hl.env("SDL_VIDEODRIVER", "wayland")
|
||||
hl.env("GDK_BACKEND", "wayland,x11")
|
||||
hl.env("XCURSOR_SIZE", "24")
|
||||
hl.env("XCURSOR_THEME", "catppuccin-mocha-dark")
|
||||
hl.env("EDITOR", "nvim")
|
||||
hl.env("GSK_RENDERER", "gl")
|
||||
hl.env("HYPRCURSOR_THEME", "catppuccin-mocha-dark")
|
||||
hl.env("HYPRCURSOR_SIZE", "24")
|
||||
|
||||
--------------------
|
||||
---- AUTOSTART -----
|
||||
--------------------
|
||||
|
||||
hl.on("hyprland.start", function()
|
||||
hl.exec_cmd("awww-daemon --no-cache & disown")
|
||||
hl.exec_cmd("awww img ~/Pictures/Wallpapers/Ghost_in_the_Shell.png")
|
||||
hl.exec_cmd("waybar &")
|
||||
end)
|
||||
|
||||
--------------------
|
||||
---- CONFIG --------
|
||||
--------------------
|
||||
|
||||
hl.config({
|
||||
debug = {
|
||||
disable_logs = false,
|
||||
enable_stdout_logs = false,
|
||||
},
|
||||
|
||||
input = {
|
||||
kb_layout = "de",
|
||||
kb_variant = "mac",
|
||||
kb_options = "apple:fn_lock",
|
||||
repeat_rate = 50,
|
||||
repeat_delay = 300,
|
||||
accel_profile = "flat",
|
||||
follow_mouse = 1,
|
||||
mouse_refocus = false,
|
||||
sensitivity = 0,
|
||||
numlock_by_default = true,
|
||||
touchpad = {
|
||||
natural_scroll = true,
|
||||
tap_to_click = true, -- note: underscore, not hyphen
|
||||
},
|
||||
},
|
||||
|
||||
general = {
|
||||
gaps_in = 2,
|
||||
gaps_out = 0,
|
||||
border_size = 4,
|
||||
col = {
|
||||
active_border = "rgba(a6e3a1ff)",
|
||||
inactive_border = "rgba(f38ba8ff)",
|
||||
},
|
||||
layout = "dwindle",
|
||||
allow_tearing = false,
|
||||
},
|
||||
|
||||
decoration = {
|
||||
rounding = 1,
|
||||
shadow = {
|
||||
enabled = false,
|
||||
range = 16,
|
||||
render_power = 4,
|
||||
color = "rgba(a6e3a1ff)",
|
||||
color_inactive = "rgba(f38ba8ff)",
|
||||
},
|
||||
blur = {
|
||||
enabled = false,
|
||||
size = 1,
|
||||
passes = 3,
|
||||
new_optimizations = true,
|
||||
noise = 0.04,
|
||||
},
|
||||
},
|
||||
|
||||
animations = {
|
||||
enabled = true,
|
||||
},
|
||||
|
||||
dwindle = {
|
||||
preserve_split = true,
|
||||
},
|
||||
|
||||
misc = {
|
||||
force_default_wallpaper = 0,
|
||||
disable_hyprland_logo = true,
|
||||
disable_splash_rendering = true,
|
||||
mouse_move_enables_dpms = true,
|
||||
key_press_enables_dpms = true,
|
||||
vrr = 0,
|
||||
},
|
||||
})
|
||||
|
||||
-- Animations (bezier curves + animation tree)
|
||||
hl.curve("myBezier", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
|
||||
|
||||
hl.animation({ leaf = "windows", enabled = true, speed = 7, bezier = "myBezier" })
|
||||
hl.animation({ leaf = "windowsOut", enabled = true, speed = 7, bezier = "default", style = "popin 80%" })
|
||||
hl.animation({ leaf = "border", enabled = true, speed = 10, bezier = "default" })
|
||||
hl.animation({ leaf = "borderangle", enabled = true, speed = 8, bezier = "default" })
|
||||
hl.animation({ leaf = "fade", enabled = true, speed = 7, bezier = "default" })
|
||||
hl.animation({ leaf = "workspaces", enabled = true, speed = 6, bezier = "default" })
|
||||
|
||||
-- Per-device config
|
||||
hl.device({
|
||||
name = "usb-optical-mouse-",
|
||||
sensitivity = 0,
|
||||
})
|
||||
|
||||
--------------------
|
||||
---- KEYBINDINGS ---
|
||||
--------------------
|
||||
|
||||
-- Application bindings
|
||||
hl.bind(super .. " + Q", hl.dsp.exec_cmd(terminal))
|
||||
hl.bind(super .. " + E", hl.dsp.exec_cmd(fileManager))
|
||||
hl.bind(super .. " + O", hl.dsp.exec_cmd("obsidian"))
|
||||
hl.bind(super .. " + I", hl.dsp.exec_cmd("floorp"))
|
||||
hl.bind(super .. " + G", hl.dsp.exec_cmd("thunderbird"))
|
||||
hl.bind("XF86Mail", hl.dsp.exec_cmd("thunderbird"))
|
||||
hl.bind(super .. " + N", hl.dsp.exec_cmd("nautilus"))
|
||||
hl.bind("XF86Search", hl.dsp.exec_cmd("nautilus"))
|
||||
|
||||
-- Exit
|
||||
hl.bind(super .. " + M", hl.dsp.exit())
|
||||
|
||||
-- Rofi bindings
|
||||
hl.bind(super .. " + F", hl.dsp.exec_cmd(filebrowser))
|
||||
hl.bind(super .. " + A", hl.dsp.exec_cmd(apps))
|
||||
hl.bind("Menu", hl.dsp.exec_cmd(apps))
|
||||
hl.bind(super .. " + R", hl.dsp.exec_cmd(menu))
|
||||
hl.bind("XF86LaunchA", hl.dsp.exec_cmd(menu))
|
||||
hl.bind(super .. " + S", hl.dsp.exec_cmd(power))
|
||||
hl.bind("XF86LaunchB", hl.dsp.exec_cmd(power))
|
||||
|
||||
-- Move focus
|
||||
hl.bind(super .. " + left", hl.dsp.focus({ direction = "left" }))
|
||||
hl.bind(super .. " + right", hl.dsp.focus({ direction = "right" }))
|
||||
hl.bind(super .. " + up", hl.dsp.focus({ direction = "up" }))
|
||||
hl.bind(super .. " + down", hl.dsp.focus({ direction = "down" }))
|
||||
|
||||
-- Window modifiers
|
||||
hl.bind(super .. " + P", hl.dsp.window.pseudo())
|
||||
hl.bind(super .. " + V", hl.dsp.window.float({ action = "toggle" }))
|
||||
hl.bind(super .. " + C", hl.dsp.window.close())
|
||||
|
||||
-- Workspaces (1-10, 0 maps to 10)
|
||||
for i = 1, 10 do
|
||||
local key = tostring(i % 10)
|
||||
hl.bind(super .. " + " .. key, hl.dsp.focus({ workspace = i }))
|
||||
hl.bind(super .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
|
||||
end
|
||||
|
||||
-- Special workspace (scratchpad)
|
||||
hl.bind(super .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))
|
||||
|
||||
-- Scroll through workspaces with mouse wheel
|
||||
hl.bind(super .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind(super .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
|
||||
|
||||
-- Screenshot
|
||||
hl.bind(super .. " + Z", hl.dsp.exec_cmd("grim -g \"$(slurp)\" $HOME/Pictures/Screenshots/$(date +'%s_grim.png')"))
|
||||
hl.bind(super .. " + U", hl.dsp.exec_cmd("grim $HOME/Pictures/Screenshots/$(date +'%s_grim.png')"))
|
||||
|
||||
-- Media controls (locked = works on lockscreen, repeating = held key)
|
||||
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("pamixer -t"), { locked = true })
|
||||
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
|
||||
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
|
||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("pamixer -i 5"), { locked = true, repeating = true })
|
||||
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("pamixer -d 5"), { locked = true, repeating = true })
|
||||
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set +5%"), { locked = true, repeating = true })
|
||||
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 5%-"), { locked = true, repeating = true })
|
||||
|
||||
-- Mouse bindings for move/resize
|
||||
hl.bind(super .. " + mouse:272", hl.dsp.window.drag())
|
||||
hl.bind(super .. " + mouse:273", hl.dsp.window.drag({ resize = true }))
|
||||
Reference in New Issue
Block a user