kitty restores the last window's saved maximized state, which Hyprland honours, so a new terminal covered the workspace instead of tiling. Launch it with remember_window_size=no and reuse the terminal variable for the ranger and mocp binds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
340 lines
11 KiB
Lua
340 lines
11 KiB
Lua
-- Hyprland Lua config - converted from i3 config by Adam French
|
|
-- https://wiki.hypr.land/Configuring/
|
|
-- Built from colors.lua + base.lua by build.sh (edit base.lua, not hyprland.lua)
|
|
|
|
------------------
|
|
---- MONITORS ----
|
|
------------------
|
|
|
|
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = 1.5 })
|
|
-- Per-machine layout generated by nwg-displays
|
|
pcall(require, "monitors")
|
|
|
|
---------------------
|
|
---- MY PROGRAMS ----
|
|
---------------------
|
|
|
|
-- kitty restores the last window's maximized state, which Hyprland obeys, so new terminals
|
|
-- would cover the layout instead of tiling into it
|
|
local terminal = "kitty -o remember_window_size=no"
|
|
local fileManager = terminal .. " -e ranger"
|
|
local menu = "wofi --show drun"
|
|
|
|
----------------
|
|
---- CURSOR ----
|
|
----------------
|
|
|
|
hl.env("XCURSOR_THEME", "Miku Cursor")
|
|
hl.env("XCURSOR_SIZE", "48")
|
|
hl.env("HYPRCURSOR_SIZE", "48")
|
|
|
|
-------------------
|
|
---- AUTOSTART ----
|
|
-------------------
|
|
|
|
hl.on("hyprland.start", function()
|
|
hl.exec_cmd("dex -a")
|
|
hl.exec_cmd("/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1")
|
|
hl.exec_cmd("wl-paste --watch cliphist store")
|
|
hl.exec_cmd("dunst")
|
|
hl.exec_cmd("hypridle")
|
|
hl.exec_cmd("hyprpaper")
|
|
hl.exec_cmd("gammastep -m wayland -l 51.5074:-0.1278 -t 6500:3500")
|
|
hl.exec_cmd("waterfox")
|
|
hl.exec_cmd("waybar")
|
|
end)
|
|
|
|
-------------------------------
|
|
---- ENVIRONMENT VARIABLES ----
|
|
-------------------------------
|
|
|
|
hl.env("XDG_SESSION_TYPE", "wayland")
|
|
-- NVIDIA-specific env vars — uncomment if running on nvidia:
|
|
-- hl.env("LIBVA_DRIVER_NAME", "nvidia")
|
|
-- hl.env("GBM_BACKEND", "nvidia-drm")
|
|
-- hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia")
|
|
-- hl.env("WLR_NO_HARDWARE_CURSORS", "1")
|
|
|
|
-----------------------
|
|
---- LOOK AND FEEL ----
|
|
-----------------------
|
|
|
|
hl.config({
|
|
general = {
|
|
gaps_in = 5, -- inner gaps (i3: gaps inner 10 → split between two sides)
|
|
gaps_out = 0, -- outer gaps (i3: gaps outer 0)
|
|
border_size = 1,
|
|
|
|
col = {
|
|
active_border = color_primary,
|
|
inactive_border = color_gray,
|
|
},
|
|
|
|
resize_on_border = true,
|
|
allow_tearing = false,
|
|
layout = "dwindle",
|
|
},
|
|
|
|
xwayland = {
|
|
force_zero_scaling = true,
|
|
},
|
|
|
|
decoration = {
|
|
rounding = 0,
|
|
|
|
active_opacity = 1.0,
|
|
inactive_opacity = 1.0,
|
|
|
|
shadow = {
|
|
enabled = false,
|
|
},
|
|
|
|
blur = {
|
|
enabled = true,
|
|
size = 3,
|
|
passes = 1,
|
|
},
|
|
},
|
|
|
|
animations = {
|
|
enabled = true,
|
|
},
|
|
|
|
dwindle = {
|
|
preserve_split = true, -- required for togglesplit
|
|
},
|
|
|
|
master = {
|
|
new_status = "slave",
|
|
},
|
|
|
|
misc = {
|
|
force_default_wallpaper = 0,
|
|
disable_hyprland_logo = true,
|
|
focus_on_activate = true, -- replaces i3's "for_window [urgent=latest] focus"
|
|
},
|
|
|
|
input = {
|
|
kb_layout = "",
|
|
kb_options = "caps:swapescape,grp:alt_shift_toggle",
|
|
follow_mouse = 1,
|
|
sensitivity = 0,
|
|
},
|
|
})
|
|
|
|
hl.curve("myBezier", { type = "bezier", points = { { 0.645, 0.045 }, { 0.355, 1.000 } } })
|
|
|
|
hl.animation({ leaf = "windows", enabled = true, speed = 7, bezier = "myBezier" })
|
|
hl.animation({ leaf = "windowsOut", enabled = true, speed = 7, bezier = "myBezier" })
|
|
hl.animation({ leaf = "border", enabled = true, speed = 10, bezier = "myBezier" })
|
|
hl.animation({ leaf = "borderangle", enabled = true, speed = 8, bezier = "myBezier" })
|
|
hl.animation({ leaf = "fade", enabled = true, speed = 7, bezier = "myBezier" })
|
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 6, bezier = "myBezier" })
|
|
|
|
---------------------
|
|
---- KEYBINDINGS ----
|
|
---------------------
|
|
|
|
local mod = "SUPER"
|
|
|
|
-- Terminal
|
|
hl.bind(mod .. " + Return", hl.dsp.exec_cmd(terminal))
|
|
|
|
-- Kill focused window
|
|
hl.bind(mod .. " + SHIFT + Q", hl.dsp.window.close())
|
|
|
|
-- Launcher (wofi replaces dmenu)
|
|
hl.bind(mod .. " + D", hl.dsp.exec_cmd(menu))
|
|
|
|
-- Pavucontrol
|
|
hl.bind(mod .. " + CTRL + M", hl.dsp.exec_cmd("hyprpwcenter"))
|
|
|
|
-- Applications
|
|
hl.bind(mod .. " + F2", hl.dsp.exec_cmd("waterfox"))
|
|
hl.bind(mod .. " + F3", hl.dsp.exec_cmd(fileManager))
|
|
hl.bind(mod .. " + SHIFT + F3", hl.dsp.exec_cmd("pcmanfm"))
|
|
hl.bind(mod .. " + F5", hl.dsp.exec_cmd(terminal .. " -e mocp"))
|
|
|
|
-- Toggle window layout between master and dwindle
|
|
local layoutIsMaster = false
|
|
hl.bind(mod .. " + T", function()
|
|
layoutIsMaster = not layoutIsMaster
|
|
hl.config({ general = { layout = layoutIsMaster and "master" or "dwindle" } })
|
|
end)
|
|
|
|
-- Restart dunst
|
|
hl.bind(mod .. " + SHIFT + D", hl.dsp.exec_cmd("killall dunst && notify-send 'restart dunst'"))
|
|
|
|
-- Screenshots (flameshot on Wayland needs -g flag or use grim/slurp instead)
|
|
hl.bind("Print", hl.dsp.exec_cmd("flameshot gui"))
|
|
hl.bind(mod .. " + Print", hl.dsp.exec_cmd('grim -g "$(slurp)" - | wl-copy'))
|
|
hl.bind(mod .. " + SHIFT + Print", hl.dsp.exec_cmd('grim -g "$(slurp)" ~/screenshot.png'))
|
|
|
|
-- Xkill equivalent
|
|
hl.bind(mod .. " + CTRL + X", hl.dsp.exec_cmd("hyprctl kill"))
|
|
|
|
-- Toggle nerd-dictation
|
|
hl.bind(
|
|
mod .. " + C",
|
|
hl.dsp.exec_cmd(
|
|
'pgrep -f "nerd-dictation begin" >/dev/null && nerd-dictation end || nerd-dictation begin --simulate-input-tool=YDOTOOL'
|
|
)
|
|
)
|
|
|
|
-- Lock screen
|
|
hl.bind(mod .. " + 9", hl.dsp.exec_cmd("hyprlock")) -- replaces blurlock; configure hyprlock separately
|
|
|
|
-- Toggle bar visibility (waybar)
|
|
hl.bind(mod .. " + M", hl.dsp.exec_cmd("pkill -SIGUSR1 waybar"))
|
|
|
|
-- Reload Hyprland config
|
|
hl.bind(mod .. " + SHIFT + C", hl.dsp.exec_cmd("hyprctl reload"))
|
|
|
|
-- Exit Hyprland
|
|
hl.bind(mod .. " + SHIFT + E", hl.dsp.exec_cmd("hyprshutdown"))
|
|
|
|
-- System mode (replaces i3's $mode_system)
|
|
hl.bind(mod .. " + 0", function()
|
|
hl.dispatch(
|
|
hl.dsp.exec_cmd(
|
|
'notify-send -t 5000 "System Mode" "(l)ock (s)uspend (h)ibernate\\n(r)eboot (Shift+s) shutdown (e)xit\\n\\nReturn/Escape to cancel"'
|
|
)
|
|
)
|
|
hl.dispatch(hl.dsp.submap("system"))
|
|
end)
|
|
-- second arg "reset" returns to the global submap after any bind fires
|
|
hl.define_submap("system", "reset", function()
|
|
hl.bind("L", hl.dsp.exec_cmd("hyprlock"))
|
|
hl.bind("S", hl.dsp.exec_cmd("systemctl suspend"))
|
|
hl.bind("H", hl.dsp.exec_cmd("systemctl hibernate"))
|
|
hl.bind("R", hl.dsp.exec_cmd("systemctl reboot"))
|
|
hl.bind("SHIFT + S", hl.dsp.exec_cmd("systemctl poweroff"))
|
|
hl.bind("E", hl.dsp.exec_cmd("hyprshutdown"))
|
|
hl.bind("Return", hl.dsp.exec_cmd("dunstctl close"))
|
|
hl.bind("Escape", hl.dsp.exec_cmd("dunstctl close"))
|
|
end)
|
|
|
|
-- --- FOCUS ---
|
|
local dirs = { H = "left", J = "down", K = "up", L = "right", left = "left", down = "down", up = "up", right = "right" }
|
|
for key, dir in pairs(dirs) do
|
|
hl.bind(mod .. " + " .. key, hl.dsp.focus({ direction = dir }))
|
|
hl.bind(mod .. " + SHIFT + " .. key, hl.dsp.window.move({ direction = dir }))
|
|
end
|
|
|
|
-- --- FLOATING ---
|
|
hl.bind(mod .. " + SHIFT + space", hl.dsp.window.float())
|
|
hl.bind(mod .. " + space", hl.dsp.focus({ urgent_or_last = true })) -- approximate focus mode_toggle
|
|
|
|
-- --- FULLSCREEN ---
|
|
hl.bind(mod .. " + F", hl.dsp.window.fullscreen())
|
|
|
|
-- --- SPLIT / LAYOUT ---
|
|
-- orientation* messages only apply to the master layout
|
|
hl.bind(mod .. " + G", hl.dsp.layout("orientationleft")) -- tile horizontally
|
|
hl.bind(mod .. " + V", hl.dsp.layout("orientationbottom")) -- tile vertically
|
|
hl.bind(mod .. " + E", hl.dsp.layout("togglesplit"))
|
|
|
|
hl.bind(mod .. " + W", hl.dsp.group.toggle())
|
|
|
|
-- --- STICKY (pin floating window) ---
|
|
hl.bind(mod .. " + SHIFT + S", hl.dsp.window.pin())
|
|
|
|
-- --- SCRATCHPAD ---
|
|
hl.bind(mod .. " + SHIFT + minus", hl.dsp.window.move({ workspace = "special:scratchpad", follow = false }))
|
|
hl.bind(mod .. " + minus", hl.dsp.workspace.toggle_special("scratchpad"))
|
|
|
|
-- --- WORKSPACE NAVIGATION ---
|
|
hl.bind(mod .. " + CTRL + right", hl.dsp.focus({ workspace = "r+1" }))
|
|
hl.bind(mod .. " + CTRL + left", hl.dsp.focus({ workspace = "r-1" }))
|
|
hl.bind(mod .. " + B", hl.dsp.focus({ workspace = "previous" })) -- back_and_forth
|
|
|
|
for i = 1, 8 do
|
|
-- Switch to workspace
|
|
hl.bind(mod .. " + " .. i, hl.dsp.focus({ workspace = i }))
|
|
-- Move container to workspace (silent = don't follow). A pinned window is unpinned first: Hyprland 0.56
|
|
-- leaves a pinned window's layout on the hidden workspace once it's focused here, and floating or tiling
|
|
-- it after that workspace is gone crashes Hyprland
|
|
hl.bind(mod .. " + CTRL + " .. i, function()
|
|
local w = hl.get_active_window()
|
|
if w and w.pinned then
|
|
hl.dispatch(hl.dsp.window.pin({ action = "disable" }))
|
|
end
|
|
hl.dispatch(hl.dsp.window.move({ workspace = i, follow = false }))
|
|
end)
|
|
-- Move to workspace AND follow (replaces $mod+Shift+N in i3)
|
|
hl.bind(mod .. " + SHIFT + " .. i, hl.dsp.window.move({ workspace = i, follow = true }))
|
|
end
|
|
|
|
-- --- RESIZE SUBMAP ---
|
|
hl.bind(mod .. " + R", hl.dsp.submap("resize"))
|
|
hl.define_submap("resize", function()
|
|
local rep = { repeating = true }
|
|
hl.bind("H", hl.dsp.window.resize({ x = -20, y = 0, relative = true }), rep)
|
|
hl.bind("J", hl.dsp.window.resize({ x = 0, y = 20, relative = true }), rep)
|
|
hl.bind("K", hl.dsp.window.resize({ x = 0, y = -20, relative = true }), rep)
|
|
hl.bind("L", hl.dsp.window.resize({ x = 20, y = 0, relative = true }), rep)
|
|
hl.bind("left", hl.dsp.window.resize({ x = -30, y = 0, relative = true }), rep)
|
|
hl.bind("down", hl.dsp.window.resize({ x = 0, y = 30, relative = true }), rep)
|
|
hl.bind("up", hl.dsp.window.resize({ x = 0, y = -30, relative = true }), rep)
|
|
hl.bind("right", hl.dsp.window.resize({ x = 30, y = 0, relative = true }), rep)
|
|
hl.bind("Return", hl.dsp.submap("reset"))
|
|
hl.bind("Escape", hl.dsp.submap("reset"))
|
|
end)
|
|
|
|
-- --- MOUSE BINDS ---
|
|
hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) -- mod+LMB drag to move floating
|
|
hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -- mod+RMB drag to resize
|
|
|
|
-- --- AUDIO ---
|
|
hl.bind(
|
|
"XF86AudioRaiseVolume",
|
|
hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ +10%"),
|
|
{ locked = true, repeating = true }
|
|
)
|
|
hl.bind(
|
|
"XF86AudioLowerVolume",
|
|
hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ -10%"),
|
|
{ locked = true, repeating = true }
|
|
)
|
|
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("pactl set-sink-mute @DEFAULT_SINK@ toggle"), { locked = true })
|
|
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("pactl set-source-mute @DEFAULT_SOURCE@ toggle"), { locked = true })
|
|
|
|
-- --- BRIGHTNESS ---
|
|
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 })
|
|
|
|
----------------------
|
|
---- WINDOW RULES ----
|
|
----------------------
|
|
|
|
hl.window_rule({
|
|
name = "Surfshark",
|
|
match = { class = "^(Surfshark)$" },
|
|
workspace = "8 silent",
|
|
tile = true,
|
|
})
|
|
|
|
hl.window_rule({
|
|
name = "hyprpwcenter",
|
|
match = { class = "^(hyprpwcenter)$" },
|
|
float = true,
|
|
})
|
|
|
|
hl.window_rule({
|
|
name = "Lxappearance",
|
|
match = { class = "^(Lxappearance)$" },
|
|
float = true,
|
|
})
|
|
|
|
-- Picture-in-Picture windows float and follow the cursor (SUPER+Z / SUPER+SHIFT+Z), see cursor_follow.lua
|
|
require("cursor_follow")
|
|
|
|
-------------------------------
|
|
---- WORKSPACE NAMES / ICONS --
|
|
-------------------------------
|
|
|
|
-- Hyprland workspace names (replaces i3 set $ws variables)
|
|
-- These are used by waybar's workspaces module — configure names there.
|
|
-- ws1=ツ ws2=ಠ‿ಠ ws3=◕‿◕ ws4=ʘ‿ʘ
|
|
-- ws5=˘◡˘ ws6=◠‿◠ ws7=ᵔᴥᵔ ws8=æ
|