Files
hypr-dotfiles/config/hypr/hyprland.lua
T

147 lines
6.0 KiB
Lua

-- Hyprland loads this file when it is started without a config, and it prefers
-- it over hyprland.conf. HyDE loads it too, last, as the override layer below.
-- The block keeps the two apart: hyde.lua sets `hyde` on its first line, so it
-- runs only when this file is the entry point and HyDE has not been loaded.
-- Removing it leaves a session with a cursor and nothing else.
if not hyde then
local share = os.getenv("XDG_DATA_HOME") or (os.getenv("HOME") .. "/.local/share")
local entry = share .. "/hypr/hyde.lua"
local handle = io.open(entry, "r")
if not handle then
error("HyDE is not installed at " .. entry .. ". Run install.sh -r, or point Hyprland at your own config.")
end
handle:close()
dofile(entry)
end
-- Your Hyprland configuration. HyDE never overwrites this file.
--
-- It loads after HyDE's own binds, so settings here take precedence. Replacing
-- a bind needs more than that: see below. HyDE's defaults live in
-- ~/.local/share/hypr/lua/ and are overwritten on every update, so edits there
-- do not survive.
--
-- Adding a keybind:
--
-- hl.bind("SUPER + SPACE", hl.dsp.exec_cmd(hyde.sh.gamelauncher()), {
-- description = "[Utilities] game launcher",
-- })
--
-- Replacing one of HyDE's: bind the same combination again and yours takes
-- over, but copy its flags across as well. A bind counts as the same one only
-- when its flags match, and `description` is not a flag — miss one and both
-- binds stay live on that combination. Copy the whole options table from
-- ~/.local/share/hypr/lua/key_binds.lua and change only what you need:
--
-- hl.bind("F9", hl.dsp.exec_cmd(hyde.sh.volumecontrol("-o", "m")), {
-- locked = true,
-- description = "[Hardware Controls|Audio] un/mute output",
-- })
--
-- Press SUPER + / to see what is actually loaded, your own binds included.
-- The full reference is KEYBINDINGS.md in the HyDE repository.
--
-- Other Lua files next to this one can be pulled in with require("name").
-- Custom config
-- // █ █▄░█ █▀█ █░█ ▀█▀
-- // █ █░▀█ █▀▀ █▄█ ░█░
-- DK layout
hl.config({
input = {
kb_layout = "dk",
},
})
-- // █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀
-- // █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█
-- Switch workspace left/right
hl.bind("CONTROL + ALT + Right", hl.dsp.focus({ workspace = "r+1" }), {
description = "[Workspaces] next workspace",
})
hl.bind("CONTROL + ALT + Left", hl.dsp.focus({ workspace = "r-1" }), {
description = "[Workspaces] previous workspace",
})
-- Move focused window to workspace left/right
hl.bind("SUPER + CONTROL + ALT + Right", hl.dsp.window.move({ workspace = "r+1" }), {
description = "[Workspaces] move window to next workspace",
})
hl.bind("SUPER + CONTROL + ALT + Left", hl.dsp.window.move({ workspace = "r-1" }), {
description = "[Workspaces] move window to previous workspace",
})
-- Terminal on SUPER + Return
hl.bind("SUPER + Return", hl.dsp.exec_cmd("kitty"), {
description = "[Launcher|Apps] terminal emulator",
})
-- // █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀
-- // ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █▀▄ █▄█ █▄▄ ██▄ ▄█
-- Converted from the old userprefs.conf windowrules (hyprlang -> Lua).
-- HyDE dims windows to 0.90 active / 0.75 inactive; `override` sets absolute
-- values instead of multiplying, restoring full opacity for these apps.
-- Values are active / inactive / fullscreen.
-- Opaque: browsers, readers, video
-- firefox
hl.window_rule({
match = { class = "^(firefox)$" },
opacity = "1.0 override 1.0 override 1.0 override",
})
-- chrome specific / open sites as apps
hl.window_rule({ match = { class = "^(google-chrome)$" }, opacity = "1.0 override 1.0 override 1.0 override" })
hl.window_rule({
match = { class = "^(chrome-www.twitch.tv__smugslav-Default)$" },
opacity = "1.0 override 1.0 override 1.0 override",
})
hl.window_rule({
match = { class = "^(chrome-www.twitch.tv__scrapie-Default)$" },
opacity = "1.0 override 1.0 override 1.0 override",
})
hl.window_rule({
match = { class = "^(chrome-mail.balticfinance.com__-Default)$" },
opacity = "1.0 override 1.0 override 1.0 override",
})
hl.window_rule({
match = { class = "^(chrome-jellyfin.obahan.xyz__-Default)$" },
opacity = "1.0 override 1.0 override 1.0 override",
})
-- pdf readers
hl.window_rule({ match = { class = "^(org.pwmt.zathura)$" }, opacity = "1.0 override 1.0 override 1.0 override" })
-- mpv
hl.window_rule({ match = { class = "^(mpv)$" }, opacity = "1.0 override 1.0 override 1.0 override" })
-- Slightly translucent chat window
hl.window_rule({
match = { class = "^(chrome-chat.obahan.xyz__-Default)$" },
opacity = "0.9 override 0.9 override 1.0 override",
})
-- // Hyprimate guard
-- The hyprimate-* animation items in ~/.config/hypr/lua/animations/ enable the
-- plugin themselves, but HyDE's native animation items know nothing about it.
-- This runs a small script on every config load that switches hyprimate back
-- off when a native animation is current. It must stay a separate process:
-- calling hyprctl from inside Lua config evaluation deadlocks the compositor.
hl.exec_cmd(os.getenv("HOME") .. "/.config/hyde/scripts/hyprimate-guard.sh")
-- // █▄░█ █▀▀ █ █▄░█ █▀▄   █▄▄ █ █▄░█ █▀▄
-- // █░▀█ ██▄ █ █░▀█ █▄▀   █▄█ █ █░▀█ █▄▀
-- HyDE's Lua migration retired monitors.conf (HyDE issue #1977), so monitor
-- settings live in a per-machine file that is NOT tracked in this repo:
-- ~/.config/hypr/monitors.lua. Desktop and laptop each keep their own.
local monitors_file = os.getenv("HOME") .. "/.config/hypr/monitors.lua"
local mon = io.open(monitors_file, "r")
if mon then
mon:close()
dofile(monitors_file)
end