From 6dd5b8efa510cd14096b985b940f9e9ebf99aedd Mon Sep 17 00:00:00 2001 From: Steve Beaulac Date: Tue, 26 May 2026 23:53:52 -0400 Subject: [PATCH] feat: converted hyprland cofiguration to lua --- config/hypr/.luarc.json | 7 + .../hypr/{hyprland.conf => hyprland.conf.old} | 6 +- config/hypr/hyprland.lua | 499 ++++++++++++++++++ script/hyprland-fetch-client | 3 +- script/hyprland-focus-client | 6 +- themes/catppuccin-latte/hyprland.lua | 7 + themes/catppuccin/hyprland.lua | 7 + themes/everforest/hyprland.lua | 7 + themes/gruvbox/hyprland.lua | 7 + themes/kanagawa/hyprland.lua | 7 + themes/matte-black/hyprland.lua | 7 + themes/nord/hyprland.lua | 7 + themes/osaka-jade/hyprland.lua | 7 + themes/ristretto/hyprland.lua | 7 + themes/rose-pine/hyprland.lua | 7 + themes/tokyo-night/hyprland.lua | 7 + 16 files changed, 592 insertions(+), 6 deletions(-) create mode 100644 config/hypr/.luarc.json rename config/hypr/{hyprland.conf => hyprland.conf.old} (99%) create mode 100644 config/hypr/hyprland.lua create mode 100644 themes/catppuccin-latte/hyprland.lua create mode 100644 themes/catppuccin/hyprland.lua create mode 100644 themes/everforest/hyprland.lua create mode 100644 themes/gruvbox/hyprland.lua create mode 100644 themes/kanagawa/hyprland.lua create mode 100644 themes/matte-black/hyprland.lua create mode 100644 themes/nord/hyprland.lua create mode 100644 themes/osaka-jade/hyprland.lua create mode 100644 themes/ristretto/hyprland.lua create mode 100644 themes/rose-pine/hyprland.lua create mode 100644 themes/tokyo-night/hyprland.lua diff --git a/config/hypr/.luarc.json b/config/hypr/.luarc.json new file mode 100644 index 0000000..b4ecec0 --- /dev/null +++ b/config/hypr/.luarc.json @@ -0,0 +1,7 @@ +{ + "workspace": { + "library": [ + "/usr/share/hypr/stubs" + ] + } +} diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf.old similarity index 99% rename from config/hypr/hyprland.conf rename to config/hypr/hyprland.conf.old index 6bdc433..cbf46a3 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf.old @@ -72,7 +72,7 @@ master { } dwindle { - pseudotile = yes + # pseudotile = yes preserve_split = yes smart_split = no force_split = 2 @@ -122,7 +122,7 @@ misc { enable_swallow = true enable_anr_dialog = false force_default_wallpaper = true - vfr = true + # vfr = true } xwayland { @@ -183,7 +183,7 @@ bindd = SUPER ALT, F, Full width, fullscreen, 1 bindd = SUPER, W, Close active window, killactive, bindd = SUPER, P, Pseudo window, pseudo, # dwindle bindd = SUPER, V, Toggle floating, togglefloating, -bindd = SUPER, X, Toggle split, togglesplit, # dwindle +# bindd = SUPER, X, Toggle split, togglesplit, # dwindle bindd = SUPER, A, Bring active to top, alterzorder, top bindd = SUPER, left, Move focus left, movefocus, l diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua new file mode 100644 index 0000000..4086682 --- /dev/null +++ b/config/hypr/hyprland.lua @@ -0,0 +1,499 @@ +-- require("keybinds.lua") +hl.monitor({output = "eDP-1", mode = "highrr", position = "0x0", scale = 1 }) + +hl.monitor({output = "desc:BNQ BenQ EX3203R 7CL00509019", mode = "preferred", position="auto", scale = 1 }) +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:LG Electronics LG HDR WQHD 0x0006530C", mode = "3440x1440@75.05", position = "auto-up", scale = "1.0" }) +-- hl.monitor({output = "desc:LG Electronics LG HDR WQHD 0x0006530C", mode = "preferred", position = "0x0", scale = "1.0" }) +-- hl.monitor({output = "desc:Ancor Communications Inc ASUS MG28U 0x00009B77", mode = "3840x2160@60.00", position = "auto-left", scale = "1.333333" }) + +hl.monitor({output = "desc:Lenovo Group Limited 0x41A0", mode = "preferred", position = "0x0", scale = "1.0" }) +hl.monitor({output = "desc:LG Electronics LG HDR 4K 406NTZN74597", mode = "preferred", position = "auto-left", scale = "1.333333" }) +hl.monitor({output = "desc:GWD ARZOPA 000000000000", mode = "preferred", position = "auto-left", scale = "1.0" }) +hl.monitor({output = "desc:Proteon TYPE-C 8R33926O00QS", mode = "preferred", position = "auto-right", scale = "1.0" }) +hl.monitor({output = "desc:LG Electronics LG HDR WQHD 0x0006530C", mode = "preferred", position = "auto-up", scale = "1.0" }) +hl.monitor({output = "desc:Ancor Communications Inc ASUS MG28U 0x00009B77", mode = "preferred", position = "auto-left", scale = "1.333333" }) +hl.monitor({output = "desc:Stargate Technology TYPE-C", mode = "preferred", position = "auto-right", scale = "1.0" }) + +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-right", scale = "1.0" }) +hl.monitor({output = "desc:Ancor Communications Inc ASUS PB238 DCLMTF074371", mode = "preferred", position = "auto", scale = "1.0" }) + +hl.config({ + input = { + kb_layout = "us", + kb_variant = ",qwerty", + -- kb_model = + -- kb_options = ctrl:nocaps + kb_options = "caps:ctrl_modifier,compose:ralt", + -- kb_options = compose:ralt + follow_mouse = 1, + repeat_rate = 40, + repeat_delay = 600, + + touchpad = { + natural_scroll = true, + disable_while_typing = true, + clickfinger_behavior = true, + scroll_factor = 0.7, + }, + scroll_method = 2, + + sensitivity = 0, -- -1.0 - 1.0, 0 means no modification. + }, + + ecosystem = { + no_update_news = true, + enforce_permissions = false, + }, + + general = { + gaps_in = 0, + gaps_out = 0, + border_size = 2, + allow_tearing = true, + snap = { + enabled = true + }, + col = { + active_border = { colors = { "rgba(33ccffee)", "rgba(00ff99ee)" }, angle = 45 }, + inactive_border = "rgba(595959aa)", + }, + + layout = "master" + }, + + master = { + allow_small_split = true, + mfact = 0.50, + new_status = "master", + orientation = "center", + }, + + dwindle = { + preserve_split = true, + smart_split = false, + force_split = 2, + }, + + scrolling = { + column_width = 1.0 + }, + + decoration = { + rounding = 3, + active_opacity = 1.0, + inactive_opacity = 1.0, + dim_inactive = false, + dim_special = 0.0, + dim_strength = 0.2, + + shadow = { + enabled = false, + range = 2, + render_power = 3, + color = "rgba(1a1a1aee)", + }, + + blur = { + enabled = false, + size = 3, + passes = 1, + vibrancy = 0.1696, + }, + }, + + group = { + groupbar = { + enabled = false + } + }, + + misc = { + disable_hyprland_logo = true, + disable_splash_rendering = true, + focus_on_activate = true, + mouse_move_enables_dpms = true, + animate_manual_resizes = true, + mouse_move_focuses_monitor = true, + enable_swallow = true, + enable_anr_dialog = false, + force_default_wallpaper = true, + }, + + xwayland = { + force_zero_scaling = true + }, + + animations = { + enabled = true, + + -- animation = borderangle, 1, 50, linear, loop + + -- bezier = generic, 0.05, 0.9, 0.1, 1.08 + -- bezier = almostLinear,0.5,0.5,0.75,1.0 + -- bezier = quick,0.15,0,0.1,1 + -- + -- animation = windows, 1, 3, almostLinear + -- animation = windowsOut, 1, 3, quick + -- animation = windowsIn, 1, 3, quick + -- animation = border, 1, 10, generic + -- animation = fade, 1, 3, almostLinear + -- animation = workspaces, 1, 1, quick + -- animation = layers, 1, 3, quick + + } +}) + +hl.curve( "almostLinear", { type = "bezier", points = { {0.5, 0.5}, {0.75, 1.0} } }) +hl.curve( "generic", { type = "bezier", points = { {0.5, 0.9}, {0.1, 1.08} } }) +hl.curve( "quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1.0} } }) +hl.curve( "overshoot", { type = "bezier", points = { {0.5, 0.9}, {0.1, 1.1} } } ) +hl.curve( "rubber", { type = "spring", mass = 1, stiffness = 70, dampening = 10 } ) + +hl.animation({ leaf = "windows", enabled = true, speed = 3, bezier = "almostLinear" }) +hl.animation({ leaf = "border", enabled = true, speed = 1, spring = "rubber" }) +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 + +hl.bind(LEADER .. "return", hl.dsp.exec_raw(terminal .. " tmux new -A -s main")) +hl.bind(LEADER .. "SHIFT + return", hl.dsp.exec_raw(terminal .. " nvim")) +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("rofi -show recursivebrowser"), { description = "Open finder" }) +-- hl.bind(LEADER .. "I", hl.dsp.exec_cmd(notify_cmd .. " $(~/.local/bin/sysinfo)"), { description = "Show system info" }) +hl.bind(LEADER .. "I", function () + sysinfo() +end, { description = "Show system info" }) + +-- Open rofi on first press, closes it on second +hl.bind(LEADER .. "Space", hl.dsp.exec_raw("rofi -show drun"), { release = true, description = "Open Application Menu" }) +hl.bind(LEADER .. "SHIFT + SPACE", hl.dsp.exec_cmd("~/.local/bin/hyprland-fetch-client"), { release = true, description = "Fetch client" }) +hl.bind(LEADER .. "CONTROL + SPACE", hl.dsp.exec_cmd("~/.local/bin/hyprland-focus-client"), { release = true, description = "Focus client" }) +hl.bind(LEADER .. "CONTROL + return", hl.dsp.exec_cmd("~/.local/bin/hyprland-tmux-session"), { release = true, description = "Tmux session switcher" }) + + +hl.bind(HYPR .. "V", hl.dsp.exec_cmd("pavucontrol"), { description = "Volume control" }) +hl.bind(HYPR .. "B", hl.dsp.exec_cmd("blueberry"), { description = "Bluetooth manager" }) + +hl.bind(HYPR .. "semicolon", hl.dsp.exec_cmd("~/.local/bin/bing-wallpaper"), { description = "get new wallpaper" }) + +hl.bind(HYPR .. "A", hl.dsp.exec_cmd("gtk-launch goose-desktop.desktop"), { description = "Goose Desktop" }) +hl.bind(HYPR .. "C", hl.dsp.exec_cmd(webapp .. "https://outlook.office.com/calendar/view/month"), { description = "Calendar" }) +hl.bind(HYPR .. "E", hl.dsp.exec_cmd(webapp .. "https://outlook.office.com/mail"), { description = "Email" }) +hl.bind(HYPR .. "U", hl.dsp.exec_cmd(webapp .. "https://teams.microsoft.com/v2/"), { description = "UWO Team" }) +hl.bind(HYPR .. "Y", hl.dsp.exec_cmd(webapp .. "https://youtube.com/"), { description = "YouTube" }) +hl.bind(HYPR .. "W", hl.dsp.exec_cmd(webapp .. "https://web.whatsapp.com/"), { description = "WhatsApp" }) +hl.bind(HYPR .. "G", hl.dsp.exec_cmd(webapp .. "https://www.gmail.com/"), { description = "Google" }) +hl.bind(HYPR .. "O", hl.dsp.exec_cmd(webapp .. "https://chatgpt.com"), { description = "ChatGPT" }) + +hl.bind(HYPR .. "M", hl.dsp.exec_cmd(music), { description = "Music" }) +hl.bind(HYPR .. "F", hl.dsp.exec_cmd("pcmanfm"), { description = "File Manager" }) + +hl.bind(LEADER .. "slash", + hl.dsp.exec_cmd("ROFI_PASS_BACKEND=wtype ROFI_PASS_CLIPBOARD_BACKEND=wl-clipboard ~/.local/bin/rofi-pass")) + +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { repeating = true }) +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle")) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle")) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s 10%+"), { repeating = true }) +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 10%-"), { repeating = true }) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause")) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous")) +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next")) + +hl.bind(LEADER .. "Y", hl.dsp.exec_cmd("makoctl dismiss"), { description = "Dismiss notifications" }) + + +hl.bind(LEADER .. "W", hl.dsp.window.close(), { description = "Window: Close" }) +hl.bind(LEADER .. "F", hl.dsp.window.fullscreen({mode = "fullscreen", action = "toggle"}), { description = "Window: Toggle fullscreen" }) +hl.bind(LEADER .. "CTRL + F", hl.dsp.window.fullscreen_state({internal = 2 , client = 0, action = "toggle"}), { 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 .. "P", hl.dsp.window.pseudo(), { description = "Window: Toggle pseudo tiling" }) + +hl.bind(LEADER .. "A", hl.dsp.window.alter_zorder({mode= "top"}), { description = "Window: Move to top" }) + +hl.bind(LEADER .. "left", hl.dsp.focus({ direction = "l"}), { description = "Window: Focus left" }) +hl.bind(LEADER .. "right", hl.dsp.focus({ direction = "r"}), { description = "Window: Focus right" }) +hl.bind(LEADER .. "up", hl.dsp.focus({ direction = "u"}), { description = "Window: Focus up" }) +hl.bind(LEADER .. "down", hl.dsp.focus({ direction = "d"}), { description = "Window: Focus down" }) + +hl.bind(LEADER .. "H", hl.dsp.focus({ direction = "l"}), { description = "Window: Focus left" }) +hl.bind(LEADER .. "L", hl.dsp.focus({ direction = "r"}), { description = "Window: Focus right" }) +hl.bind(LEADER .. "K", hl.dsp.focus({ direction = "u"}), { description = "Window: Focus up" }) +hl.bind(LEADER .. "J", hl.dsp.focus({ direction = "d"}), { description = "Window: Focus down" }) -- hl.bind("SUPER + H", hl.dsp.window.resize("left"), { repeating = true, description = "Window: Resize left" }) + +-- hl.bind(LEADER .. "z", hl.dsp.focus({ last = true }), { description = "Window: Focus last" }) +hl.bind(LEADER .. "Z", hl.dsp.focus({ urgent_or_last = true }), { description = "Window: Focus last" }) +hl.bind(LEADER .. "ALT + period", hl.dsp.window.swap({ next = true }), { description = "Window: Swap with next" }) +hl.bind(LEADER .. "ALT + comma", hl.dsp.window.swap({ prev = true }), { description = "Window: Swap with prev" }) + +hl.bind("ALT + Tab", hl.dsp.window.cycle_next(), { description = "Window: Cycle next" }) +hl.bind("ALT + SHIFT + Tab", hl.dsp.window.cycle_next({ next = false }), { description = "Window: Cycle prev" }) +hl.bind(LEADER .. "ALT + Tab", hl.dsp.focus({ workspace = "previous", on_current_monitor = true }), { description = "Window: Focus previous in workspace" }) + +-- arrange split ratio +hl.bind(LEADER .. "X", hl.dsp.layout("mfact exact 0.7")) +hl.bind(LEADER .. "equal", hl.dsp.layout("mfact exact 0.5")) +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("cyclenext")) + -- hl.dispatch(hl.dsp.layout("focus r")) +end) + +hl.bind(LEADER .. "comma", function() + hl.dispatch(hl.dsp.layout("cycleprev")) + -- hl.dispatch(hl.dsp.layout("focus l")) +end) + +hl.bind(LEADER .. "semicolon", hl.dsp.workspace.toggle_special("special")) +hl.bind(LEADER .. "SHIFT + semicolon", hl.dsp.window.move({ workspace = "special:special", follow = false}), { 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" }) +hl.bind(LEADER .. "CTRL + escape", hl.dsp.exec_raw("reboot"), { description = "Reboot" }) +hl.bind(LEADER .. "SHIFT + CTRL + escape", hl.dsp.exec_raw("systemctl poweroff"), { description = "Power off" }) + +-- hl.bind("SUPER + L", hl.dsp.window.resize("right"), { repeating = true, description = "Window: Resize right" }) +-- hl.bind("SUPER + J", hl.dsp.window.resize("down"), { repeating = true, description = "Window: Resize down" }) +-- hl.bind("SUPER + K", hl.dsp.window.resize("up"), { repeating = true, description = "Window: Resize up" }) + +-- # Change Workspace Mode +-- +-- bind = SUPER SHIFT, X, workspaceopt, allfloat +-- bind = SUPER SHIFT, X, exec, $notifycmd "Toggled All Float Mode" + +-- bind = SUPER SHIFT, Z, workspaceopt, allpseudo +-- bind = SUPER SHIFT, Z, exec, $notifycmd "Toggled All Pseudo Mode" + +hl.on("keybinds.submap", function(name) + if name == "" then + hl.notification.create({ text = "Exited submap", duration = 2000, icon = "hint" }) + return + end + 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()) + hl.bind("S", function() + hl.dispatch(hl.dsp.exec_cmd("makoctl -a do-not-disturb")) + hl.dispatch(hl.dsp.submap("reset")) + end) + hl.bind("N", function() + hl.dispatch(hl.dsp.exec_cmd("makoctl -r do-not-disturb")) + hl.dispatch(hl.dsp.submap("reset")) + end) + + hl.bind("M", function() + hl.dispatch(hl.dsp.exec_cmd("hyprland-toggle-monitor eDP-1")) + hl.dispatch(hl.dsp.submap("reset")) + end) + hl.bind("escape", hl.dsp.submap("reset")) + hl.bind("catchall", hl.dsp.submap("reset")) +end) + +hl.bind(HYPR .. "Z", hl.dsp.submap("passthru")) +hl.define_submap("passthru", function() + hl.bind("escape", hl.dsp.submap("reset")) +end) + +hl.bind(LEADER .. "F9", hl.dsp.submap("resize")) +hl.define_submap("resize", function() + hl.bind("period", hl.dsp.window.resize({ x = 10, y = 10, relative = true}), { repeating = true }) + hl.bind("comma", hl.dsp.window.resize({ x = -10, y = -10, relative = true}), { repeating = true }) + hl.bind("R", function() + window_resize_percentage(0.5, 0.5) + end) + hl.bind("S", function() + window_resize_percentage(0.25, 0.25) + end) + hl.bind("D", function() + window_resize_percentage(0.7, 0.96) + hl.dispatch(hl.dsp.window.center()) + end) + hl.bind("C", hl.dsp.window.center()) + hl.bind("P", hl.dsp.window.pin()) + hl.bind("up", hl.dsp.window.move({ direction = "up" })) + hl.bind("down", hl.dsp.window.move({ direction = "down" })) + hl.bind("left", hl.dsp.window.move({ direction = "left" })) + hl.bind("right", hl.dsp.window.move({ direction = "right" })) + hl.bind("escape", hl.dsp.submap("reset")) + hl.bind("catchall", hl.dsp.submap("reset")) +end) + +hl.bind(LEADER .. "tab", hl.dsp.focus({ monitor = "+1"}), { description = "Monitor: move focus to next monitor" }) + +hl.bind(LEADER .. "SHIFT + comma", hl.dsp.window.move({ workspace = "-1" }), { description = "Window: Move to previous workspace" }) +hl.bind(LEADER .. "SHIFT + period", hl.dsp.window.move({ workspace = "+1"}), { description = "Window: Move to next workspace" }) + +hl.bind(LEADER .. "CONTROL + comma", hl.dsp.workspace.move({ monitor = "-1" }), { description = "Window: Move to previous workspace and follow" }) +hl.bind(LEADER .. "CONTROL + period", hl.dsp.workspace.move({ monitor = "+1" }), { description = "Window: Move to next workspace and follow" }) + +local workspaceGroupSize = 10 +local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 } + +function workspace_in_group(i) + local curr = hl.get_active_workspace().id + local newVal = math.floor((curr - 1) / workspaceGroupSize) * workspaceGroupSize + i + return newVal +end + +for i = 1, 10 do + hl.bind(LEADER .. "CONTROL + code:" .. numberkey[i], function() + hl.dispatch(hl.dsp.workspace.move({ monitor = "+1", workspace = workspace_in_group(i), follow = true })) + end) +end + +for i = 1, 10 do + hl.bind(LEADER .. "SHIFT + code:" .. numberkey[i], function() + hl.dispatch(hl.dsp.window.move({ workspace = workspace_in_group(i), follow = true})) + end) +end + +for i = 1, 10 do + hl.bind(LEADER .. "code:" .. numberkey[i], function() + hl.dispatch(hl.dsp.focus({ workspace = workspace_in_group(i), on_current_monitor = true })) + end, { description = "Workspace: Focus " .. i }) +end + +-- Scroll through existing workspaces with mainMod + scroll +hl.bind(LEADER .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) +hl.bind(LEADER .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) + +-- Move/resize windows with mainMod + LMB/RMB and dragging +hl.bind(LEADER .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(LEADER .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) +hl.bind("mouse:275", hl.dsp.exec_cmd("wl-copy $(wl-paste -p)"), { mouse = true}) +hl.bind("mouse:276", hl.dsp.exec_cmd("wtype -M ctrl -M shift v -m ctrl -m shift"), { mouse = true }) + +-- 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" }) +-- hl.gesture({ fingers = 3, direction = "left", scale = 1.5, action = "float" }) +-- +-- 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 = "(xdg-desktop-portal-gtk|sublime_text|DesktopEditors)", + title = "^(Open.*Files?|Save.*Files?|Save.*As|All Files|Save)" +}, tag = "+floating-window"}) + +hl.window_rule({match = { tag = "floating-window" }, float = true, center = true, size = { 800, 600 }}) + +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 = { 600, 400 }}) + +-- 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("dbus-update-activation-environment --systemd --all") + hl.exec_cmd("systemctl --user start hyprpolkitagent") + + hl.exec_cmd("hyprctl setcursor Pop 24") + hl.exec_cmd("hypridle") + hl.exec_cmd("mako") + -- hl.exec_cmd("fxitx5") + hl.exec_cmd("udiskie -a -n -T &") + hl.exec_cmd("awww-daemon") + + hl.exec_cmd("gnome-keyring-daemon --replace --daemonize --components=pkcs11,secrets,gpg") + -- hl.exec_cmd("systemctl --user import-environment $(env | cut -d'=' -f 1)") + hl.exec_cmd("systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS LANG PATH") +end) diff --git a/script/hyprland-fetch-client b/script/hyprland-fetch-client index 645345f..c95b5a9 100755 --- a/script/hyprland-fetch-client +++ b/script/hyprland-fetch-client @@ -5,4 +5,5 @@ workspace=$(hyprctl activeworkspace -j | jq -r '.id') selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.value.title)\\\t\(.value.class)::\(.value.address)"' | $chooser -p 'Client to Fetch') #address=$(hyprctl clients -j | jq -r "to_entries | .[] | select(.value.title == \"$selected\") | \"\(.value.address)\"") address=$(echo "$selected" | awk -F '::' '{print $NF}') -hyprctl dispatch movetoworkspace "$workspace,address:$address" +#hyprctl dispatch movetoworkspace "$workspace,address:$address" +hyprctl dispatch "hl.dsp.window.move({workspace = $workspace, follow = true, window = \"address:$address\"})" diff --git a/script/hyprland-focus-client b/script/hyprland-focus-client index c3b2dff..cfd348a 100755 --- a/script/hyprland-focus-client +++ b/script/hyprland-focus-client @@ -6,5 +6,7 @@ address=$(echo $selected | awk -F'::' '{print $NF}') #address=$(hyprctl clients -j | jq -r "to_entries | .[] | select(.value.title == '$selected') | \"\(.value.address)\"") json=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$address\")") workspace=$(echo $json | jq -r '.workspace.id') -hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace" -hyprctl dispatch focuswindow "address:$address" +hyprctl dispatch "hl.dsp.focus({workspace = $workspace , on_current_monitor = true})" +hyprctl dispatch "hl.dsp.focus({ window = \"address:$address\" })" +#hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace" +#hyprctl dispatch focuswindow "address:$address" diff --git a/themes/catppuccin-latte/hyprland.lua b/themes/catppuccin-latte/hyprland.lua new file mode 100644 index 0000000..29a10e5 --- /dev/null +++ b/themes/catppuccin-latte/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(1e66f5)" + } + } +}) diff --git a/themes/catppuccin/hyprland.lua b/themes/catppuccin/hyprland.lua new file mode 100644 index 0000000..c18dcda --- /dev/null +++ b/themes/catppuccin/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(c6d0f5)" + } + } +}) diff --git a/themes/everforest/hyprland.lua b/themes/everforest/hyprland.lua new file mode 100644 index 0000000..f076137 --- /dev/null +++ b/themes/everforest/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(d3c6aa)" + } + } +}) diff --git a/themes/gruvbox/hyprland.lua b/themes/gruvbox/hyprland.lua new file mode 100644 index 0000000..adb0c10 --- /dev/null +++ b/themes/gruvbox/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = { colors = {"rgb(a89984)", "rgb(fabd2f)" }, angle = 45 } + } + } +}) diff --git a/themes/kanagawa/hyprland.lua b/themes/kanagawa/hyprland.lua new file mode 100644 index 0000000..a6321fb --- /dev/null +++ b/themes/kanagawa/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(dcd7ba)" + } + } +}) diff --git a/themes/matte-black/hyprland.lua b/themes/matte-black/hyprland.lua new file mode 100644 index 0000000..278b9d2 --- /dev/null +++ b/themes/matte-black/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(8A8A8D)" + } + } +}) diff --git a/themes/nord/hyprland.lua b/themes/nord/hyprland.lua new file mode 100644 index 0000000..ca3bc50 --- /dev/null +++ b/themes/nord/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(D8DEE9)" + } + } +}) diff --git a/themes/osaka-jade/hyprland.lua b/themes/osaka-jade/hyprland.lua new file mode 100644 index 0000000..189e862 --- /dev/null +++ b/themes/osaka-jade/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(71CEAD)" + } + } +}) diff --git a/themes/ristretto/hyprland.lua b/themes/ristretto/hyprland.lua new file mode 100644 index 0000000..f3508cb --- /dev/null +++ b/themes/ristretto/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(e6d9db)" + } + } +}) diff --git a/themes/rose-pine/hyprland.lua b/themes/rose-pine/hyprland.lua new file mode 100644 index 0000000..41407c8 --- /dev/null +++ b/themes/rose-pine/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = "rgb(575279)" + } + } +}) diff --git a/themes/tokyo-night/hyprland.lua b/themes/tokyo-night/hyprland.lua new file mode 100644 index 0000000..3110dae --- /dev/null +++ b/themes/tokyo-night/hyprland.lua @@ -0,0 +1,7 @@ +hl.config({ + general = { + col = { + active_border = { colors = {"rgba(33ccffee)", "rgba(00ff99ee)" }, angle = 45 } + } + } +})