window-manager/hyprland.lua

413 lines
No EOL
14 KiB
Lua

-------------------
---- VARIABLES ----
-------------------
local hyprdir = ".config/hypr/"
local scripts = hyprdir.."scripts/"
-- Set programs that I use
local terminal = scripts.."terminal.sh"
local fileManager = "dolphin"
local menu = scripts.."toggle_hyprshell.sh"
------------------
---- MONITORS ----
------------------
-- See https://wiki.hypr.land/Configuring/Basics/Monitors/
-- defaults
hl.monitor({
output = "",
mode = "preferred",
position = "auto",
scale = 1,
mirror = "eDP-1",
})
-- Main tablet screen
hl.monitor({
output = "eDP-1",
mode = "preferred",
position = "0x0",
scale = 1,
})
-- My monitor at home
hl.monitor({
output = "desc:Acer Technologies Acer XF240H 0x0160F332",
mode = "preferred",
position = "1925x-900",
scale = 1,
})
-------------------
---- AUTOSTART ----
-------------------
-- See https://wiki.hypr.land/Configuring/Basics/Autostart/
hl.on("hyprland.start", function ()
-- Load plugins
--hl.exec_cmd("hyprpm reload")
-- Special workspaces
hl.exec_cmd(terminal)
hl.exec_cmd("flatpak run app.zen_browser.zen")
hl.exec_cmd("flatpak run com.discordapp.Discord")
hl.exec_cmd("flatpak run im.riot.Riot")
hl.exec_cmd("flatpak run md.obsidian.Obsidian")
-- Core daemons
hl.exec_cmd("hyprshell -c "..hyprdir.."hyprshell.ron -s "..hyprdir.."hyprshell.css run")
hl.exec_cmd("vicinae server")
hl.exec_cmd("wvkbd-deskintl --hidden -o")
hl.exec_cmd("hyprpanel")
hl.exec_cmd(scripts.."keyboard.sh reset")
hl.exec_cmd(scripts.."volume-core.sh --start-daemon")
-- Waydroid (note: this also launches rootedinit.sh under-the-hood)
hl.exec_cmd(scripts.."waydroid.sh")
-- Dark theme
hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme Breeze-Dark"); -- for GTK3 apps
hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme prefer-dark"); -- for GTK4 apps
hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-color-palette \"'black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90'\""); --Unrelated to Dark Theme (just my color palette), but there was no better place for it.
end)
-------------------------------
---- ENVIRONMENT VARIABLES ----
-------------------------------
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/
-- Were the defaults; no reason to fuck around
hl.env("XCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_SIZE", "24")
-- Dark theme, again (*must set manually)
hl.env("QT_QPA_PLATFORMTHEME", "qt6ct")
-----------------------
----- PERMISSIONS -----
-----------------------
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Permissions/
hl.config({
ecosystem = {
enforce_permissions = true,
},
})
hl.permission({binary="/usr/(bin|local/bin)/grim", type="screencopy", mode="allow"})
hl.permission({binary="/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", type="screencopy", mode="allow"})
hl.permission({binary="/usr/(bin|local/bin)/hyprpm", type="plugin", mode="allow"})
hl.permission({binary="/usr/(bin|local/bin)/hyprshell", type="plugin", mode="allow"})
-----------------------
---- LOOK AND FEEL ----
-----------------------
-- Refer to https://wiki.hypr.land/Configuring/Basics/Variables/
hl.config({
general = {
gaps_in = 4,
gaps_out = {top=0, right=8, bottom=8, left=8},
border_size = 2,
col = {
active_border = { colors = {"rgb(FFE610)", "rgb(E6FF10)"}, angle = 240 },
inactive_border = { colors = {"rgba(FFE61020)", "rgba(E6FF10E0)"}, angle = 240 },
},
-- Set to true to enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = true,
-- Please see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Tearing/ before you turn this on
allow_tearing = false,
layout = "dwindle",
},
decoration = {
rounding = 15,
rounding_power = 3,
-- Change transparency of focused and unfocused windows
active_opacity = 1.0,
inactive_opacity = 1.0,
shadow = {
enabled = true,
range = 4,
render_power = 3,
color = 0xee1a1a1a,
},
blur = {
enabled = true, --During the Lua migration, I noticed the following note attached in the previous config: „NOTE: Occasionally (when terminal breaks), this needs to be disabled (until I figure out how to get blur only on the background ALWAYS, without making all terminal text glow SOMETIMES)”. However, I don't think I experienced any „terminal glowing” problems in a long time (tho transparency still breaks on it from time to time), so ig this is no longer needed? Leaving the note in, just in case it does end up happening again.
size = 3,
passes = 1,
vibrancy = 0.1696,
},
},
animations = {
enabled = true,
},
})
-- Default curves and animations, see https://wiki.hypr.land/Configuring/Advanced-and-Cool/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} }})
-- Default springs
hl.curve("easy", { type = "spring", mass = 1, stiffness = 71.2633, dampening = 15.8273644 })
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 = true, speed = 1.49, bezier = "linear", style = "popin 87%" })
hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" })
hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.46, 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" })
-- Special workspaces slide-in from the top (thx, https://github.com/hyprwm/Hyprland/discussions/1757#discussioncomment-8921961)
hl.animation({ leaf = "specialWorkspaceIn", enabled=true, speed=2, bezier="easeInOutCubic", style="slidefadevert -50%" })
hl.animation({ leaf = "specialWorkspaceOut", enabled=true, speed=2, bezier="easeInOutCubic", style="slidefadevert -50%" })
-- See https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/ for more
hl.config({
dwindle = {
preserve_split = true, -- You probably want this
},
})
-- See https://wiki.hypr.land/Configuring/Layouts/Master-Layout/ for more
hl.config({
master = {
new_status = "master",
},
})
-- See https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout/ for more
hl.config({
scrolling = {
fullscreen_on_one_column = true,
},
})
--------------
---- MISC ----
--------------
hl.config({
misc = {
force_default_wallpaper = 2, -- Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false, -- If true disables the random hyprland logo / anime girl background. :(
},
})
---------------
---- INPUT ----
---------------
hl.config({
input = {
kb_layout = "pl",
kb_variant = "",
kb_model = "",
kb_options = "fkeys:basic_13-24",
kb_rules = "",
follow_mouse = 1,
sensitivity = 0, -- -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = true,
},
},
})
---------------------
---- KEYBINDINGS ----
---------------------
local mainMod = "SUPER" -- Sets "Windows" key as main modifier
-- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd(terminal))
local closeWindowBind = hl.bind(mainMod .. " + Q", hl.dsp.window.close())
-- closeWindowBind:set_enabled(false)
hl.bind(mainMod .. " + M", hl.dsp.exit())
hl.bind(mainMod .. " + SUPER_L", hl.dsp.exec_cmd(menu), { release = true })
-- Quick-pad: Special workspaces + boss-key
hl.bind(mainMod .. " + X", hl.dsp.workspace.toggle_special("terminal"))
hl.bind(mainMod .. " + A", hl.dsp.workspace.toggle_special("browser"))
hl.bind(mainMod .. " + D", hl.dsp.workspace.toggle_special("discord"))
hl.bind(mainMod .. " + C", hl.dsp.workspace.toggle_special("element"))
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("obsidian"))
hl.bind(mainMod .. " + Z", hl.dsp.exec_cmd(scripts.."hide.sh"))
-- 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 })
-- Laptop multimedia keys for volume and LCD brightness
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = 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("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { 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 play-pause"), { locked = true })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
-- Screenshots
hl.bind("PRINT", hl.dsp.exec_cmd(scripts.."screenshot.sh"))
hl.bind(mainMod.." + PRINT", hl.dsp.exec_cmd(scripts.."screenshot.sh --full"))
--------------------------------
---- WINDOWS AND WORKSPACES ----
--------------------------------
-- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/
-- and https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/
-- Example window rules that are useful
local suppressMaximizeRule = hl.window_rule({
-- Ignore maximize requests from all apps. You'll probably like this.
name = "suppress-maximize-events",
match = { class = ".*" },
suppress_event = "maximize",
})
suppressMaximizeRule:set_enabled(false) -- ...No, I won't. I run everything as exclusive-window-per-workspace anyway, so I'm not worried about „Windows deciding to take up all my space” (I literally do that). All this will do is cause de-syncs (especially in client-side decorated apps, like all the crapware made in GTK) for exactly 0 benefit.
hl.window_rule({
-- Fix some dragging issues with XWayland
name = "fix-xwayland-drags",
match = {
class = "^$",
title = "^$",
xwayland = true,
float = true,
fullscreen = false,
pin = false,
},
no_focus = true,
})
-- Hyprland-run windowrule
hl.window_rule({
name = "move-hyprland-run",
match = { class = "hyprland-run" },
move = "20 monitor_h-120",
float = true,
})
-- My rules
hl.window_rule({
name = "onwinopen-default",
match = {
class = ".*",
float = false
},
workspace = "emptym"
})
hl.window_rule({
name = "onwinopen-override-special-terminal",
match = { class = "org.kde.konsole" },
workspace = "special:terminal"
})
hl.window_rule({
name = "onwinopen-override-special-browser",
match = { class = "app.zen_browser.zen" },
workspace = "special:browser silent"
})
hl.window_rule({
name = "onwinopen-override-special-discord",
match = { class = "discord" },
workspace = "special:discord silent"
})
hl.window_rule({
name = "onwinopen-override-special-element",
match = { class = "im.riot.Riot" },
workspace = "special:element silent"
})
hl.window_rule({
name = "onwinopen-override-special-obsidian",
match = { class = "obsidian" },
workspace = "special:obsidian silent"
})
hl.window_rule({
name = "onwinopen-override-minecraft-default",
match = { class = "Minecraft.*" },
workspace = "emptym",
maximize = true
})
hl.window_rule({
name = "onwinopen-override-minecraft-modpack-melatonin",
match = { class = "Melatonin" },
workspace = "emptym",
maximize = true
})
hl.window_rule({
name = "onwinopen-override-waydroid",
match = { class = "Waydroid" },
workspace = "special:waydroid",
fullscreen = true
})
-------------------
---- HYPRGRASS ----
-------------------
--hl.plugin.touch_gestures = {
-- sensitivity = 4.0,
-- edge_margin = 50,
-- ["hyprgrass-bind"] = ", edge:d:u, exec, $scriptsdir/keyboard.sh --no-rotate",
-- ["hyprgrass-bind"] = ", tap:3, exec, $menu -k"
--}