Files
dotfiles/roles/hyprland/files/hypr/hyprland.lua
Johannes Knopp cfd1a4526a fix alias
2026-07-16 10:31:26 +02:00

383 lines
13 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ################
-- ### MONITORS ###
-- ################
--
-- See https://wiki.hypr.land/Configuring/Basics/Monitors/
-- Default fallback for any monitor not explicitly configured below.
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = "auto" })
-- Host-specific monitor + workspace config (symlinked to monitors.lua / workspaces.lua)
require("monitors")
require("workspaces")
-- ###################
-- ### MY PROGRAMS ###
-- ###################
local terminal = "ghostty"
local fileManager = "ghostty -e yazi"
local menu = "env XDG_CURRENT_DESKTOP=Hyprland wofi --show drun"
-- #################
-- ### AUTOSTART ###
-- #################
-- Autostart necessary processes (like notifications daemons, status bars, etc.)
hl.on("hyprland.start", function()
hl.exec_cmd("/usr/lib/hyprpolkitagent/hyprpolkitagent")
-- hl.exec_cmd("hyprpanel")
hl.exec_cmd("quickshell")
hl.exec_cmd("dunst")
hl.exec_cmd("firefox")
hl.exec_cmd("hyprpaper")
-- hl.exec_cmd("gtk-launch deezer-pwa")
-- gnome keyring secret service
hl.exec_cmd(
"dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE"
)
end)
hl.config({
debug = {
disable_logs = false,
},
})
-- #############################
-- ### ENVIRONMENT VARIABLES ###
-- #############################
--
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/
hl.env("XCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_SIZE", "24")
hl.env("QT_QPA_PLATFORM", "wayland")
hl.env("QT_QPA_PLATFORMTHEME", "qt5ct")
hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1")
hl.env("QT_AUTO_SCREEN_SCALE_FACTOR", "1")
hl.env("XDG_CURRENT_DESKTOP", "Hyprland")
hl.env("XDG_SESSION_TYPE", "wayland")
hl.env("WLR_NO_HARDWARE_CURSORS", "1")
hl.env("CLUTTER_BACKEND", "wayland")
hl.env("SDL_VIDEODRIVER", "wayland,x11")
hl.env("GDK_BACKEND", "wayland,x11")
hl.env("SDL_AUDIODRIVER", "pipewire")
-- jetbrains
hl.env("_JAVA_AWT_WM_NONREPARENTING", "1")
-- ###################
-- ### PERMISSIONS ###
-- ###################
--
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Permissions/
--
-- hl.config({ ecosystem = { enforce_permissions = true } })
-- hl.permission({ binary = "/usr/(bin|local/bin)/grim", type = "screencopy", mode = "allow" })
-- hl.permission({ binary = "/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", type = "screencopy", mode = "allow" })
-- hl.permission({ binary = "/usr/(bin|local/bin)/hyprpm", type = "plugin", mode = "allow" })
-- #####################
-- ### LOOK AND FEEL ###
-- #####################
hl.config({
general = {
gaps_in = 5,
gaps_out = 10,
border_size = 3,
-- https://wiki.hypr.land/Configuring/Basics/Variables/#variable-types for info about colors
col = {
active_border = { colors = { "rgba(9b1a1aee)", "rgba(c94040ee)" }, angle = 45 },
inactive_border = "rgba(595959aa)",
},
-- Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = false,
-- Please see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Tearing/ before you turn this on
allow_tearing = false,
layout = "dwindle",
},
decoration = {
rounding = 12,
active_opacity = 1.0,
inactive_opacity = 0.96,
fullscreen_opacity = 1.0,
-- Shadows (new nested syntax)
shadow = {
enabled = true,
range = 20, -- size of the shadow
render_power = 3, -- 14, higher = faster falloff
color = "rgba(0, 0, 0, 0.35)",
offset = { 0, 6 }, -- optional: drop slightly downward
scale = 1.0,
},
-- Blur (nested)
blur = {
enabled = true,
size = 8,
passes = 3,
new_optimizations = true,
noise = 0.02,
contrast = 1.00,
brightness = 1.00,
vibrancy = 0.18,
xray = true,
},
},
cursor = {
no_hardware_cursors = true,
no_break_fs_vrr = 1,
min_refresh_rate = 60,
},
animations = {
enabled = true, -- yes, please :)
},
})
hl.curve("easeOutQuint", { type = "bezier", points = { { 0.23, 1 }, { 0.32, 1 } } })
hl.curve("easeInOutCubic", { type = "bezier", points = { { 0.65, 0.05 }, { 0.36, 1 } } })
hl.curve("linear", { type = "bezier", points = { { 0, 0 }, { 1, 1 } } })
hl.curve("almostLinear", { type = "bezier", points = { { 0.5, 0.5 }, { 0.75, 1.0 } } })
hl.curve("quick", { type = "bezier", points = { { 0.15, 0 }, { 0.1, 1 } } })
-- Spring referenced by the window animations below
hl.curve("easy", { type = "spring", mass = 1, stiffness = 71.2633, dampening = 15.8273644 })
hl.animation({ leaf = "global", enabled = true, speed = 10, bezier = "default" })
hl.animation({ leaf = "border", enabled = true, speed = 5.39, bezier = "easeOutQuint" })
hl.animation({ leaf = "windows", enabled = true, speed = 4.79, spring = "easy" })
hl.animation({ leaf = "windowsIn", enabled = true, speed = 4.1, spring = "easy", style = "popin 87%" })
hl.animation({ leaf = "windowsOut", enabled = true, speed = 1.49, bezier = "linear", style = "popin 87%" })
hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" })
hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.46, bezier = "almostLinear" })
hl.animation({ leaf = "fade", enabled = true, speed = 3.03, bezier = "quick" })
hl.animation({ leaf = "layers", enabled = true, speed = 3.81, bezier = "easeOutQuint" })
hl.animation({ leaf = "layersIn", enabled = true, speed = 4, bezier = "easeOutQuint", style = "fade" })
hl.animation({ leaf = "layersOut", enabled = true, speed = 1.5, bezier = "linear", style = "fade" })
hl.animation({ leaf = "fadeLayersIn", enabled = true, speed = 1.79, bezier = "almostLinear" })
hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = 1.39, bezier = "almostLinear" })
hl.animation({ leaf = "workspaces", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "workspacesIn", enabled = true, speed = 1.21, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "workspacesOut", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "zoomFactor", enabled = true, speed = 7, bezier = "quick" })
-- See https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/ for more
hl.config({
dwindle = {
preserve_split = true, -- You probably want this
},
})
-- See https://wiki.hypr.land/Configuring/Layouts/Master-Layout/ for more
hl.config({
master = {
new_status = "master",
},
})
-- https://wiki.hypr.land/Configuring/Basics/Variables/#misc
hl.config({
misc = {
force_default_wallpaper = 0, -- Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = true, -- If true disables the random hyprland logo / anime girl background. :(
middle_click_paste = false,
vrr = 2,
},
})
-- #############
-- ### INPUT ###
-- #############
--
-- https://wiki.hypr.land/Configuring/Basics/Variables/#input
hl.config({
input = {
kb_layout = "us,de",
kb_variant = "altgr-intl",
-- kb_model =
-- kb_options = "grp:caps_toggle",
-- kb_rules =
follow_mouse = 2,
sensitivity = 0, -- -1.0 - 1.0, 0 means no modification.
-- scroll_method = "on_button_down",
-- scroll_button = 274,
},
})
-- Example per-device config
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Devices/ for more
hl.device({
name = "benq-zowie-benq-zowie-gaming-mouse",
sensitivity = 0,
})
-- ###################
-- ### KEYBINDINGS ###
-- ###################
--
-- See https://wiki.hypr.land/Configuring/Basics/Binds/
local mainMod = "SUPER" -- Sets "Super" key as main modifier
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd(terminal))
hl.bind(mainMod .. " + Q", hl.dsp.window.close())
hl.bind(mainMod .. " + N", hl.dsp.exec_cmd(fileManager))
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(menu))
hl.bind(mainMod .. " + G", hl.dsp.layout("togglesplit")) -- dwindle
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ mode = "maximized" }))
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen" }))
hl.bind(mainMod .. " + B", hl.dsp.exec_cmd("firefox"))
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("thunderbird"))
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd("hyprlock"))
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
-- Move focus with mainMod + arrow keys
hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "l" }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "r" }))
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "u" }))
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "d" }))
-- Move window with mainMod + SHIFT + arrow keys
hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.move({ direction = "l" }))
hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move({ direction = "r" }))
hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.move({ direction = "u" }))
hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.move({ direction = "d" }))
hl.bind(mainMod .. " + SHIFT + comma", hl.dsp.window.move({ monitor = "+1" }))
hl.bind(mainMod .. " + SHIFT + period", hl.dsp.window.move({ monitor = "-1" }))
-- Resize
hl.bind(mainMod .. " + ALT + left", hl.dsp.window.resize({ x = -20, y = 0, relative = true }), { repeating = true })
hl.bind(mainMod .. " + ALT + right", hl.dsp.window.resize({ x = 20, y = 0, relative = true }), { repeating = true })
hl.bind(mainMod .. " + ALT + up", hl.dsp.window.resize({ x = 0, y = -20, relative = true }), { repeating = true })
hl.bind(mainMod .. " + ALT + down", hl.dsp.window.resize({ x = 0, y = 20, relative = true }), { repeating = true })
-- Special workspace (scratchpad)
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic"))
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))
-- Scroll through existing workspaces with mainMod + scroll
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
-- Move/resize windows with mainMod + LMB/RMB and dragging
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
-- Laptop multimedia keys for volume and LCD brightness
hl.bind(
"XF86AudioRaiseVolume",
hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"),
{ locked = true, repeating = true }
)
hl.bind(
"XF86AudioLowerVolume",
hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"),
{ locked = true, repeating = true }
)
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true })
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true })
-- Requires playerctl / Deezer controls
hl.bind("CTRL + ALT + K", hl.dsp.exec_cmd("~/.config/hypr/scripts/deezer-controls.sh play-pause"))
hl.bind("CTRL + ALT + Left", hl.dsp.exec_cmd("~/.config/hypr/scripts/deezer-controls.sh previous"))
hl.bind("CTRL + ALT + Right", hl.dsp.exec_cmd("~/.config/hypr/scripts/deezer-controls.sh next"))
hl.bind("CTRL + ALT + Up", hl.dsp.exec_cmd("~/.config/hypr/scripts/deezer-controls.sh +5%"))
hl.bind("CTRL + ALT + Down", hl.dsp.exec_cmd("~/.config/hypr/scripts/deezer-controls.sh -5%"))
hl.bind("F7", hl.dsp.pass({ window = "class:^(discord)$" }))
hl.bind("F8", hl.dsp.pass({ window = "class:^(discord)$" }))
-- Printscreen: screenshot a selected region (interactive)
hl.bind("Print", hl.dsp.exec_cmd("hyprshot -zm region"))
-- ######################
-- ### WINDOW RULES ###
-- ######################
--
-- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/ for more
-- Ignore maximize requests from apps. You'll probably like this.
hl.window_rule({
name = "suppress-maximize-events",
match = { class = ".*" },
suppress_event = "maximize",
})
hl.config({
xwayland = {
enabled = true,
use_nearest_neighbor = true,
force_zero_scaling = false,
create_abstract_socket = false,
},
})
-- Fix some dragging issues with XWayland
hl.window_rule({
name = "fix-xwayland-drags",
match = {
class = "^$",
title = "^$",
xwayland = true,
float = true,
fullscreen = false,
pin = false,
},
no_focus = true,
})
hl.window_rule({
name = "jetbrains-shortcuts",
match = { class = "^(jetbrains-.*|android-studio)$" },
no_shortcuts_inhibit = true,
})
hl.window_rule({
name = "jetbrains-tile",
match = { class = "^(jetbrains-.*|android-studio)$" },
float = false,
})
hl.window_rule({
name = "jetbrains-tab-drag",
match = {
class = "^(jetbrains-.*|android-studio)$",
title = "^(\\s*|Delete|Replace All)$",
},
no_initial_focus = true,
stay_focused = true,
float = true,
center = true,
})
hl.window_rule({
name = "jetbrains-commit-preview",
match = {
class = "^(jetbrains-.*|android-studio)$",
title = "^Commit.*$",
},
float = false,
})