Files
dotfiles/hosts/main/hyprland.lua
Sebastian Moser 2139920fbc changes
2026-10-02 22:09:50 +02:00

249 lines
7.2 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.
--#### vars
local mod = "SUPER"
--### idk
--hl.bind(mod .. "+p", hl.dsp.exec_cmd("nc -U /run/user/1000/walker/walker.sock"))
hl.bind(mod .. "+p", hl.dsp.exec_cmd("rofi -show run"))
hl.bind(mod .. "+space", hl.dsp.window.fullscreen_state({ internal=2, client=0, action="toggle", layout_aware=false, }))
hl.bind(mod .. "+SHIFT+c", hl.dsp.window.close())
hl.bind(mod .. "+ SHIFT + Return", hl.dsp.exec_cmd("alacritty"))
hl.config({
dwindle = {
preserve_split = true,
},
misc = {
},
input = {
touchpad = {
tap_to_click = false,
disable_while_typing = true, -- Highly recommended to prevent palm jumps
}
}
})
hl.config({
general = {
layout = "dwindle",
border_size = 2,
gaps_in = 0,
gaps_out = 0,
col = {
active_border = { colors = {"rgba(33ccffee)", "rgba(00ff99ee)"}, angle = 45 },
inactive_border = "rgba(595959aa)",
},
},
decoration = {
-- Change transparency of focused and unfocused windows
active_opacity = 1.0,
inactive_opacity = 1.0,
},
})
--#### focus movement
-- refullscreens window when the old window was fullscreen
hl.on("window.active", function (new_window, reason)
if REDO_FULLSCREEN then
REDO_FULLSCREEN = false
hl.dispatch(hl.dsp.window.fullscreen_state({ action="set", internal=2, client=0 }))
end
end)
function my_move_focus(direction)
return function()
local window = hl.get_active_window()
if window == nil then return end
REDO_FULLSCREEN = window.fullscreen ~= 0
if REDO_FULLSCREEN then
hl.dispatch(hl.dsp.window.fullscreen_state({ action="unset", internal=2, client=0 }))
end
return hl.dispatch(hl.dsp.focus({ direction = direction }))
end
end
hl.bind(mod .. " + h", my_move_focus("left"))
hl.bind(mod .. " + l", my_move_focus("right"))
hl.bind(mod .. " + j", my_move_focus("down"))
hl.bind(mod .. " + k", my_move_focus("up"))
--#### brightnes controls
hl.bind("F1", hl.dsp.exec_cmd("brightnessctl set 5%-"), { repeating = true })
hl.bind("F2", hl.dsp.exec_cmd("brightnessctl set +5%"), { repeating = true })
--#### volume controls
hl.bind("F3", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"), { repeating = true })
hl.bind("F4", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ -l 1.0"), { repeating = true })
--#### playback controls
hl.bind("F5", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
hl.bind("F6", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("F7", hl.dsp.exec_cmd("playerctl next"), { locked = true })
--#### disable background
hl.config({
misc = {
force_default_wallpaper = 0,
disable_hyprland_logo = false,
disable_splash_rendering = true,
},
})
--#### workspaces
-- Workspaces (1,7,8,9,0)
--for _, i in ipairs({1, 7, 8, 9, 0}) do
for _, i in ipairs({1,2, 3, 4, 5, 6, 7, 8, 9, 0}) do
hl.bind(mod .. "+" .. tostring(i), hl.dsp.focus({ workspace = i, }))
hl.bind(mod .. "+SHIFT+" .. tostring(i), hl.dsp.window.move({ workspace = i, }))
end
hl.workspace_rule({ workspace = "0", monitor = "eDP-1"})
--hl.workspace_rule({ workspace = "1", monitor = "eDP-1"})
hl.workspace_rule({ workspace = "1", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "7", monitor = "eDP-1", default = true, layout = "scrolling"})
hl.workspace_rule({ workspace = "9", monitor = "DP-1"})
hl.workspace_rule({ workspace = "2", monitor = "DP-1", default = true})
hl.workspace_rule({ workspace = "3", monitor = "DP-1"})
hl.workspace_rule({ workspace = "4", monitor = "DP-1"})
hl.workspace_rule({ workspace = "5", monitor = "DP-1"})
hl.workspace_rule({ workspace = "6", monitor = "DP-1"})
hl.workspace_rule({ workspace = "8", monitor = "DP-1"})
hl.workspace_rule({ workspace = "2", monitor = "HDMI-A-1", default = true})
hl.workspace_rule({ workspace = "3", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "4", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "5", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "6", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "8", monitor = "HDMI-A-1"})
hl.workspace_rule({
workspace = "7",
layout = "scrolling",
layout_opts = {
direction = "down",
fullscreen_on_one_column = true,
column_width = 1,
},
})
hl.config({
scrolling = {
column_width = 1;
fullscreen_on_one_column = true,
},
binds = {
movefocus_cycles_fullscreen = false,
},
misc = {
on_focus_under_fullscreen = 1,
},
render = {
direct_scanout = false,
},
})
-- Workrooms (2–6 on d, m, a, b, c)
--[[
local workrooms = {"d", "m", "a", "b", "c"}
for _, prefix in ipairs(workrooms) do
for i = 2, 6 do
local ws = prefix .. tostring(i)
hl.bind(mod .. "+" .. tostring(i), function()
hl.dsp.workspace.change_id(ws)
end)
hl.bind(mod .. "+SHIFT+" .. tostring(i), function()
hl.dsp.window.move(ws)
end)
end
end
]]
--#### keyboard layout
hl.config({ input = {
kb_layout = "de",
}})
--#### keyboard repeat
hl.config({ input = {
repeat_delay = 130,
repeat_rate = 90,
}})
--#### disable all animations
hl.config({
animations = {
enabled = false,
},
})
--#### autostart stuff
hl.on("hyprland.start", function ()
hl.exec_cmd("dms run")
hl.exec_cmd("em ~/work/things", {workspace = "9 silent"})
end)
--#### move windows
hl.bind(mod .. " + SHIFT + H", hl.dsp.window.move({ direction = "left" }))
hl.bind(mod .. " + SHIFT + J", hl.dsp.window.move({ direction = "down" }))
hl.bind(mod .. " + SHIFT + K", hl.dsp.window.move({ direction = "up" }))
hl.bind(mod .. " + SHIFT + L", hl.dsp.window.move({ direction = "right" }))
-- resize
hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
--#### animation settings
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} } })
-- Default springs
hl.curve("easy", { type = "spring", mass = 1, stiffness = 238.1191, dampening = 24.21279333 })
--#### end stuff
require("hypr-monitors")
hl.monitor({
output = "eDP-1",
scale = 1,
})
-- ppc ne
hl.bind("F12", hl.dsp.exec_cmd("ppc ne"))
hl.bind("F11", hl.dsp.exec_cmd("ppc ne -b"))
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("ppc ne"))
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("ppc ne -b"))
-- Layout toggles
-- hl.bind(mod .. "+comma", hl.dsp.layout)
-- hl.bind(mod .. "+period", hl.dsp.layout.toggle_split)
-- scratchpad
--hl.bind(mod .. "+SHIFT+tab", hl.dsp.window.)
--hl.bind(mod .. "+tab", hl.dsp.scratchpad.show)
-- ### Scratchpad terminal (super+f)
--[[
hl.on("hyprland.start", function()
hl.exec_cmd("alacritty --class scratchterm")
end)
hl.window_rule({
match = { class = "scratchterm" },
float = true,
move = "center",
size = "2400 1400",
workspace = "special:scratch",
})
hl.bind(mod .. "+f", function()
hl.dsp.workspace.toggle_special("scratch")
end)
]]
--#### screenshot
hl.bind(mod .. "+ SHIFT + s", hl.dsp.exec_cmd("screenshot"))