From 19ec68c058b103410d8f86855554d84a0f1ad9ef Mon Sep 17 00:00:00 2001 From: smayzy Date: Sat, 15 Aug 2026 05:03:10 +0200 Subject: [PATCH] add lua config for hyprland --- dotfiles/hypr-desk/hyprland.lua | 18 ++++ dotfiles/hypr-desk/source/autostart.lua | 18 ++++ dotfiles/hypr-desk/source/binds.lua | 103 +++++++++++++++++++++++ dotfiles/hypr-desk/source/ev.lua | 7 ++ dotfiles/hypr-desk/source/input.lua | 23 +++++ dotfiles/hypr-desk/source/look.lua | 61 ++++++++++++++ dotfiles/hypr-desk/source/monitors.lua | 15 ++++ dotfiles/hypr-desk/source/winandwork.lua | 19 +++++ 8 files changed, 264 insertions(+) create mode 100644 dotfiles/hypr-desk/hyprland.lua create mode 100644 dotfiles/hypr-desk/source/autostart.lua create mode 100644 dotfiles/hypr-desk/source/binds.lua create mode 100644 dotfiles/hypr-desk/source/ev.lua create mode 100644 dotfiles/hypr-desk/source/input.lua create mode 100644 dotfiles/hypr-desk/source/look.lua create mode 100644 dotfiles/hypr-desk/source/monitors.lua create mode 100644 dotfiles/hypr-desk/source/winandwork.lua diff --git a/dotfiles/hypr-desk/hyprland.lua b/dotfiles/hypr-desk/hyprland.lua new file mode 100644 index 0000000..a302f45 --- /dev/null +++ b/dotfiles/hypr-desk/hyprland.lua @@ -0,0 +1,18 @@ +--------------- +--- SOURCES --- +--------------- + +-- MONITORS +require("source/monitors") +-- BINDS +require("source/binds") +-- AUTOSTART +require("source/autostart") +-- ENVIRONMENT VARIABLES +require("source/ev") +-- LOOK AND FEEL +require("source/look") +-- INPUT +require("source/input") +-- WINDOWS AND WORKSPACES +require("source/winandwork") diff --git a/dotfiles/hypr-desk/source/autostart.lua b/dotfiles/hypr-desk/source/autostart.lua new file mode 100644 index 0000000..ba2d8bd --- /dev/null +++ b/dotfiles/hypr-desk/source/autostart.lua @@ -0,0 +1,18 @@ +-- Autostarts here + +-- exec_once +hl.on("hyprland.start", function () + hl.exec_cmd("waybar") + hl.exec_cmd("hyprpaper") + hl.exec_cmd("wl-paste --type text --watch cliphist store") + hl.exec_cmd("wl-paste --type image --watch cliphist store") + hl.exec_cmd("systemctl --user start hyprpolkitagent") + hl.exec_cmd("mako") + hl.exec_cmd("thunderbird", {workspace = "10 silent"}) +end) + +-- exec at each reload + hl.on("config.reloaded", function () + hl.exec_cmd("killall waybar && waybar") + hl.exec_cmd("killall hyprpaper && hyprpaper") +end) diff --git a/dotfiles/hypr-desk/source/binds.lua b/dotfiles/hypr-desk/source/binds.lua new file mode 100644 index 0000000..ef2717f --- /dev/null +++ b/dotfiles/hypr-desk/source/binds.lua @@ -0,0 +1,103 @@ +------------------------------------ +--- USE WEV TO GET THE KEYS CODE --- +------------------------------------ + +-------------------- +--- KEYBINDINGSS --- +-------------------- + +-- MainMod +mainMod = "SUPER" + +-- exec +hl.bind(mainMod .. " + comma", hl.dsp.exit()) +hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen()) +hl.bind(mainMod .. " + T", hl.dsp.window.float()) +hl.bind(mainMod .. " + C", hl.dsp.window.close()) +hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd("kitty")) +hl.bind(mainMod .. " + A", hl.dsp.exec_cmd("alacritty")) +hl.bind(mainMod .. " + E", hl.dsp.exec_cmd("dolphin")) +hl.bind(mainMod .. " + R", hl.dsp.exec_cmd("wofi --show drun")) +hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("wlogout")) + +-- Quick +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("obsidian")) +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("virt-manager")) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("virt-manager")) + +-- Reload waybar +hl.bind(mainMod .. " + SHIFT + B", hl.dsp.exec_cmd("killall waybar && waybar &")) + +-- Hide waybar +hl.bind(mainMod .. " + X", hl.dsp.exec_cmd("pkill waybar || waybar")) + +-- Clipboard history +hl.bind(mainMod .. " + V", hl.dsp.exec_cmd("cliphist list | wofi -dmenu | cliphist decode | wl-copy")) + +-- Screenshot to clipboard +hl.bind(mainMod .. " + SHIFT + S", hl.dsp.exec_cmd("grim -g \"$(slurp -d)\" - | wl-copy")) + +-- Move focus with mainMod + arrow keys +hl.bind(mainMod .. " + h", hl.dsp.focus({direction = "left"})) +hl.bind(mainMod .. " + l", hl.dsp.focus({direction = "right"})) +hl.bind(mainMod .. " + k", hl.dsp.focus({direction = "up"})) +hl.bind(mainMod .. " + j", hl.dsp.focus({direction = "down"})) + +-- 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 }) + +-- Resize Windows +hl.bind(mainMod .. " + CTRL + h", hl.dsp.window.resize({ x = -20 , y = 0 })) +hl.bind(mainMod .. " + CTRL + l", hl.dsp.window.resize({ x = 20 , y = 0 })) +hl.bind(mainMod .. " + CTRL + k", hl.dsp.window.resize({ x = 0 , y = -20})) +hl.bind(mainMod .. " + CTRL + j", hl.dsp.window.resize({ x = 0 , y = 20 })) + +-- Set default workspace +hl.workspace_rule({workspace = "1", monitor = "DP-1", default = true}) +hl.workspace_rule({workspace = "2", monitor = "DP-1"}) +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 = "7", monitor = "DP-1"}) +hl.workspace_rule({workspace = "8", monitor = "DP-1"}) +hl.workspace_rule({workspace = "9", monitor = "DP-1"}) +hl.workspace_rule({workspace = "10", monitor = "DP-1"}) + +hl.workspace_rule({workspace = "11", monitor = "DP-2", default = true}) +hl.workspace_rule({workspace = "12", monitor = "DP-2"}) +hl.workspace_rule({workspace = "13", monitor = "DP-2"}) +hl.workspace_rule({workspace = "14", monitor = "DP-2"}) + +-- Switch workspaces +hl.bind(mainMod .. " + ampersand", hl.dsp.focus({ workspace = "1"})) +hl.bind(mainMod .. " + eacute", hl.dsp.focus({ workspace = "2"})) +hl.bind(mainMod .. " + quotedbl", hl.dsp.focus({ workspace = "3"})) +hl.bind(mainMod .. " + apostrophe", hl.dsp.focus({ workspace = "4"})) +hl.bind(mainMod .. " + parenleft", hl.dsp.focus({ workspace = "5"})) +hl.bind(mainMod .. " + minus", hl.dsp.focus({ workspace = "6"})) +hl.bind(mainMod .. " + egrave", hl.dsp.focus({ workspace = "7"})) +hl.bind(mainMod .. " + underscore", hl.dsp.focus({ workspace = "8"})) +hl.bind(mainMod .. " + ccedilla", hl.dsp.focus({ workspace = "9"})) +hl.bind(mainMod .. " + agrave", hl.dsp.focus({ workspace = "10"})) +hl.bind(mainMod .. " + dead_circumflex", hl.dsp.focus({ workspace = "11"})) +hl.bind(mainMod .. " + dollar", hl.dsp.focus({ workspace = "12"})) +hl.bind(mainMod .. " + ugrave", hl.dsp.focus({ workspace = "13"})) +hl.bind(mainMod .. " + asterisk", hl.dsp.focus({ workspace = "14"})) + +-- Move active window to a workspace +hl.bind(mainMod .. " + SHIFT + ampersand", hl.dsp.window.move({ workspace = "1"})) +hl.bind(mainMod .. " + SHIFT + eacute", hl.dsp.window.move({ workspace = "2"})) +hl.bind(mainMod .. " + SHIFT + quotedbl", hl.dsp.window.move({ workspace = "3"})) +hl.bind(mainMod .. " + SHIFT + apostrophe", hl.dsp.window.move({ workspace = "4"})) +hl.bind(mainMod .. " + SHIFT + parenleft", hl.dsp.window.move({ workspace = "5"})) +hl.bind(mainMod .. " + SHIFT + minus", hl.dsp.window.move({ workspace = "6"})) +hl.bind(mainMod .. " + SHIFT + egrave", hl.dsp.window.move({ workspace = "7"})) +hl.bind(mainMod .. " + SHIFT + underscore", hl.dsp.window.move({ workspace = "8"})) +hl.bind(mainMod .. " + SHIFT + ccedilla", hl.dsp.window.move({ workspace = "9"})) +hl.bind(mainMod .. " + SHIFT + agrave", hl.dsp.window.move({ workspace = "10"})) +hl.bind(mainMod .. " + SHIFT + dead_circumflex", hl.dsp.window.move({ workspace = "11"})) +hl.bind(mainMod .. " + SHIFT + dollar", hl.dsp.window.move({ workspace = "12"})) +hl.bind(mainMod .. " + SHIFT + ugrave", hl.dsp.window.move({ workspace = "13"})) +hl.bind(mainMod .. " + SHIFT + asterisk", hl.dsp.window.move({ workspace = "14"})) diff --git a/dotfiles/hypr-desk/source/ev.lua b/dotfiles/hypr-desk/source/ev.lua new file mode 100644 index 0000000..59f208f --- /dev/null +++ b/dotfiles/hypr-desk/source/ev.lua @@ -0,0 +1,7 @@ +-- Set env here +hl.env("XCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_SIZE", "24") +hl.env("LIBVA_DRIVER_NAME", "nvidia") +hl.env("XDG_SESSION_TYPE", "wayland") +hl.env("GBM_BACKEND", "nvidia-drm") +hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia") diff --git a/dotfiles/hypr-desk/source/input.lua b/dotfiles/hypr-desk/source/input.lua new file mode 100644 index 0000000..735db6d --- /dev/null +++ b/dotfiles/hypr-desk/source/input.lua @@ -0,0 +1,23 @@ +--Set inputs here + +hl.config({ + input = { + kb_layout = "fr", + kb_variant = "", + kb_model = "", + kb_options = "", + kb_rules = "", + + follow_mouse = 1, + + sensitivity = 0, + + touchpad = { + natural_scroll = false, + }, + }, + cursor = { + no_hardware_cursors = 0, + min_refresh_rate = 165 + } +}) diff --git a/dotfiles/hypr-desk/source/look.lua b/dotfiles/hypr-desk/source/look.lua new file mode 100644 index 0000000..7fbee87 --- /dev/null +++ b/dotfiles/hypr-desk/source/look.lua @@ -0,0 +1,61 @@ +--Set look and feel here + +hl.config({ + general = { + layout = "dwindle", + gaps_in = 3, + gaps_out = 5, + border_size = 1, + col = { + active_border = { colors = {"rgba(33ccffee)", "rgba(00ff99ee)"}, angle = 45 }, + inactive_border = "rgba(595959aa)", + }, + }, + + decoration = { + rounding = 6, + rounding_power = 2, + + active_opacity = 1.0, + inactive_opacity = 1.0, + + shadow = { + enabled = false + }, + + blur = { + enabled = false, + }, + }, + + animations = { + enabled = true, + }, + + dwindle = { + preserve_split = true, + }, + + master = { + new_status = "master", + }, + + misc = { + force_default_wallpaper = 0, + disable_hyprland_logo = true, + }, + + ecosystem = { + no_update_news = true, + no_donation_nag = true, + } +}) + +hl.curve( "mybezier", { type = "bezier", points = { {0.05, 0.9}, {0.1, 1.05} } }) + +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 = 7, bezier = "mybezier" }) +hl.animation({ leaf = "borderangle", enabled = true, speed = 7, bezier = "mybezier" }) +hl.animation({ leaf = "fade", enabled = true, speed = 7, bezier = "mybezier" }) +hl.animation({ leaf = "workspaces", enabled = true, speed = 7, bezier = "mybezier" }) diff --git a/dotfiles/hypr-desk/source/monitors.lua b/dotfiles/hypr-desk/source/monitors.lua new file mode 100644 index 0000000..5d45447 --- /dev/null +++ b/dotfiles/hypr-desk/source/monitors.lua @@ -0,0 +1,15 @@ +-- Set monitors here +hl.monitor({ + output = "DP-1", + mode = "1920x1080@165", + position = "0x0", + scale = 1 +}) + +hl.monitor({ + output = "DP-2", + mode = "1920x1080@165", + position = "-1080x-520", + transform = 1, + scale = 1 +}) diff --git a/dotfiles/hypr-desk/source/winandwork.lua b/dotfiles/hypr-desk/source/winandwork.lua new file mode 100644 index 0000000..129ac50 --- /dev/null +++ b/dotfiles/hypr-desk/source/winandwork.lua @@ -0,0 +1,19 @@ +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, +})