Files
dotfiles/hypr/hyprland.lua
T
2026-08-31 18:42:20 +02:00

523 lines
10 KiB
Lua
Raw 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.
-- ~/.config/hypr/hyprland.lua
-- Hyprland >= 0.55
-- Einfache, konservative Lua-Konfiguration
local mainMod = "ALT"
local terminal = "kitty"
local fileManager = "thunar"
local menu = "wofi --show drun"
local browser = "firefox"
-- ============================================================
-- HAUPTKONFIGURATION
-- ============================================================
hl.env("XCURSOR_THEME", "Bibata-Modern-Ice")
hl.env("XCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_THEME", "Bibata-Modern-Ice")
hl.env("HYPRCURSOR_SIZE", "24")
hl.on("hyprland.start", function()
hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24")
end)
hl.config({
monitor = {
",preferred,auto,1",
},
env = {
"XDG_CURRENT_DESKTOP,Hyprland",
"XDG_SESSION_TYPE,wayland",
"XDG_SESSION_DESKTOP,Hyprland",
"QT_QPA_PLATFORM,wayland;xcb",
"GDK_BACKEND,wayland,x11",
"MOZ_ENABLE_WAYLAND,1",
"XCURSOR_THEME,Bibata-Modern-Ice",
"XCURSOR_SIZE,24",
"HYPRCURSOR_THEME,Bibata-Modern-Ice",
"HYPRCURSOR_SIZE,24",
},
input = {
kb_layout = "de",
follow_mouse = 1,
sensitivity = 0,
touchpad = {
natural_scroll = true,
disable_while_typing = true,
tap_to_click = true,
},
},
general = {
gaps_in = 5,
gaps_out = 12,
border_size = 2,
["col.active_border"] = "rgba(89b4faee)",
["col.inactive_border"] = "rgba(31324455)",
resize_on_border = true,
layout = "dwindle",
allow_tearing = false,
},
decoration = {
rounding = 8,
blur = {
enabled = true,
size = 6,
passes = 2,
},
},
animations = {
enabled = true,
},
dwindle = {
preserve_split = true,
},
master = {
new_status = "master",
},
misc = {
force_default_wallpaper = 0,
disable_hyprland_logo = true,
disable_splash_rendering = true,
},
})
-- ============================================================
-- LAYOUT WECHSELN (dwm-artig)
-- ============================================================
local layoutCycle = { "dwindle", "master" }
hl.bind(mainMod .. " + SPACE", function()
local current = hl.get_config("general.layout")
local nextLayout = layoutCycle[1]
for i, name in ipairs(layoutCycle) do
if name == current then
nextLayout = layoutCycle[(i % #layoutCycle) + 1]
break
end
end
hl.config({ general = { layout = nextLayout } })
hl.notification.create({
text = "Layout: " .. nextLayout,
timeout = 800,
icon = "ok",
})
end)
-- Master-Layout: Orientierung durchschalten (links/rechts/oben/unten/zentriert)
-- entspricht in etwa dwm's tile/bstack-Varianten nur wirksam wenn master aktiv
hl.bind(mainMod .. " + SHIFT + SPACE", hl.dsp.layout("orientationcycle"))
hl.env("GTK_THEME", "Adwaita:dark")
hl.config({
exec_once = {
"/usr/lib/xdg-desktop-portal-gtk"
}
})
-- ============================================================
-- AUTOSTART
-- ============================================================
hl.on("hyprland.start", function()
hl.exec_cmd(
"dbus-update-activation-environment " ..
"WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
)
hl.exec_cmd("killall -e xdg-desktop-portal-hyprland xdg-desktop-portal")
-- kurz warten, dann XDPH zuerst starten (Backend muss vor dem Router da sein)
hl.exec_cmd("sh -c 'sleep 1 && /usr/libexec/xdg-desktop-portal-hyprland'")
hl.exec_cmd("sh -c 'sleep 2 && /usr/libexec/xdg-desktop-portal'")
hl.exec_cmd("qs -c noctalia-shell")
hl.exec_cmd("gentoo-pipewire-launcher")
hl.exec_cmd("mpd ~/.config/mpd/mpd.conf &")
end)
-- ============================================================
-- NOCTALIA LAYER RULE
-- ============================================================
hl.layer_rule({
name = "noctalia",
match = {
namespace = "^noctalia-.*$",
},
no_anim = true,
})
-- ============================================================
-- TOUCHPAD-GESTEN
-- ============================================================
hl.gesture({
fingers = 3,
direction = "horizontal",
action = "workspace",
})
-- ============================================================
-- PROGRAMME
-- ============================================================
hl.bind(
mainMod .. " + Return",
hl.dsp.exec_cmd(terminal)
)
hl.bind(
mainMod .. " + E",
hl.dsp.exec_cmd(fileManager)
)
hl.bind(
mainMod .. " + R",
hl.dsp.exec_cmd(menu)
)
hl.bind(
mainMod .. " + B",
hl.dsp.exec_cmd(browser)
)
-- ============================================================
-- FENSTER
-- ============================================================
-- Aktives Fenster schließen
hl.bind(
mainMod .. " + Q",
hl.dsp.window.close()
)
-- Hyprland beenden
hl.bind(
mainMod .. " + SHIFT + Q",
hl.dsp.exit()
)
-- Floating umschalten
hl.bind(
mainMod .. " + V",
hl.dsp.window.float({
action = "toggle",
})
)
-- Pseudotile umschalten
hl.bind(
mainMod .. " + P",
hl.dsp.window.pseudo({
action = "toggle",
})
)
-- Split-Richtung umschalten
hl.bind(
mainMod .. " + J",
hl.dsp.layout("togglesplit")
)
-- Fullscreen umschalten
hl.bind(
mainMod .. " + F",
hl.dsp.window.fullscreen({
mode = "fullscreen",
action = "toggle",
})
)
-- Mod + Linksklick-Drag: Fenster verschieben
hl.bind(
mainMod .. " + mouse:272",
hl.dsp.window.drag(),
{ mouse = true }
)
-- Mod + Rechtsklick-Drag: Fenster resizen
hl.bind(
mainMod .. " + mouse:273",
hl.dsp.window.resize(),
{ mouse = true }
)
-- ============================================================
-- FOKUS WECHSELN
-- ============================================================
hl.bind(
mainMod .. " + left",
hl.dsp.focus({
direction = "left",
})
)
hl.bind(
mainMod .. " + right",
hl.dsp.focus({
direction = "right",
})
)
hl.bind(
mainMod .. " + up",
hl.dsp.focus({
direction = "up",
})
)
hl.bind(
mainMod .. " + down",
hl.dsp.focus({
direction = "down",
})
)
-- ============================================================
-- FENSTER VERSCHIEBEN
-- ============================================================
hl.bind(
mainMod .. " + SHIFT + left",
hl.dsp.window.move({
direction = "left",
})
)
hl.bind(
mainMod .. " + SHIFT + right",
hl.dsp.window.move({
direction = "right",
})
)
hl.bind(
mainMod .. " + SHIFT + up",
hl.dsp.window.move({
direction = "up",
})
)
hl.bind(
mainMod .. " + SHIFT + down",
hl.dsp.window.move({
direction = "down",
})
)
-- ============================================================
-- WORKSPACES 1 BIS 9
-- ============================================================
for i = 1, 9 do
-- Workspace öffnen
hl.bind(
mainMod .. " + " .. tostring(i),
hl.dsp.focus({
workspace = tostring(i),
})
)
-- Fenster zu Workspace verschieben
hl.bind(
mainMod .. " + SHIFT + " .. tostring(i),
hl.dsp.window.move({
workspace = tostring(i),
follow = false,
})
)
end
-- ============================================================
-- WORKSPACE 10
-- ============================================================
hl.bind(
mainMod .. " + 0",
hl.dsp.focus({
workspace = "10",
})
)
hl.bind(
mainMod .. " + SHIFT + 0",
hl.dsp.window.move({
workspace = "10",
follow = false,
})
)
-- ============================================================
-- WORKSPACE MIT MAUSRAD
-- ============================================================
hl.bind(
mainMod .. " + mouse_down",
hl.dsp.focus({
workspace = "e+1",
})
)
hl.bind(
mainMod .. " + mouse_up",
hl.dsp.focus({
workspace = "e-1",
})
)
-- ============================================================
-- SCREENSHOTS
-- ============================================================
-- Bereich auswählen
hl.bind(
"Print",
hl.dsp.exec_cmd(
'grim -g "$(slurp)" - | wl-copy'
)
)
-- Gesamter Bildschirm
hl.bind(
"SHIFT + Print",
hl.dsp.exec_cmd(
"grim - | wl-copy"
)
)
-- ============================================================
-- AUDIO
-- ============================================================
hl.bind(
"XF86AudioRaiseVolume",
hl.dsp.exec_cmd(
"wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+"
),
{
repeating = true,
locked = true,
}
)
hl.bind(
"XF86AudioLowerVolume",
hl.dsp.exec_cmd(
"wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
),
{
repeating = true,
locked = true,
}
)
hl.bind(
"XF86AudioMute",
hl.dsp.exec_cmd(
"wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
),
{
locked = true,
}
)
-- ============================================================
-- MEDIEN
-- ============================================================
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,
}
)
-- ============================================================
-- HELLIGKEIT
-- ============================================================
hl.bind(
"XF86MonBrightnessUp",
hl.dsp.exec_cmd("brightnessctl set +5%"),
{
repeating = true,
locked = true,
}
)
hl.bind(
"XF86MonBrightnessDown",
hl.dsp.exec_cmd("brightnessctl set 5%-"),
{
repeating = true,
locked = true,
}
)
-- ============================================================
-- BILDSCHIRM SPERREN
-- ============================================================
hl.bind(
mainMod .. " + L",
hl.dsp.exec_cmd(
"qs -c noctalia-shell ipc call lockScreen lock"
)
)