Files
dotfiles/.config/hypr/hyprland.lua.20261014_before_terminal_titlebars.bak
T
2026-10-15 21:17:12 +00:00

323 lines
11 KiB
Plaintext

-- Hyprland Lua config: dark, minimal, small gaps, Quickshell bar on the left
-- https://wiki.hypr.land/Configuring/Start/
------------------
---- MONITORS ----
------------------
hl.monitor({
output = "",
mode = "preferred",
position = "auto",
scale = "auto",
})
---------------------
---- MY PROGRAMS ----
---------------------
local terminal = "foot"
local menu = "qs ipc call launcher toggle"
-------------------
---- AUTOSTART ----
-------------------
hl.on("hyprland.start", function()
hl.exec_cmd("qs") -- Quickshell: bar + launcher
hl.exec_cmd("hyprpaper") -- wallpaper, if you use it
hl.exec_cmd("wl-clip-persist --clipboard regular") -- Keep copied data available after its source app exits
hl.exec_cmd("hyprpm reload")
end)
-------------------------------
---- ENVIRONMENT VARIABLES ----
-------------------------------
hl.env("XCURSOR_SIZE", "18")
hl.env("XCURSOR_THEME", "Bibata-Modern-Classic")
hl.env("HYPRCURSOR_THEME", "Bibata-Modern-Classic")
hl.env("HYPRCURSOR_SIZE", "18")
hl.env("GTK_THEME", "KVJ")
-----------------------
---- LOOK AND FEEL ----
-----------------------
hl.config({
general = {
gaps_in = 5, -- 5 + 5 = 10px between windows
gaps_out = 10, -- 10px to screen edges and to the bar
border_size = 1,
col = {
active_border = "rgba(6b6b6bcc)";
inactive_border = "rgba(3a3a3aff)",
},
resize_on_border = true,
allow_tearing = false,
layout = "dwindle",
},
decoration = {
rounding = 1,
rounding_power = 2,
active_opacity = 1.0,
inactive_opacity = 1.0,
shadow = {
enabled = false,
},
blur = {
enabled = true,
size = 3,
passes = 1,
vibrancy = 0.1696,
},
},
animations = {
enabled = true,
},
})
-- Default curves and animations
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} } })
hl.curve("quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1} } })
hl.curve("easy", { type = "spring", mass = 1, stiffness = 238.1191, dampening = 24.21279333 })
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 = false, speed = 3, bezier = "linear", style = "popin 87%" })
hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" })
hl.animation({ leaf = "fadeOut", enabled = false, speed = 3, 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" })
hl.config({
dwindle = {
preserve_split = true,
},
})
hl.config({
master = {
new_status = "master",
},
})
hl.config({
scrolling = {
fullscreen_on_one_column = true,
},
})
----------------
---- MISC ----
----------------
hl.config({
misc = {
force_default_wallpaper = 0, -- no anime mascot
disable_hyprland_logo = true, -- plain dark background
background_color = 0xff0b0b0b,
},
})
hl.config({
plugin = {
hyprbars = {
bar_color = "#151515",
bar_height = 25,
on_double_click = "hyprctl dispatch fullscreen 1",
bar_precedence_over_border = true,
bar_part_of_window = true,
bar_text_font = "Maple Mono Normal",
bar_text_size = 10,
bar_blur = true,
},
},
})
---------------
---- INPUT ----
---------------
hl.config({
input = {
kb_layout = "us",
kb_variant = "",
kb_model = "",
kb_options = "",
kb_rules = "",
follow_mouse = 1,
sensitivity = 0,
touchpad = {
natural_scroll = false,
},
},
})
hl.gesture({
fingers = 3,
direction = "horizontal",
action = "workspace",
})
---------------------
---- KEYBINDINGS ----
---------------------
local mainMod = "SUPER"
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(terminal))
local closeWindowBind = hl.bind(mainMod .. " + W", hl.dsp.window.close())
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'"))
hl.bind(mainMod .. " + S", function()
local window = hl.get_active_window()
if not window then return end
if window.class == "foot" and not window.floating and window.fullscreen == 0 then
local width = math.floor(window.size.x * 0.75)
local height = math.floor(window.size.y * 0.75)
hl.dispatch(hl.dsp.window.float({ action = "enable", window = window }))
hl.dispatch(hl.dsp.window.resize({ x = width, y = height, relative = false, window = window }))
hl.dispatch(hl.dsp.window.center({ window = window }))
else
hl.dispatch(hl.dsp.window.float({ action = "toggle", window = window }))
end
end)
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }))
hl.bind(mainMod .. " + D", hl.dsp.exec_cmd(menu))
hl.bind(mainMod .. " + P", hl.dsp.exec_cmd("qs ipc call wallpapers toggle"))
hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit")) -- dwindle only
-- Minimize windows into a hidden special workspace, then restore them to the
-- currently active workspace with SUPER + SHIFT + X.
hl.bind(mainMod .. " + X", function()
local window = hl.get_active_window()
if not window then return end
hl.dispatch(hl.dsp.window.tag({ tag = "minimized", window = window }))
hl.dispatch(hl.dsp.window.move({ workspace = "special:minimized", follow = false, window = window }))
end)
hl.bind(mainMod .. " + SHIFT + X", function()
local workspace = hl.get_active_workspace()
if not workspace or not hl.get_workspace("special:minimized") then return end
hl.dispatch(hl.dsp.window.move({ workspace = workspace, window = "tag:minimized" }))
hl.dispatch(hl.dsp.window.clear_tags({ window = "tag:minimized" }))
end)
-- Screenshots: full output, selected region, or selected region to clipboard.
hl.bind("Print", hl.dsp.exec_cmd([[mkdir -p "$HOME/Pictures/Screenshots" && grim "$HOME/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"]]))
hl.bind("SHIFT + Print", hl.dsp.exec_cmd([[mkdir -p "$HOME/Pictures/Screenshots" && region=$(slurp) && [ -n "$region" ] && grim -g "$region" "$HOME/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"]]))
hl.bind("SUPER + SHIFT + Print", hl.dsp.exec_cmd([[region=$(slurp) && [ -n "$region" ] && grim -g "$region" - | wl-copy -t image/png]]))
-- Move focus with mainMod + arrow keys
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" }))
-- Switch workspaces with mainMod + [0-9]
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
for i = 1, 10 do
local key = i % 10 -- 10 maps to key 0
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }))
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
end
-- 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 })
-- Volume / brightness
hl.bind("XF86PowerOff", hl.dsp.exec_cmd("qs ipc call power open"), { locked = true, description = "Open the power menu" })
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("qs ipc call volume up"), { locked = true, repeating = true })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("qs ipc call volume down"), { locked = true, repeating = true })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("qs ipc call volume mute"), { locked = true })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("qs ipc call brightness up"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("qs ipc call brightness down"), { locked = true, repeating = true })
-- Requires playerctl
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl pause"), { locked = true })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play"), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
--------------------------------
---- WINDOWS AND WORKSPACES ----
--------------------------------
local suppressMaximizeRule = hl.window_rule({
name = "suppress-maximize-events",
match = { class = ".*" },
suppress_event = "maximize",
})
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 = "move-hyprland-run",
match = { class = "hyprland-run" },
move = "20 monitor_h-120",
float = true,
})
hl.window_rule({
name = "disable-hyprbars-for-firefox",
match = { class = "^(org%.mozilla%.firefox)$" },
["hyprbars:no_bar"] = true,
})