From d4a489a52c309aeb55117a420b98c8e3599cc60d Mon Sep 17 00:00:00 2001 From: "Gu://em_" Date: Tue, 4 Aug 2026 12:49:45 +0200 Subject: [PATCH 1/2] New default size for floating windows, fixed keyboard layout switching and lua variable names --- .config/hypr/config/appearance.lua | 10 ++- .config/hypr/config/environment.lua | 6 +- .config/hypr/config/input.lua | 104 +++++++++++++++----------- .config/hypr/config/kb_layouts/fr.lua | 10 +-- 4 files changed, 76 insertions(+), 54 deletions(-) diff --git a/.config/hypr/config/appearance.lua b/.config/hypr/config/appearance.lua index 3984d57..8caaf8f 100644 --- a/.config/hypr/config/appearance.lua +++ b/.config/hypr/config/appearance.lua @@ -147,9 +147,9 @@ hl.config({ }) -------------------------------- ----- WINDOWS AND WORKSPACES --- -------------------------------- +------ Windows rules + +---- Desktop behavior -- Ignore maximize requests from apps. You'll probably like this. hl.window_rule({ @@ -175,6 +175,8 @@ hl.window_rule({ no_focus = true, }) +---- Applications + -- Prism Launcher hl.window_rule({ name = "prismlauncher-all", @@ -298,6 +300,8 @@ hl.window_rule({ --# TODO --windowrulev2 = size 100 100,floating:1 +------ Workspace rules + -- Increase gaps for single apps --# Usless since I changed the default gap but may be useful if you decide to reset it to 0 --workspace=w[t1], gapsout:2 diff --git a/.config/hypr/config/environment.lua b/.config/hypr/config/environment.lua index 1d2dfcc..e882f37 100644 --- a/.config/hypr/config/environment.lua +++ b/.config/hypr/config/environment.lua @@ -32,10 +32,14 @@ end) hl.config({ ecosystem = { - enforce_permissions = true, + enforce_permissions = false, -- Disabled for the moment }, }) +hl.permission({ binary = "/usr/bin/grim", type = "screencopy", mode = "allow" }) +hl.permission({ binary = "/usr/bin/hyprlock", type = "screencopy", mode = "allow" }) +-- XDG Desktop Portal +hl.permission({ binary = "/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", type = "screencopy", mode = "allow" }) ------------------------------ ---- ENVIRONMENT VARIABLES --- diff --git a/.config/hypr/config/input.lua b/.config/hypr/config/input.lua index a99320d..070a734 100644 --- a/.config/hypr/config/input.lua +++ b/.config/hypr/config/input.lua @@ -1,3 +1,12 @@ +function ToggleFloatingWindow() + local monitor = hl.get_active_monitor() + local width = math.floor(monitor.width * 0.8) + local height = math.floor(monitor.height * 0.8) + + hl.dispatch(hl.dsp.window.float({ action = "toggle" })) + hl.dispatch(hl.dsp.window.resize({ x = width, y = height, window = "active", })) +end + -------------- ---- INPUT --- -------------- @@ -21,80 +30,85 @@ hl.gesture({ action = "workspace", }) +hl.gesture({ + fingers = 3, + direction = "vertical", + action = ToggleFloatingWindow, +}) + -------------------- ---- KEYBINDINGS --- -------------------- -mainMod = "SUPER" -- Sets META ("Windows") key as main modifier +MainMod = "SUPER" -- Sets META ("Windows") key as main modifier -- Main desktop controls -hl.bind(mainMod .. " + Q" , hl.dsp.window.close()) -hl.bind(mainMod .. " + R" , hl.dsp.exec_cmd(menu)) -- Omnibar -hl.bind(mainMod .. " + D" , hl.dsp.exec_cmd(menu)) -- Legacy menu shortcut -hl.bind(mainMod .. " + I" , hl.dsp.exec_cmd("hyprlock")) -- Lockscreen -hl.bind(mainMod .. " + B" , hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-waybar.sh")) -- Toggle sidebar -hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd("~/.config/hypr/scripts/reload.sh")) -- Reload desktop -hl.bind(mainMod .. " + F11" , hl.dsp.exec_cmd("~/.config/hypr/scripts/gamemode.sh")) -- Gamemode -hl.bind(mainMod .. " + F10" , hl.dsp.exec_cmd("~/.config/hypr/scripts/sharp_mode.sh")) -- Sharp mode -hl.bind(mainMod .. " + SHIFT + M", hl.dsp.exit()) -- Exit desktop session +hl.bind(MainMod .. " + Q" , hl.dsp.window.close()) +hl.bind(MainMod .. " + R" , hl.dsp.exec_cmd(menu)) -- Omnibar +hl.bind(MainMod .. " + D" , hl.dsp.exec_cmd(menu)) -- Legacy menu shortcut +hl.bind(MainMod .. " + I" , hl.dsp.exec_cmd("hyprlock")) -- Lockscreen +hl.bind(MainMod .. " + B" , hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-waybar.sh")) -- Toggle sidebar +hl.bind(MainMod .. " + SHIFT + R", hl.dsp.exec_cmd("~/.config/hypr/scripts/reload.sh")) -- Reload desktop +hl.bind(MainMod .. " + F11" , hl.dsp.exec_cmd("~/.config/hypr/scripts/gamemode.sh")) -- Gamemode +hl.bind(MainMod .. " + F10" , hl.dsp.exec_cmd("~/.config/hypr/scripts/sharp_mode.sh")) -- Sharp mode +hl.bind(MainMod .. " + SHIFT + M", hl.dsp.exit()) -- Exit desktop session -- Shortcuts -hl.bind(mainMod .. " + RETURN", hl.dsp.exec_cmd(terminal)) -hl.bind(mainMod .. " + X" , hl.dsp.exec_cmd(terminal)) -- Absolutely not because I dislocated my arm -hl.bind(mainMod .. " + SPACE" , hl.dsp.exec_cmd(menu)) -hl.bind(mainMod .. " + E" , hl.dsp.exec_cmd(fileManager)) -hl.bind(mainMod .. " + A" , hl.dsp.exec_cmd(notificationManager)) +hl.bind(MainMod .. " + RETURN", hl.dsp.exec_cmd(terminal)) +hl.bind(MainMod .. " + X" , hl.dsp.exec_cmd(terminal)) -- Absolutely not because I dislocated my arm +hl.bind(MainMod .. " + SPACE" , hl.dsp.exec_cmd(menu)) +hl.bind(MainMod .. " + E" , hl.dsp.exec_cmd(fileManager)) +hl.bind(MainMod .. " + A" , hl.dsp.exec_cmd(notificationManager)) -- TODO Replace by default editor -hl.bind("XF86Launch1" , hl.dsp.exec_cmd(terminal .. " hx ~/.config/hypr/config")) +hl.bind("XF86Launch1" , hl.dsp.exec_cmd(terminal .. " hx ~/.config/hypr/config")) -- Move focus with mainMod + arrow keys -hl.bind(mainMod .. " + left" , hl.dsp.focus({ direction = "left" })) -hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" })) -hl.bind(mainMod .. " + up" , hl.dsp.focus({ direction = "up" })) -hl.bind(mainMod .. " + down" , hl.dsp.focus({ direction = "down" })) +hl.bind(MainMod .. " + left" , hl.dsp.focus({ direction = "left" })) +hl.bind(MainMod .. " + right", hl.dsp.focus({ direction = "right" })) +hl.bind(MainMod .. " + up" , hl.dsp.focus({ direction = "up" })) +hl.bind(MainMod .. " + down" , hl.dsp.focus({ direction = "down" })) -- Move focus with mainMod + hjkl (vim keybinds) -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" })) +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 windows with mainMod + shift + arrow keys -hl.bind(mainMod .. " + SHIFT + left" , hl.dsp.window.move{ direction = "left" }) -hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move{ direction = "right" }) -hl.bind(mainMod .. " + SHIFT + up" , hl.dsp.window.move{ direction = "up" }) -hl.bind(mainMod .. " + SHIFT + down" , hl.dsp.window.move{ direction = "down" }) +hl.bind(MainMod .. " + SHIFT + left" , hl.dsp.window.move{ direction = "left" }) +hl.bind(MainMod .. " + SHIFT + right", hl.dsp.window.move{ direction = "right" }) +hl.bind(MainMod .. " + SHIFT + up" , hl.dsp.window.move{ direction = "up" }) +hl.bind(MainMod .. " + SHIFT + down" , hl.dsp.window.move{ direction = "down" }) -- Layout -hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen()) -hl.bind(mainMod .. " + " .. "V", hl.dsp.layout("togglesplit")) - --- Horizontal/vertical split -hl.bind(mainMod .. " + " .. "T", hl.dsp.window.float()) -hl.bind(mainMod .. " + " .. "Y", hl.dsp.window.pseudo()) -- Toggle pseudo-tiling +hl.bind(MainMod .. " + " .. "F", hl.dsp.window.fullscreen()) +hl.bind(MainMod .. " + " .. "V", hl.dsp.layout("togglesplit")) -- Horizontal/vertical split +-- Toggle floating +hl.bind(MainMod .. " + T", ToggleFloatingWindow ) +hl.bind(MainMod .. " + " .. "Y", hl.dsp.window.pseudo()) -- Toggle pseudo-tiling -- Switch workspaces with mainMod + [0-9] -- Move active window to a workspace with mainMod + SHIFT + [0-9] for i = 0, 10 do - key = i % 10 - hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i})) - hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) + local key = i % 10 + hl.bind(MainMod .. " + " .. key, hl.dsp.focus({ workspace = i})) + hl.bind(MainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) end -- Example special workspace (scratchpad) -hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) -hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) +hl.bind(MainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) +hl.bind(MainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) -- TODO -- Minimize function (uses scratchpad) -- 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" })) +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 }) +hl.bind(MainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(MainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -- Function keys @@ -122,7 +136,7 @@ hl.bind("Print", hl.dsp.exec_cmd("~/.config/hypr/scripts/screenshot.sh")) hl.bind("SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.config/hypr/scripts/screenshot.sh --fullscreen")) -- Color picker -hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "C", hl.dsp.exec_cmd("hyprpicker -a")) +hl.bind(MainMod .. " + " .. "SHIFT" .. " + " .. "C", hl.dsp.exec_cmd("hyprpicker -a")) --- Touchpad toggle hl.bind("XF86TouchpadToggle", hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-touchpad.sh"), { locked = true }) @@ -133,7 +147,7 @@ hl.bind("SUPER + CONTROL" .. " + " .. "XF86TouchpadToggle", hl.dsp.exec_cmd("~/. --- Keyboard layout toggle ---- Only works between AZERTY and QWERTY because of differences in the numbers row ---- that prevent using the default way provided by hyprland -hl.bind(mainMod .. " + " .. "CONTROL" .. " + " .. "SPACE", hl.dsp.exec_cmd("~/.config/hypr/scripts/change-kb-layout.sh")) +hl.bind(MainMod .. " + " .. "CONTROL" .. " + " .. "SPACE", hl.dsp.exec_cmd("~/.config/hypr/scripts/change-kb-layout.sh")) -- Lock laptop on lid close hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprlock --immediate"), { locked = true }) diff --git a/.config/hypr/config/kb_layouts/fr.lua b/.config/hypr/config/kb_layouts/fr.lua index 748e31a..f2f6742 100644 --- a/.config/hypr/config/kb_layouts/fr.lua +++ b/.config/hypr/config/kb_layouts/fr.lua @@ -9,10 +9,10 @@ hl.config({ -- Switch workspaces with mainMod + [0-9] -- Move active window to a workspace with mainMod + SHIFT + [0-9] -local fr_digits_layout = [ "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", "minus", "egrave", "underscore", "ccedilla", "agrave", ] -for i = 0, 10 do - key = fr_digits_layout[i%10] - hl.bind(mainMod.. " + " .. key, hl.dsp.focus({ workspace = i })) - hl.bind(mainMod.. " + SHIFT + " .. key, hl.dsp.focus({ workspace = i })) +local fr_digits_layout = { "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", "minus", "egrave", "underscore", "ccedilla", "agrave", } +for i = 1, 10 do + local key = fr_digits_layout[(i%11)] + hl.bind(MainMod.. " + " .. key, hl.dsp.focus({ workspace = i })) + hl.bind(MainMod.. " + SHIFT + " .. key, hl.dsp.focus({ workspace = i })) end From da39b8b8e0d6b08a671c2da9541eac50677c81af Mon Sep 17 00:00:00 2001 From: "Gu://em_" Date: Tue, 4 Aug 2026 12:56:31 +0200 Subject: [PATCH 2/2] Added missing changes from last commit, style changes inside hyprland config files --- .config/hypr/config/environment.lua | 22 ++++++++-------------- .config/hypr/config/input.lua | 16 ++++++++-------- .config/hypr/scripts/change-kb-layout.sh | 8 ++++---- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.config/hypr/config/environment.lua b/.config/hypr/config/environment.lua index e882f37..8901229 100644 --- a/.config/hypr/config/environment.lua +++ b/.config/hypr/config/environment.lua @@ -1,15 +1,11 @@ ------------------ ----- PROGRAMS --- ------------------ +------ Programs -terminal = "foot" -fileManager = "nautilus" -menu = "rofi -show drun" -notificationManager = "swaync-client -t" +Terminal = "foot" +FileManager = "nautilus" +Menu = "rofi -show drun" +NotificationManager = "swaync-client -t" ------------------- ----- AUTOSTART --- ------------------- +------ Autostart -- Autostart necessary processes (like notifications daemons, status bars, etc.) @@ -19,13 +15,11 @@ hl.on("hyprland.start", function() hl.exec_cmd("wl-paste --type text --watch cliphist store") -- Stores only text data hl.exec_cmd("wl-paste --type image --watch cliphist store") -- Stores only image data -- SSH Agent - hl.exec_cmd("ssh-agent") + hl.exec_cmd("ssh-agent") end) --------------------- ----- PERMISSIONS --- --------------------- +------ Permissions -- Please note permission changes here require a Hyprland restart and are not applied on-the-fly -- for security reasons diff --git a/.config/hypr/config/input.lua b/.config/hypr/config/input.lua index 070a734..39cf63a 100644 --- a/.config/hypr/config/input.lua +++ b/.config/hypr/config/input.lua @@ -44,8 +44,8 @@ MainMod = "SUPER" -- Sets META ("Windows") key as main modifier -- Main desktop controls hl.bind(MainMod .. " + Q" , hl.dsp.window.close()) -hl.bind(MainMod .. " + R" , hl.dsp.exec_cmd(menu)) -- Omnibar -hl.bind(MainMod .. " + D" , hl.dsp.exec_cmd(menu)) -- Legacy menu shortcut +hl.bind(MainMod .. " + R" , hl.dsp.exec_cmd(Menu)) -- Omnibar +hl.bind(MainMod .. " + D" , hl.dsp.exec_cmd(Menu)) -- Legacy menu shortcut hl.bind(MainMod .. " + I" , hl.dsp.exec_cmd("hyprlock")) -- Lockscreen hl.bind(MainMod .. " + B" , hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-waybar.sh")) -- Toggle sidebar hl.bind(MainMod .. " + SHIFT + R", hl.dsp.exec_cmd("~/.config/hypr/scripts/reload.sh")) -- Reload desktop @@ -54,13 +54,13 @@ hl.bind(MainMod .. " + F10" , hl.dsp.exec_cmd("~/.config/hypr/scripts/sharp hl.bind(MainMod .. " + SHIFT + M", hl.dsp.exit()) -- Exit desktop session -- Shortcuts -hl.bind(MainMod .. " + RETURN", hl.dsp.exec_cmd(terminal)) -hl.bind(MainMod .. " + X" , hl.dsp.exec_cmd(terminal)) -- Absolutely not because I dislocated my arm -hl.bind(MainMod .. " + SPACE" , hl.dsp.exec_cmd(menu)) -hl.bind(MainMod .. " + E" , hl.dsp.exec_cmd(fileManager)) -hl.bind(MainMod .. " + A" , hl.dsp.exec_cmd(notificationManager)) +hl.bind(MainMod .. " + RETURN", hl.dsp.exec_cmd(Terminal)) +hl.bind(MainMod .. " + X" , hl.dsp.exec_cmd(Terminal)) -- Absolutely not because I dislocated my arm +hl.bind(MainMod .. " + SPACE" , hl.dsp.exec_cmd(Menu)) +hl.bind(MainMod .. " + E" , hl.dsp.exec_cmd(FileManager)) +hl.bind(MainMod .. " + A" , hl.dsp.exec_cmd(NotificationManager)) -- TODO Replace by default editor -hl.bind("XF86Launch1" , hl.dsp.exec_cmd(terminal .. " hx ~/.config/hypr/config")) +hl.bind("XF86Launch1" , hl.dsp.exec_cmd(Terminal .. " hx ~/.config/hypr/config")) -- Move focus with mainMod + arrow keys hl.bind(MainMod .. " + left" , hl.dsp.focus({ direction = "left" })) diff --git a/.config/hypr/scripts/change-kb-layout.sh b/.config/hypr/scripts/change-kb-layout.sh index 5509aa7..49de73b 100755 --- a/.config/hypr/scripts/change-kb-layout.sh +++ b/.config/hypr/scripts/change-kb-layout.sh @@ -1,7 +1,7 @@ #!/bin/sh status_file="$HOME/.config/hypr/status/kb_layout" -hyprland_cfg_file="$HOME/.config/hypr/hyprland.conf" +hyprland_cfg_file="$HOME/.config/hypr/hyprland.lua" fr_to_en() { @@ -9,7 +9,7 @@ fr_to_en() { hyprctl notify 1 2000 0 "Keyboard set to QWERTY" - sed -i 's/kb_layouts\/fr/kb_layouts\/us/g' "$hyprland_cfg_file" + sed -i 's/kb_layouts.fr/kb_layouts.us/g' "$hyprland_cfg_file" } en_to_fr() { @@ -17,7 +17,7 @@ en_to_fr() { hyprctl notify 1 2000 0 "Keyboard set to AZERTY" - sed -i 's/kb_layouts\/us/kb_layouts\/fr/g' "$hyprland_cfg_file" + sed -i 's/kb_layouts\.us/kb_layouts\.fr/g' "$hyprland_cfg_file" } if ! [ -f "${status_file}" ]; then @@ -30,4 +30,4 @@ else elif [ $(cat "${status_file}") = "en" ]; then en_to_fr fi -fi \ No newline at end of file +fi