From 1b92e31848743bdac6ed45627478000bdded63dd Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 5 Oct 2026 23:52:33 +0200 Subject: [PATCH] hyprland: migrate to lua --- hypr/hyprland.conf | 223 --------------------------------------------- hypr/hyprland.lua | 220 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+), 223 deletions(-) delete mode 100644 hypr/hyprland.conf create mode 100644 hypr/hyprland.lua diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf deleted file mode 100644 index ad4af35..0000000 --- a/hypr/hyprland.conf +++ /dev/null @@ -1,223 +0,0 @@ - -# Variables -# ----------------------------------------- - -# monitors -$mainMonitor=DP-2 -$secondMonitor=HDMI-A-1 - -# colors -$color_border = rgb(1a1c2d) -$color_active_border = $color_border -$color_inactive_border = $color_border - -# Set programs that you use -$terminal = ghostty -$menu = rofi -show drun -$run_prog = rofi -show run -$screenshot = grim -g "$(slurp)" - | wl-copy -$focusOrStart = .config/hypr/scripts/focus-or-start.sh - -# Settings -# ----------------------------------------- - -# Some default env vars. -env = XCURSOR_THEME,Qogir -env = XCURSOR_SIZE,24 -env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that -env = WLR_NO_HARDWARE_CURSORS,1 - -## Nvidia stuff -env = LIBVA_DRIVER_NAME,nvidia -env = __GLX_VENDOR_LIBRARY_NAME,nvidia - -general { - gaps_in = 0,0,-1,-1 - gaps_out = -1 - border_size = 1 - col.active_border = $color_active_border - col.inactive_border = $color_inactive_border - layout = dwindle - allow_tearing = false - resize_on_border = false -} - -input { - kb_layout = pnx-us-se - # kb_variant = - # kb_model = - # kb_options = - # kb_rules = - - follow_mouse = 1 - accel_profile = flat - force_no_accel = true -} - -cursor { - no_hardware_cursors = true - enable_hyprcursor = true - - # Dont hide my cursor! - hide_on_key_press = false -} - -decoration { - rounding = 0 - active_opacity = 1.0 - inactive_opacity = 1.0 - dim_inactive = false - dim_strength = 0.1 - - blur { - enabled = true - size = 4 - passes = 2 - popups = true - ignore_opacity = false - } - - shadow { - enabled = false - } -} - -animations { - enabled = yes - animation = windows, 1, 2, default - animation = border, 0 - animation = borderangle, 0 - animation = fade, 1, 1, default - animation = workspaces, 1, 2, default -} - -dwindle { - preserve_split = true - precise_mouse_move = true -} - -misc { - # disable the anime mascot wallpapers - force_default_wallpaper = 0 - # Disable hyperland logo and splash - disable_hyprland_logo = true - disable_splash_rendering = true - # Set background color instead. - background_color = 0x000000 - # Disable autoreload as i can reload myself. - disable_autoreload = true -} - -debug { - overlay = false - disable_logs = false -} - -ecosystem { - no_update_news = true - no_donation_nag = true -} - -# Monitors -# ----------------------------------------- - -# See https://wiki.hyprland.org/Configuring/Monitors/ -#monitor=,preferred,auto,auto -monitor=$mainMonitor,preferred,0x0,1 -monitor=$secondMonitor,1920x1080@60,760x-1080,1 - -# Workspaces and windows -# ----------------------------------------- - -workspace = 1,monitor:$mainMonitor,default:true -workspace = 2,monitor:$mainMonitor,default:true -workspace = 3,monitor:$mainMonitor,default:true -workspace = 4,monitor:$mainMonitor,default:true -workspace = 5,monitor:$secondMonitor,persistent:true,default:true - -windowrule = match:float 1, opacity 0.9 -windowrule = match:class firefox, workspace 2 -windowrule = match:class class:org.telegram.desktop.*, workspace 5 - -layerrule { - name = dim - match:namespace = ^rofi$ - dim_around = on -} - -# Keybinds -# ----------------------------------------- - -$mainMod = SUPER - -# programs -bind = $mainMod, D, exec, $menu -bind = $mainMod, P, exec, $run_prog -bind = $mainMod, Return, exec, $terminal -bind = $mainMod, T, exec, $focusOrStart "telegram" "org.telegram" -bind = $mainMod, G, exec, $focusOrStart "vivaldi-stable" "vivaldi-stable" -bind = $mainMod, S, exec, $screenshot - -# Windows -bind = $mainMod, X, killactive, -bind = $mainMod, F, togglefloating, - -# Move focus with mainMod + arrow keys -bind = $mainMod, left, movefocus, l -bind = $mainMod, H, movefocus, l -bind = $mainMod, right, movefocus, r -bind = $mainMod, L, movefocus, r -bind = $mainMod, up, movefocus, u -bind = $mainMod, K, movefocus, u -bind = $mainMod, down, movefocus, d -bind = $mainMod, J, movefocus, d - -# Switch workspaces with mainMod + [0-9] -bind = $mainMod, 1, workspace, 1 -bind = $mainMod, 2, workspace, 2 -bind = $mainMod, 3, workspace, 3 -bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -# bind = $mainMod, 6, workspace, 6 -# bind = $mainMod, 7, workspace, 7 -# bind = $mainMod, 8, workspace, 8 -# bind = $mainMod, 9, workspace, 9 - -# Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = $mainMod SHIFT, 1, movetoworkspace, 1 -bind = $mainMod SHIFT, 2, movetoworkspace, 2 -bind = $mainMod SHIFT, 3, movetoworkspace, 3 -bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -# bind = $mainMod SHIFT, 6, movetoworkspace, 6 -# bind = $mainMod SHIFT, 7, movetoworkspace, 7 -# bind = $mainMod SHIFT, 8, movetoworkspace, 8 -# bind = $mainMod SHIFT, 9, movetoworkspace, 9 - -# Example special workspace (scratchpad) -#bind = $mainMod, S, togglespecialworkspace, magic -#bind = $mainMod SHIFT, S, movetoworkspace, special:magic - -# Move/resize windows with mainMod + LMB/RMB and dragging -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow - -# Autostart -# ------------- - -# Hyprland apps -exec-once=hypridle - -# set wallpaper -exec-once=hyprpaper - -# Bar -exec-once=waybar - -# Notifier -exec-once=dunst - -# Programs -exec-once=nm-applet -exec-once=nextcloud -exec-once=telegram diff --git a/hypr/hyprland.lua b/hypr/hyprland.lua new file mode 100644 index 0000000..0ed7033 --- /dev/null +++ b/hypr/hyprland.lua @@ -0,0 +1,220 @@ +-- Hyprland 0.56.2 Lua configuration, migrated from hyprland.conf. + +-- Variables +-- ----------------------------------------- + +-- Monitors +local mainMonitor = "DP-2" +local secondMonitor = "HDMI-A-1" + +-- Programs +local terminal = "ghostty" +local menu = "rofi -show drun" +local runProgram = "rofi -show run" +local screenshot = 'grim -g "$(slurp)" - | wl-copy' + +-- Theme +local borderColor = "rgb(1a1c2d)" + +local kb_super = "SUPER" + +-- Autostart programs +local autostart = { + "hypridle", + "hyprpaper", + "waybar", + "dunst", + "nm-applet", + "nextcloud", + "telegram", +} + +-- Scripts +local focusOrStart = ".config/hypr/scripts/focus-or-start.sh" + +-- Environment +-- ----------------------------------------- + +hl.env("XCURSOR_THEME", "Qogir") +hl.env("XCURSOR_SIZE", "24") +hl.env("QT_QPA_PLATFORMTHEME", "qt5ct") +hl.env("WLR_NO_HARDWARE_CURSORS", "1") +hl.env("LIBVA_DRIVER_NAME", "nvidia") +hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia") + +-- Settings +-- ----------------------------------------- + +hl.config({ + general = { + gaps_in = { top = 0, right = 0, bottom = -1, left = -1 }, + gaps_out = -1, + border_size = 1, + col = { + active_border = borderColor, + inactive_border = borderColor, + }, + layout = "dwindle", + allow_tearing = false, + resize_on_border = false, + }, + input = { + kb_layout = "pnx-us-se", + follow_mouse = 1, + accel_profile = "flat", + force_no_accel = true, + }, + cursor = { + no_hardware_cursors = true, + enable_hyprcursor = true, + hide_on_key_press = false, + }, + decoration = { + rounding = 0, + active_opacity = 1.0, + inactive_opacity = 1.0, + dim_inactive = false, + dim_strength = 0.1, + blur = { + enabled = true, + size = 4, + passes = 2, + popups = true, + ignore_opacity = false, + }, + shadow = { + enabled = false, + }, + }, + animations = { + enabled = true, + }, + dwindle = { + preserve_split = true, + precise_mouse_move = true, + }, + misc = { + force_default_wallpaper = 0, + disable_hyprland_logo = true, + disable_splash_rendering = true, + background_color = 0x000000, + disable_autoreload = true, + }, + debug = { + overlay = false, + disable_logs = false, + }, + ecosystem = { + no_update_news = true, + no_donation_nag = true, + }, +}) + +hl.animation({ leaf = "windows", enabled = true, speed = 2, bezier = "default" }) +hl.animation({ leaf = "border", enabled = false }) +hl.animation({ leaf = "borderangle", enabled = false }) +hl.animation({ leaf = "fade", enabled = true, speed = 1, bezier = "default" }) +hl.animation({ leaf = "workspaces", enabled = true, speed = 2, bezier = "default" }) + +-- Monitors +-- ----------------------------------------- + +hl.monitor({ + output = mainMonitor, + mode = "preferred", + position = "0x0", + scale = 1, +}) + +hl.monitor({ + output = secondMonitor, + mode = "1920x1080@60", + position = "760x-1080", + scale = 1, + reserved_area = 25, +}) + +-- Workspaces and windows +-- ----------------------------------------- + +for workspace = 1, 4 do + hl.workspace_rule({ + workspace = tostring(workspace), + monitor = mainMonitor, + default = true, + }) +end + +hl.workspace_rule({ + workspace = "5", + monitor = secondMonitor, + persistent = true, + default = true, +}) + +hl.window_rule({ + match = { float = true }, + opacity = 0.9, +}) + +hl.window_rule({ + match = { class = "firefox" }, + workspace = "2", +}) + +hl.window_rule({ + match = { class = "org.telegram.desktop.*" }, + workspace = "5", +}) + +hl.layer_rule({ + name = "dim", + match = { namespace = "^rofi$" }, + dim_around = true, +}) + +-- Keybindings +-- ----------------------------------------- + +hl.bind(kb_super .. " + D", hl.dsp.exec_cmd(menu)) +hl.bind(kb_super .. " + P", hl.dsp.exec_cmd(runProgram)) +hl.bind(kb_super .. " + Return", hl.dsp.exec_cmd(terminal)) +hl.bind(kb_super .. " + T", hl.dsp.exec_cmd(focusOrStart .. ' "telegram" "org.telegram"')) +hl.bind(kb_super .. " + G", hl.dsp.exec_cmd(focusOrStart .. ' "vivaldi-stable" "vivaldi-stable"')) +hl.bind(kb_super .. " + S", hl.dsp.exec_cmd(screenshot)) + +hl.bind(kb_super .. " + X", hl.dsp.window.close()) +hl.bind(kb_super .. " + F", hl.dsp.window.float({ action = "toggle" })) + +local focusBindings = { + { "left", "left" }, + { "H", "left" }, + { "right", "right" }, + { "L", "right" }, + { "up", "up" }, + { "K", "up" }, + { "down", "down" }, + { "J", "down" }, +} + +for _, binding in ipairs(focusBindings) do + hl.bind(kb_super .. " + " .. binding[1], hl.dsp.focus({ direction = binding[2] })) +end + +for workspace = 1, 5 do + hl.bind(kb_super .. " + " .. workspace, hl.dsp.focus({ workspace = workspace })) + hl.bind(kb_super .. " + SHIFT + " .. workspace, + hl.dsp.window.move({ workspace = workspace, follow = true })) +end + +hl.bind(kb_super .. " + mouse:272", hl.dsp.window.drag()) +hl.bind(kb_super .. " + mouse:273", hl.dsp.window.resize()) + +-- Autostart (once per Hyprland session, not on config reload) +-- ----------------------------------------- + +hl.on("hyprland.start", function() + for _, command in ipairs(autostart) do + hl.exec_cmd(command) + end +end)