diff --git a/config/hypr/envs.lua b/config/hypr/envs.lua new file mode 100644 index 0000000..dd3e95c --- /dev/null +++ b/config/hypr/envs.lua @@ -0,0 +1,28 @@ + +-- Cursor size +hl.env("XCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_SIZE", "24") + +-- Force all apps to use Wayland +hl.env("GDK_BACKEND", "wayland,x11,*") +hl.env("QT_QPA_PLATFORM", "wayland;xcb") +hl.env("QT_STYLE_OVERRIDE", "kvantum") +hl.env("SDL_VIDEODRIVER", "wayland") +hl.env("MOZ_ENABLE_WAYLAND", "1") +hl.env("ELECTRON_OZONE_PLATFORM_HINT", "wayland") +hl.env("OZONE_PLATFORM", "wayland") +hl.env("XDG_SESSION_TYPE", "wayland") + +-- Allow better support for screen sharing (Google Meet"," Discord, etc) +hl.env("XDG_CURRENT_DESKTOP", "Hyprland") +hl.env("XDG_SESSION_DESKTOP", "Hyprland") + +-- Use XCompose file +hl.env("XCOMPOSEFILE", "~/.XCompose") + +-- Make Chromium use XCompose and all Wayland +hl.env("CHROMIUM_FLAGS", "--enable-features=UseOzonePlatform --ozone-platform=wayland --gtk-version=4") + +-- Make .desktop files available for wofi +hl.env("XDG_DATA_DIRS", "/usr/share:/usr/local/share:~/.local/share") + diff --git a/config/hypr/functions.lua b/config/hypr/functions.lua new file mode 100644 index 0000000..5d80f41 --- /dev/null +++ b/config/hypr/functions.lua @@ -0,0 +1,198 @@ +function sysinfo() + local mem = io.popen("free -h | awk '/^Mem/ {print $3 \"/\" $2}'"):read("*a") + local cpu = io.popen("top -bn1 | grep 'Cpu(s)' | awk '{print $2 + $4 \"%\"}'"):read("*a") + local battery = io.popen("acpi -b | awk -F', ' '{print $2}'"):read("*a") + local time = os.date("%Y-%m-%d %H:%M:%S") + local monitor = hl.get_active_monitor() + local workspace_id = monitor.active_workspace.id + local mesg = "System Info" + .. "\nDate: " .. time + .. "\nFocused monitor: " .. monitor.name + .. "\nWorkspace: " .. workspace_id + .. "\nBattery: " .. battery + .. "CPU: " .. cpu .. " MEM: " .. mem + + hl.notification.create({ text = mesg, icon = "hint", duration = 5000 }) +end + +function toggle_pin() + local win = hl.get_active_window() + if win == nil then + return + end + + local is_pinned = win.pinned + hl.dispatch(hl.dsp.window.pin({ action = is_pinned and "unset" or "set" })) +end + +function dispatch_focus_or_launch(opts) + return function() + focus_or_launch(opts) + end +end + +function focus_or_launch(opts) + local match = opts.match + local cmd = opts.cmd + local field = opts.field or "class" -- class, title, initialClass, initialTitle + local use_workspace = opts.use_workspace ~= false + + local clients = hl.get_windows() + + for _, client in ipairs(clients) do + local value = client[field] + if value and string.find(string.lower(value), string.lower(match), 1, true) then + if use_workspace and client.workspace and client.workspace.id then + hl.dispatch(hl.dsp.focus({ + workspace = client.workspace.id, + on_current_monitor = true, + })) + end + hl.dispatch(hl.dsp.focus({ + window = "address:" .. client.address + })) + + local layout = client.layout + if not (layout and layout.name == "master" and layout.is_master) then + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + return + end + end + + hl.exec_cmd(cmd) +end + +function fetch_or_launch(opts) + local match = opts.match + local cmd = opts.cmd + local field = opts.field or "class" -- class, title, initialClass, initialTitle + local use_workspace = opts.use_workspace ~= false + + local clients = hl.get_windows() + + local active_workspace = hl.get_active_workspace() + + for _, client in ipairs(clients) do + local value = client[field] + if value and string.find(string.lower(value), string.lower(match), 1, true) then + if use_workspace and client.workspace and client.workspace.id then + hl.dispatch(hl.dsp.window.move({ + workspace = active_workspace, + on_current_monitor = true, + window = client, + })) + end + + hl.dispatch(hl.dsp.focus({ window = client })) + + local layout = client.layout + if not (layout and layout.name == "master" and layout.is_master) then + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + return + end + end + + hl.exec_cmd(cmd) +end + +function toggle_master() + local ws = hl.get_active_workspace() + if not ws then + return + end + + local mfact = nil + + for _, win in ipairs(ws:get_windows()) do + local layout = win.layout + if layout and layout.name == "master" and layout.is_master then + mfact = math.floor(layout.perc_master * 100 + 0.5) / 100 + break + end + end + + if mfact == 0.7 then + mfact = 0.5 + else + mfact = 0.7 + end + 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 + + local mon = 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.width * 0.8) + local max_height = math.floor(mon.height * 0.8) + local scale = math.max(1, win.size.x / max_width, win.size.y / max_height) + hl.notification.create({ + text = "Scale " .. + scale .. " Max float size: " .. win.size.x / max_width .. "x" .. win.size.y / max_height, + duration = 2000, + icon = + "hint" + }) + if scale > 1 then + hl.dispatch(hl.dsp.window.resize({ + x = math.floor(max_width), + y = math.floor(max_height), + relative = false, + window = win + })) + end +end + +function cycle_next_window(opts) + return function() + hl.dispatch(hl.dsp.window.cycle_next(opts)) + + local win = hl.get_active_window() + if win and win.floating then + hl.dispatch(hl.dsp.window.alter_zorder({ mode = "top" })) + end + end +end + +function window_resize_percentage(px, py) + local win = hl.get_active_window() + if win == nil or win.monitor == nil then + return + end + local mon = hl.get_monitor(win.monitor) + + if mon == nil or mon.size == nil or mon.size.height == nil or mon.size.width == nil then + return + end + local sx = math.floor(mon.size.width * px) + local sy = math.floor(mon.size.height * py) + if not win.floating then + hl.dispatch(hl.dsp.window.float({ action = "set" })) + end + if win.fullscreen then + hl.dispatch(hl.dsp.window.fullscreen({ action = "unset" })) + end + hl.dispatch(hl.dsp.window.resize({ x = sx, y = sy, relative = false })) +end + +function toggle_master_scrolling() + local current = hl.get_config("general.layout") + local next_layout = current == "master" and "scrolling" or "master" + + hl.config({ general = { layout = next_layout } }) +end diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index d0d5b95..6ff25d0 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -1,62 +1,19 @@ --- require("keybinds.lua") -hl.monitor({ output = "desc:Lenovo Group Limited 0x41A0", mode = "highrr", position = "0x0", scale = "1.0" }) -hl.monitor({ output = "desc:Samsung Display Corp. 0x4143", mode = "highrr", position = "0x0", scale = "2" }) -hl.monitor({ - output = "desc:LG Electronics LG HDR 4K 406NTZN74597", - mode = "preferred", - position = "auto-right", - scale = - "1.333333" -}) -hl.monitor({ - output = "desc:Ancor Communications Inc ASUS MG28U 0x00009B77", - mode = "preferred", - position = "auto-right", - scale = - "1.333333" -}) +-- local terminal = "ghostty -e" +local terminal = "foot" +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" --- hl.monitor({ output = "eDP-1", mode = "preferred", position = "0x0", scale = "1.0" }) +local LEADER = "SUPER + " +local HYPR = "SUPER + CONTROL + SHIFT + ALT + " -hl.monitor({ - output = "desc:LG Electronics LG HDR WQHD 0x0006530C", - mode = "preferred", - position = "auto-up", - scale = - "1.333333" -}) -hl.monitor({ output = "CAP Capture 0x00000001", mode = "1920x1080@60", position = "auto-down", scale = 1 }) -hl.monitor({ output = "HDMI-A-1", mode = "1920x1080@60", position = "auto-down", scale = 1 }) -hl.monitor({ output = "HDMI-A-2", mode = "1920x1080@60", position = "auto-down", scale = 1 }) - -hl.monitor({ - output = "desc:Ancor Communications Inc ASUS PB238 DCLMTF074371", - mode = "preferred", - position = "auto", - scale = - "1.0" -}) -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-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({ - output = "desc:Dell Inc. DELL U3818DW 97F8P8AD0HEL", - mode = "preferred", - position = "auto-left", - scale = - "1.0" -}) -hl.monitor({ - output = "desc:Microstep MSI MAG342CQR DB6H252300057", - mode = "preferred", - position = "auto-left", - scale = - "1.0" -}) +require("monitors") +require("functions") +require("rules") +require("theme") +require("envs") +require("onstart") hl.config({ input = { @@ -116,7 +73,9 @@ hl.config({ }, scrolling = { - column_width = 1.0 + focus_fit_method = 0, + column_width = 0.49, + fullscreen_on_one_column = true }, decoration = { @@ -196,128 +155,7 @@ hl.animation({ leaf = "workspaces", enabled = true, speed = 1, bezier = "quick" hl.animation({ leaf = "layers", enabled = true, speed = 3, bezier = "quick" }) hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "almostLinear" }) --- local terminal = "ghostty -e" -local terminal = "foot" -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" - -local LEADER = "SUPER + " -local HYPR = "SUPER + CONTROL + SHIFT + ALT + " - -function sysinfo() - local mem = io.popen("free -h | awk '/^Mem/ {print $3 \"/\" $2}'"):read("*a") - local cpu = io.popen("top -bn1 | grep 'Cpu(s)' | awk '{print $2 + $4 \"%\"}'"):read("*a") - local battery = io.popen("acpi -b | awk -F', ' '{print $2}'"):read("*a") - local time = os.date("%Y-%m-%d %H:%M:%S") - local monitor = hl.get_active_monitor() - local workspace_id = monitor.active_workspace.id - local mesg = "System Info" - .. "\nDate: " .. time - .. "\nFocused monitor: " .. monitor.name - .. "\nWorkspace: " .. workspace_id - .. "\nBattery: " .. battery - .. "CPU: " .. cpu .. " MEM: " .. mem - - hl.notification.create({ text = mesg, icon = "hint", duration = 5000 }) -end - -function dispatch_focus_or_launch(opts) - return function() - focus_or_launch(opts) - end -end - -function focus_or_launch(opts) - local match = opts.match - local cmd = opts.cmd - local field = opts.field or "class" -- class, title, initialClass, initialTitle - local use_workspace = opts.use_workspace ~= false - - local clients = hl.get_windows() - - for _, client in ipairs(clients) do - local value = client[field] - if value and string.find(string.lower(value), string.lower(match), 1, true) then - if use_workspace and client.workspace and client.workspace.id then - hl.dispatch(hl.dsp.focus({ - workspace = client.workspace.id, - on_current_monitor = true, - })) - end - hl.dispatch(hl.dsp.focus({ - window = "address:" .. client.address - })) - - local layout = client.layout - if not (layout and layout.name == "master" and layout.is_master) then - hl.dispatch(hl.dsp.layout("swapwithmaster")) - end - return - end - end - - hl.exec_cmd(cmd) -end - -function fetch_or_launch(opts) - local match = opts.match - local cmd = opts.cmd - local field = opts.field or "class" -- class, title, initialClass, initialTitle - local use_workspace = opts.use_workspace ~= false - - local clients = hl.get_windows() - - local active_workspace = hl.get_active_workspace() - - for _, client in ipairs(clients) do - local value = client[field] - if value and string.find(string.lower(value), string.lower(match), 1, true) then - if use_workspace and client.workspace and client.workspace.id then - hl.dispatch(hl.dsp.window.move({ - workspace = active_workspace, - on_current_monitor = true, - window = client, - })) - end - - hl.dispatch(hl.dsp.focus({ window = client })) - - local layout = client.layout - if not (layout and layout.name == "master" and layout.is_master) then - hl.dispatch(hl.dsp.layout("swapwithmaster")) - end - return - end - end - - hl.exec_cmd(cmd) -end - -function toggle_master() - local ws = hl.get_active_workspace() - if not ws then - return - end - - local mfact = nil - - for _, win in ipairs(ws:get_windows()) do - local layout = win.layout - if layout and layout.name == "master" and layout.is_master then - mfact = math.floor(layout.perc_master * 100 + 0.5) / 100 - break - end - end - - if mfact == 0.7 then - mfact = 0.5 - else - mfact = 0.7 - end - hl.dispatch(hl.dsp.layout("mfact exact " .. mfact)) -end +-- Keybindings 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" }) @@ -328,6 +166,12 @@ hl.bind(LEADER .. "B", hl.dsp.exec_raw(browser), { description = "Open browser" hl.bind(LEADER .. "S", hl.dsp.exec_raw("ostt launch --paste"), { description = "Open ostt" }) hl.bind(LEADER .. "I", sysinfo, { description = "Show system info" }) +hl.bind( + LEADER .. "Y", + toggle_master_scrolling, + { description = "Layout: Toggle master/scrolling" } +) + -- Open rofi on first press, closes it on second hl.bind(LEADER .. "Space", hl.dsp.exec_raw("rofi -show combi --modes combi"), { release = true, description = "Open Application Menu" }) @@ -342,7 +186,6 @@ 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" }) @@ -352,12 +195,7 @@ hl.bind(HYPR .. "semicolon", hl.dsp.exec_cmd("~/.local/bin/set-wallpaper.sh cate hl.bind("Print", hl.dsp.exec_cmd("hyprshot -m window"), { description = "Take screenshot" }) hl.bind("SHIFT + Print", hl.dsp.exec_cmd("hyprshot -m region"), { description = "Take screenshot" }) -hl.bind(HYPR .. "A", dispatch_focus_or_launch({ - match = "Goose", - field = "class", - cmd = "gtk-launch goose-desktop.desktop" -}), { description = "Goose Desktop" }) - +hl.bind(HYPR .. "A", hl.dsp.exec_cmd("gtk-launch pi.desktop"), { description = "Open pi tui" }) hl.bind(HYPR .. "C", dispatch_focus_or_launch({ match = "chrome-chatgpt.com", cmd = "gtk-launch ChatGPT.desktop", @@ -434,47 +272,11 @@ hl.bind(LEADER .. "CTRL + F", hl.dsp.window.fullscreen_state({ internal = 2, cli hl.bind(LEADER .. "ALT + F", hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }), { description = "Window: Toggle fullscreen state 2" }) -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 - - local mon = 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.width * 0.8) - local max_height = math.floor(mon.height * 0.8) - local scale = math.max(1, win.size.x / max_width, win.size.y / max_height) - hl.notification.create({ - text = "Scale " .. - scale .. " Max float size: " .. win.size.x / max_width .. "x" .. win.size.y / max_height, - duration = 2000, - icon = - "hint" - }) - if scale > 1 then - hl.dispatch(hl.dsp.window.resize({ - x = math.floor(max_width), - y = math.floor(max_height), - relative = false, - window = win - })) - end -end - 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" }) +-- hl.bind(LEADER .. "P", hl.dsp.window.pseudo(), { description = "Window: Toggle pseudo tiling" }) +hl.bind(LEADER .. "P", toggle_pin, { description = "Window: Toggle Pin" }) hl.bind(LEADER .. "A", hl.dsp.window.alter_zorder({ mode = "top" }), { description = "Window: Move to top" }) @@ -498,17 +300,6 @@ hl.bind(LEADER .. "ALT + comma", function() hl.dispatch(hl.dsp.layout("cyclenext")) end, { description = "Window: Swap with prev" }) -function cycle_next_window(opts) - return function() - hl.dispatch(hl.dsp.window.cycle_next(opts)) - - local win = hl.get_active_window() - if win and win.floating then - hl.dispatch(hl.dsp.window.alter_zorder({ mode = "top" })) - end - end -end - hl.bind("ALT + Tab", cycle_next_window({ next = true }), { description = "Window: Cycle next" }) hl.bind("ALT + SHIFT + Tab", cycle_next_window({ next = false }), { description = "Window: Cycle prev" }) @@ -522,14 +313,30 @@ hl.bind(LEADER .. "M", hl.dsp.layout("swapwithmaster")) -- hl.bind(LEADER .. "M", hl.dsp.layout("rollnext")) hl.bind(LEADER .. "period", function() - hl.dispatch(hl.dsp.layout("cycleprev")) - hl.dispatch(hl.dsp.layout("swapwithmaster")) + local current_layout = hl.get_config("general.layout") + if current_layout == "master" then + hl.dispatch(hl.dsp.layout("cycleprev")) + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + + if current_layout == "scrolling" then + hl.dispatch(hl.dsp.layout("swapcol r")) + hl.dispatch(hl.dsp.layout("focus l")) + end -- hl.dispatch(hl.dsp.layout("focus r")) end, { description = "Layout: Cycle next" }) hl.bind(LEADER .. "comma", function() - hl.dispatch(hl.dsp.layout("cyclenext")) - hl.dispatch(hl.dsp.layout("swapwithmaster")) + local current_layout = hl.get_config("general.layout") + if current_layout == "master" then + hl.dispatch(hl.dsp.layout("cyclenext")) + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + + if current_layout == "scrolling" then + hl.dispatch(hl.dsp.layout("swapcol l")) + hl.dispatch(hl.dsp.layout("focus r")) + end -- hl.dispatch(hl.dsp.layout("focus l")) end, { description = "Layout: Cycle previous" }) @@ -538,7 +345,6 @@ hl.bind(LEADER .. "SHIFT + semicolon", hl.dsp.window.move({ workspace = "special { description = "Window: Move to special workspace" }) hl.bind(LEADER .. "C", hl.dsp.window.center(), { description = "Window: Center" }) - hl.bind(LEADER .. "Escape", hl.dsp.exec_raw("loginctl lock-session"), { description = "Lock screen" }) hl.bind(LEADER .. "SHIFT + escape", hl.dsp.exec_raw("systemctl suspend"), { description = "Suspend" }) hl.bind(LEADER .. "ALT + escape", hl.dsp.exec_raw("uwsm stop,"), { description = "Stop UWSM" }) @@ -565,27 +371,6 @@ hl.on("keybinds.submap", function(name) hl.notification.create({ text = "Entered submap: " .. name, duration = 2000, icon = "hint" }) end) -function window_resize_percentage(px, py) - local win = hl.get_active_window() - if win == nil or win.monitor == nil then - return - end - local mon = hl.get_monitor(win.monitor) - - if mon == nil or mon.size == nil or mon.size.height == nil or mon.size.width == nil then - return - end - local sx = math.floor(mon.size.width * px) - local sy = math.floor(mon.size.height * py) - if not win.floating then - hl.dispatch(hl.dsp.window.float({ action = "set" })) - end - if win.fullscreen then - hl.dispatch(hl.dsp.window.fullscreen({ action = "unset" })) - end - hl.dispatch(hl.dsp.window.resize({ x = sx, y = sy, relative = false })) -end - hl.bind(LEADER .. "F10", hl.dsp.submap("notification menu")) hl.define_submap("notification menu", function() hl.bind("Q", hl.dsp.exit()) @@ -686,7 +471,7 @@ hl.bind(LEADER .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) hl.bind("mouse:275", hl.dsp.window.cycle_next({ next = true }), { click = true, description = "Window: Cycle next" }) hl.bind("mouse:276", hl.dsp.window.cycle_next({ next = false }), { click = true, description = "Window: Cycle previous" }) - +-- Gestures -- hl.gesture({ fingers = 3, direction = "horizontal", action = "workspace" }) -- hl.gesture({ fingers = 3, direction = "down", mods = "ALT", action = "close" }) -- hl.gesture({ fingers = 3, direction = "up", mods = "SUPER", scale = 1.5, action = "fullscreen" }) @@ -695,113 +480,3 @@ hl.bind("mouse:276", hl.dsp.window.cycle_next({ next = false }), { click = true, -- hl.gesture({ fingers = 2, direction = "pinch", action = "cursorZoom", zoom_level = 2 }) -- hl.gesture({ fingers = 2, direction = "pinch", action = "cursorZoom", zoom_level = 1.2, mode = "mult" }) -- hl.gesture({ fingers = 2, direction = "pinch", action = "cursorZoom", zoom_level = 1, mode = "live" }) - -hl.workspace_rule({ workspace = "special:special", border_size = 3 }) -hl.window_rule({ - match = { class = "(blueberry.py|Impala|Wiremix|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float|org.pulseaudio.pavucontrol)" }, - tag = - "+floating-window" -}) - -hl.window_rule({ - match = { class = "terminal-pi" }, - float = true, - center = true, - workspace = "special:special", - size = { "monitor_w/2", "monitor_h/2" } -}) - -hl.window_rule({ - match = { class = "quicknotes" }, - tag = "+floating-window" -}) - -hl.window_rule({ - name = "ostt floating windows", - match = { class = "ostt-popup" }, - float = true, - no_anim = true, - move = { 10, 10 }, - size = { 320, 240 }, -}) - -hl.window_rule({ - match = { - class = "(xdg-desktop-portal-gtk|sublime_text|DesktopEditors)", - title = "^(Open.*Files?|Save.*Files?|Save.*As|All Files|Save)" - }, - tag = "+floating-window" -}) - -hl.window_rule({ - match = { class = "code" }, - fullscreen_state = 1, -}) - -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, -}) - - -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" }) -hl.window_rule({ match = { class = "^(pinentry-)" }, tag = "+user-menu" }) -hl.window_rule({ match = { class = "^(gcr-prompter)$" }, tag = "+user-menu" }) -hl.window_rule({ match = { tag = "user-menu" }, stay_focused = true, no_anim = true, float = true, center = true, size = { "monitor_w/3", "monitor_h/3" } }) - -hl.window_rule({ - name = "Picture in Picture windows", - match = { title = "^.*[Pp]icture[ -][Ii]n[ -][Pp]icture.*$" }, - float = true, - pin = true, - rounding = 7, - opacity = "1 1", - move = { "monitor_w-window_w-10", "monitor_h-window_h-10" }, - size = { "monitor_w/4", "monitor_h/4" }, -}) - --- Cursor size -hl.env("XCURSOR_SIZE", "24") -hl.env("HYPRCURSOR_SIZE", "24") - --- Force all apps to use Wayland -hl.env("GDK_BACKEND", "wayland,x11,*") -hl.env("QT_QPA_PLATFORM", "wayland;xcb") -hl.env("QT_STYLE_OVERRIDE", "kvantum") -hl.env("SDL_VIDEODRIVER", "wayland") -hl.env("MOZ_ENABLE_WAYLAND", "1") -hl.env("ELECTRON_OZONE_PLATFORM_HINT", "wayland") -hl.env("OZONE_PLATFORM", "wayland") -hl.env("XDG_SESSION_TYPE", "wayland") - --- Allow better support for screen sharing (Google Meet"," Discord, etc) -hl.env("XDG_CURRENT_DESKTOP", "Hyprland") -hl.env("XDG_SESSION_DESKTOP", "Hyprland") - --- Use XCompose file -hl.env("XCOMPOSEFILE", "~/.XCompose") - --- Make Chromium use XCompose and all Wayland -hl.env("CHROMIUM_FLAGS", "--enable-features=UseOzonePlatform --ozone-platform=wayland --gtk-version=4") - --- Make .desktop files available for wofi -hl.env("XDG_DATA_DIRS", "/usr/share:/usr/local/share:~/.local/share") - --- TODO: add theme link -require("theme") - -hl.on("hyprland.start", function() - hl.exec_cmd("hyprctl setcursor Pop 24") -end) diff --git a/config/hypr/monitors.lua b/config/hypr/monitors.lua new file mode 100644 index 0000000..06c21bf --- /dev/null +++ b/config/hypr/monitors.lua @@ -0,0 +1,58 @@ +hl.monitor({ output = "desc:Lenovo Group Limited 0x41A0", mode = "highrr", position = "0x0", scale = "1.0" }) +hl.monitor({ output = "desc:Samsung Display Corp. 0x4143", mode = "highrr", position = "0x0", scale = "2" }) +hl.monitor({ + output = "desc:LG Electronics LG HDR 4K 406NTZN74597", + mode = "preferred", + position = "auto-right", + scale = + "1.333333" +}) +hl.monitor({ + output = "desc:Ancor Communications Inc ASUS MG28U 0x00009B77", + mode = "preferred", + position = "auto-right", + scale = + "1.333333" +}) + +-- hl.monitor({ output = "eDP-1", mode = "preferred", position = "0x0", scale = "1.0" }) + +hl.monitor({ + output = "desc:LG Electronics LG HDR WQHD 0x0006530C", + mode = "preferred", + position = "auto-up", + scale = + "1.333333" +}) +hl.monitor({ output = "CAP Capture 0x00000001", mode = "1920x1080@60", position = "auto-down", scale = 1 }) +hl.monitor({ output = "HDMI-A-1", mode = "1920x1080@60", position = "auto-down", scale = 1 }) +hl.monitor({ output = "HDMI-A-2", mode = "1920x1080@60", position = "auto-down", scale = 1 }) + +hl.monitor({ + output = "desc:Ancor Communications Inc ASUS PB238 DCLMTF074371", + mode = "preferred", + position = "auto", + scale = + "1.0" +}) +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-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({ + output = "desc:Dell Inc. DELL U3818DW 97F8P8AD0HEL", + mode = "preferred", + position = "auto-left", + scale = + "1.0" +}) +hl.monitor({ + output = "desc:Microstep MSI MAG342CQR DB6H252300057", + mode = "preferred", + position = "auto-left", + scale = + "1.0" +}) diff --git a/config/hypr/onstart.lua b/config/hypr/onstart.lua new file mode 100644 index 0000000..d38c30b --- /dev/null +++ b/config/hypr/onstart.lua @@ -0,0 +1,3 @@ +hl.on("hyprland.start", function() + hl.exec_cmd("hyprctl setcursor Pop 24") +end) diff --git a/config/hypr/rules.lua b/config/hypr/rules.lua new file mode 100644 index 0000000..9482829 --- /dev/null +++ b/config/hypr/rules.lua @@ -0,0 +1,75 @@ +hl.workspace_rule({ workspace = "special:special", border_size = 3 }) +hl.window_rule({ + match = { class = "(blueberry.py|Impala|Wiremix|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float|org.pulseaudio.pavucontrol)" }, + tag = + "+floating-window" +}) + +hl.window_rule({ + match = { class = "terminal-pi" }, + float = true, + center = true, + workspace = "special:special", + size = { "monitor_w/2", "monitor_h/2" } +}) + +hl.window_rule({ + match = { class = "quicknotes" }, + tag = "+floating-window" +}) + +hl.window_rule({ + name = "ostt floating windows", + match = { class = "ostt-popup" }, + float = true, + no_anim = true, + move = { 10, 10 }, + size = { 320, 240 }, +}) + +hl.window_rule({ + match = { + class = "(xdg-desktop-portal-gtk|sublime_text|DesktopEditors)", + title = "^(Open.*Files?|Save.*Files?|Save.*As|All Files|Save)" + }, + tag = "+floating-window" +}) + +hl.window_rule({ + match = { class = "code" }, + fullscreen_state = 1, +}) + +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, +}) + + +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" }) +hl.window_rule({ match = { class = "^(pinentry-)" }, tag = "+user-menu" }) +hl.window_rule({ match = { class = "^(gcr-prompter)$" }, tag = "+user-menu" }) +hl.window_rule({ match = { tag = "user-menu" }, stay_focused = true, no_anim = true, float = true, center = true, size = { "monitor_w/3", "monitor_h/3" } }) + +hl.window_rule({ + name = "Picture in Picture windows", + match = { title = "^.*[Pp]icture[ -][Ii]n[ -][Pp]icture.*$" }, + float = true, + pin = true, + rounding = 7, + opacity = "1 1", + move = { "monitor_w-window_w-10", "monitor_h-window_h-10" }, + size = { "monitor_w/4", "monitor_h/4" }, +})