diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index 5eef442..c2f3660 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -38,8 +38,8 @@ hl.monitor({ hl.monitor({ output = "desc:Lenovo Group Limited L15 U133R0A2", mode = "preferred", position = "auto-left", scale = 1 }) hl.monitor({ output = "desc:Lenovo Group Limited M15 V30F2A15", mode = "preferred", position = "auto-left", scale = 1 }) hl.monitor({ output = "desc:Proteon TYPE-C 8R33926O00QS", mode = "preferred", position = "auto-right", scale = "1.0" }) -hl.monitor({ output = "desc:Stargate Technology TYPE-C", mode = "preferred", position = "auto-right", scale = "1.0" }) -hl.monitor({ output = "desc:GWD ARZOPA 000000000000", mode = "preferred", position = "auto-left", scale = "1.0" }) +hl.monitor({ output = "desc:Stargate Technology TYPE-C", mode = "preferred", position = "auto-down", scale = "1.0" }) +hl.monitor({ output = "desc:GWD ARZOPA 000000000000", mode = "preferred", position = "auto-down", scale = "1.0" }) hl.monitor({ output = "desc:BNQ BenQ EX3203R 7CL00509019", mode = "preferred", position = "auto", scale = 1 }) hl.monitor({ output = "desc:BNQ BenQ EX3501R N4M05650019", mode = "preferred", position = "auto-right", scale = "1.0" }) hl.monitor({ @@ -52,7 +52,7 @@ hl.monitor({ hl.monitor({ output = "desc:Microstep MSI MAG342CQR DB6H252300057", mode = "preferred", - position = "auto-right", + position = "auto-left", scale = "1.0" }) @@ -197,7 +197,7 @@ hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "almostLinear" -- local terminal = "ghostty -e" local terminal = "foot" -local notify_cmd = "notify-send" +local _notify_cmd = "notify-send" local browser = "gtk-launch firefox.desktop" local webapp = "chromium --new-window --ozone-platform=wayland --app=" local music = "gtk-launch spotify.desktop" @@ -318,13 +318,44 @@ function toggle_master() hl.dispatch(hl.dsp.layout("mfact exact " .. mfact)) end +function toggle_float_with_limit() + local win = hl.get_active_window() + if win == nil then + return + end + + local was_floating = win.floating + hl.dispatch(hl.dsp.window.float({ action = "toggle" })) + if was_floating then + return + end + + win = hl.get_active_window() + local mon = win and win.monitor and hl.get_monitor(win.monitor) or hl.get_active_monitor() + if mon == nil or mon.size == nil or win == nil or win.size == nil then + return + end + + local max_width = math.floor(mon.size.width * 0.8) + local max_height = math.floor(mon.size.height * 0.8) + local scale = math.min(1, max_width / win.size.width, max_height / win.size.height) + if scale < 1 then + hl.dispatch(hl.dsp.window.resize({ + x = math.floor(win.size.width * scale), + y = math.floor(win.size.height * scale), + relative = false, + })) + end +end + hl.bind(LEADER .. "SHIFT + return", hl.dsp.exec_cmd("gtk-launch herdr.desktop"), { description = "Open herdr terminal" }) hl.bind(LEADER .. "return", hl.dsp.exec_cmd("gtk-launch tmux.desktop"), { description = "Open tmux terminal" }) +hl.bind(LEADER .. "N", hl.dsp.exec_cmd(terminal .. " -a quicknotes -e nvim +'Obsidian today'"), + { description = "Open Obsidian today in a centered floating window" }) hl.bind(LEADER .. "B", hl.dsp.exec_raw(browser), { description = "Open browser" }) -hl.bind(LEADER .. "T", hl.dsp.exec_raw(terminal .. " -e btop"), { description = "Open system monitor" }) hl.bind(LEADER .. "S", hl.dsp.exec_raw("ostt launch --paste"), { description = "Open ostt" }) -hl.bind(LEADER .. "I", function() sysinfo() end, { description = "Show system info" }) +hl.bind(LEADER .. "I", sysinfo, { description = "Show system info" }) -- Open rofi on first press, closes it on second hl.bind(LEADER .. "Space", hl.dsp.exec_raw("rofi -show combi --modes combi"), @@ -340,6 +371,7 @@ hl.bind(LEADER .. "slash", { release = true, description = "Open rofi-pass" } ) +hl.bind(HYPR .. "P", hl.dsp.exec_cmd("gtk-launch pi.desktop"), { description = "Open pi tui" }) hl.bind(HYPR .. "V", hl.dsp.exec_cmd("pavucontrol"), { description = "Volume control" }) hl.bind(HYPR .. "B", hl.dsp.exec_cmd("blueberry"), { description = "Bluetooth manager" }) @@ -430,7 +462,9 @@ hl.bind(LEADER .. "CTRL + F", hl.dsp.window.fullscreen_state({ internal = 2, cli { description = "Window: Toggle fullscreen state 2" }) hl.bind(LEADER .. "ALT + F", hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }), { description = "Window: Toggle fullscreen state 2" }) -hl.bind(LEADER .. "SHIFT + F", hl.dsp.window.float({ action = "toggle" }), { description = "Window: Toggle floating" }) + +hl.bind(LEADER .. "T", toggle_float_with_limit, + { description = "Window: Toggle floating/tiling (max 80%)" }) hl.bind(LEADER .. "P", hl.dsp.window.pseudo(), { description = "Window: Toggle pseudo tiling" }) @@ -462,9 +496,7 @@ hl.bind(LEADER .. "ALT + Tab", hl.dsp.focus({ workspace = "previous", on_current { description = "Window: Focus previous in workspace" }) -- arrange split ratio -hl.bind(LEADER .. "X", function() - toggle_master() -end) +hl.bind(LEADER .. "X", toggle_master, { description = "Layout: Toggle master size" }) -- hl.bind(LEADER .. "equal", hl.dsp.layout("mfact exact 0.5")) hl.bind(LEADER .. "M", hl.dsp.layout("swapwithmaster")) @@ -651,10 +683,23 @@ hl.window_rule({ "+floating-window" }) +hl.window_rule({ + match = { class = "terminal-pi" }, + tag = "+floating-window" +}) + +hl.window_rule({ + match = { class = "quicknotes" }, + tag = "+floating-window" +}) + hl.window_rule({ name = "ostt floating windows", match = { class = "ostt-popup" }, - tag = "+floating-window" + float = true, + no_anim = true, + move = { 10, 10 }, + size = { 320, 240 }, }) hl.window_rule({ @@ -685,6 +730,7 @@ hl.window_rule({ no_focus = true, }) + hl.window_rule({ match = { tag = "floating-window" }, float = true, center = true, size = { "monitor_w/2", "monitor_h/2" } }) hl.window_rule({ match = { class = "(rofi|wofi)" }, tag = "+user-menu" })