New default size for floating windows, fixed keyboard layout switching and lua variable names

This commit is contained in:
Gu://em_ 2026-08-04 12:49:45 +02:00
parent e0570a2d5e
commit d4a489a52c
4 changed files with 76 additions and 54 deletions

View file

@ -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

View file

@ -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 ---

View file

@ -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 })

View file

@ -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