From 2f2a851978e5731df8a241529d607d767159af14 Mon Sep 17 00:00:00 2001 From: Roy Dumblauskas Date: Sun, 14 Jun 2026 14:50:58 -0500 Subject: [PATCH] new lua hypr config --- roy-config/hypr/hyprland.conf | 272 ------------------ roy-config/hypr/hyprland.lua | 188 ++++++++++++ .../move-workspace-to-unfocused-monitor.sh | 3 - .../scripts/switch-to-unfocused-monitor.sh | 4 - 4 files changed, 188 insertions(+), 279 deletions(-) delete mode 100755 roy-config/hypr/hyprland.conf create mode 100644 roy-config/hypr/hyprland.lua delete mode 100755 roy-config/hypr/scripts/move-workspace-to-unfocused-monitor.sh delete mode 100755 roy-config/hypr/scripts/switch-to-unfocused-monitor.sh diff --git a/roy-config/hypr/hyprland.conf b/roy-config/hypr/hyprland.conf deleted file mode 100755 index 18dd14d..0000000 --- a/roy-config/hypr/hyprland.conf +++ /dev/null @@ -1,272 +0,0 @@ -# You can split this configuration into multiple files -# Create your files separately and then link them to this file like this: -# source = ~/.config/hypr/myColors.conf - - -################ -### MONITORS ### -################ - -# See https://wiki.hyprland.org/Configuring/Monitors/ -# built-in monitor -monitor=,preferred,auto,1 - -monitorv2 { - output = DP-1 - mode = 3840x2160@60 - position = auto - scale = 1.5 - transform = 0 -} - -monitorv2 { - output = HDMI-A-1 - mode = 2560x1440@59.95 - position = auto-left - scale = 1 - transform = 0 -} - -################### -### MY PROGRAMS ### -################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ - -# Set programs that you use -$terminal = alacritty -$fileManager = dolphin -$menu = wofi --show=drun --prompt="Search Programs" - - -################# -### AUTOSTART ### -################# - -# Autostart necessary processes (like notifications daemons, status bars, etc.) -# Or execute your favorite apps at launch like this: - -exec-once = $terminal -exec-once = waybar - -############################# -### ENVIRONMENT VARIABLES ### -############################# - -# See https://wiki.hyprland.org/Configuring/Environment-variables/ - -env = HYPRCURSOR_THEME,rose-pine-hyprcursor -env = HYPRCURSOR_SIZE,18 - -#################### -### SCRIPT PATHS ### -#################### - -$switchFocus = ~/.config/hypr/scripts/switch-to-unfocused-monitor.sh -$moveAndSwitch = ~/.config/hypr/scripts/move-workspace-to-unfocused-monitor.sh - -##################### -### LOOK AND FEEL ### -##################### - -# Refer to https://wiki.hyprland.org/Configuring/Variables/ - -# https://wiki.hyprland.org/Configuring/Variables/#general -general { - gaps_in = 0 - gaps_out = 0 - - border_size = 1 - - # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors - col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg - col.inactive_border = rgba(595959aa) - - # Set to true enable resizing windows by clicking and dragging on borders and gaps - resize_on_border = false - - # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on - allow_tearing = false - - layout = dwindle -} - -# https://wiki.hyprland.org/Configuring/Variables/#decoration -decoration { - rounding = 0 - - # Change transparency of focused and unfocused windows - active_opacity = 1.0 - inactive_opacity = 1.0 - - shadow { - enabled = false; - } - - # https://wiki.hyprland.org/Configuring/Variables/#blur - blur { - enabled = false; - } -} - -# https://wiki.hyprland.org/Configuring/Variables/#animations -animations { - enabled = false; - workspace_wraparound = false; -} - -# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/ -# "Smart gaps" / "No gaps when only" -# uncomment all if you wish to use that. -# workspace = w[tv1], gapsout:0, gapsin:0 -# workspace = f[1], gapsout:0, gapsin:0 -# windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1] -# windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1] -# windowrulev2 = bordersize 0, floating:0, onworkspace:f[1] -# windowrulev2 = rounding 0, floating:0, onworkspace:f[1] - -# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more -dwindle { - pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = true # You probably want this -} - -# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more -master { - new_status = master -} - -# https://wiki.hyprland.org/Configuring/Variables/#misc -misc { - force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers - disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :( -} - - -############# -### INPUT ### -############# - -# https://wiki.hyprland.org/Configuring/Variables/#input -input { - kb_layout = us - kb_variant = - kb_model = - kb_options = - kb_rules = - - follow_mouse = 1 - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. - - touchpad { - natural_scroll = false - } -} - -################### -### KEYBINDINGS ### -################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ -$mainMod = SUPER # Sets "Windows" key as main modifier - -# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, Return, exec, $terminal -bind = $mainMod, Q, killactive, -bind = $mainMod, M, exit, -bind = $mainMod, E, exec, $fileManager -bind = $mainMod, V, togglefloating, -bind = $mainMod, Space, exec, $menu -bind = $mainMod, P, togglesplit, # dwindle -bind = $mainMod SHIFT, Return, exec, firefox - -# Move focus with mainMod + hjkl -bind = $mainMod, h, movefocus, l -bind = $mainMod, l, movefocus, r -bind = $mainMod, k, movefocus, u -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 -bind = $mainMod, 0, workspace, 10 - -# 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 -bind = $mainMod SHIFT, 0, movetoworkspace, 10 - -# Move workspace to unfocused monitor (Does not currently support more than two monitors) -bind = $mainMod SHIFT, TAB, exec, sh -c $moveAndSwitch - -# Switch to unfocused monitor (Does not currently support more than two monitors) -bind = $mainMod, TAB, exec, sh -c $switchFocus - -# Rotate screen with arrows -# TODO: only works on builtin display (see scripts) -bind = $mainMod SHIFT, up, exec, hyprctl keyword monitor "eDP-1,preferred,auto,1,transform,0" -bind = $mainMod SHIFT, down, exec, hyprctl keyword monitor "eDP-1,preferred,auto,1,transform,2" -bind = $mainMod SHIFT, left, exec, hyprctl keyword monitor "eDP-1,preferred,auto,1,transform,1" -bind = $mainMod SHIFT, right, exec, hyprctl keyword monitor "eDP-1,preferred,auto,1,transform,3" - -# Screenshot to clipboard -bind = $mainMod SHIFT, S, exec, grim -g "$(slurp -d)" - | wl-copy - -# Make display fullscreen (hide the waybar) -bind = $mainMod SHIFT, f, fullscreen - -# Scroll through existing workspaces with mainMod + scroll -bind = $mainMod, mouse_down, workspace, e+1 -bind = $mainMod, mouse_up, workspace, e-1 - -# Move/resize windows with mainMod + LMB/RMB and dragging -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow - -# Laptop multimedia keys for volume and LCD brightness -bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle -bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+ -bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%- - -# Requires playerctl -bindl = , XF86AudioNext, exec, playerctl next -bindl = , XF86AudioPause, exec, playerctl play-pause -bindl = , XF86AudioPlay, exec, playerctl play-pause -bindl = , XF86AudioPrev, exec, playerctl previous - -############################## -### WINDOWS AND WORKSPACES ### -############################## - -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules - -# Example windowrule v1 -# windowrule = float, ^(kitty)$ - -# Example windowrule v2 -# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ - -# Ignore maximize requests from apps. You'll probably like this. -# windowrulev2 = suppressevent maximize, class:.* - -# Fix some dragging issues with XWayland -windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 diff --git a/roy-config/hypr/hyprland.lua b/roy-config/hypr/hyprland.lua new file mode 100644 index 0000000..884dfc2 --- /dev/null +++ b/roy-config/hypr/hyprland.lua @@ -0,0 +1,188 @@ +-- Import files +-- require("relative.path") + +-- monitors +hl.monitor({ + output = "", + mode = "preferred", + position = "auto", + scale = 1 +}) + +hl.monitor({ + output = "DP-1", + mode = "3840x2160@60", + position = "auto", + scale = 1.5 +}) + +hl.monitor({ + output = "HDMI-A-1", + mode = "2560x1440@59.95", + position = "auto-left", + scale = 1 +}) + +-- variables +local terminal = "alacritty" +local fileManager = "dolphin" +local menu = "wofi --show=drun --prompt='Search Programs'" + +-- on start +hl.on("hyprland.start", function() + hl.exec_cmd("waybar") + hl.exec_cmd(terminal) +end) + +-- env vars +hl.env("HYPRCURSOR_THEME", "rose-pine-hyprcursor") +hl.env("HYPRCURSOR_SIZE", "18") + +-- look and feel +hl.config({ + general = { + gaps_in = 0, + gaps_out = 0, + + border_size = 1, + + col = { + active_border = { colors = { "rgba(33ccffee)", "rgba(00ff99ee)" }, angle = 45 }, + inactive_border = "rgba(595959aa)" + }, + + resize_on_border = false, + allow_tearing = false, + layout = "dwindle" + }, + + decoration = { + rounding = 0, + + active_opacity = 1.0, + inactive_opacity = 1.0, + + shadow = { enabled = false }, + blur = { enabled = false } + }, + + animations = { + enabled = false + } +}) + +-- dwindle +hl.config({ + dwindle = { + preserve_split = true + } +}) + +-- master +hl.config({ + master = { + new_status = "master", + }, +}) + +-- misc +hl.config({ + force_default_wallpaper = 0, + disable_hyprland_logo = false +}) + +-- input +hl.config({ + input = { + kb_layout = "us", + kb_variant = "", + kb_model = "", + kb_options = "", + kb_rules = "", + + follow_mouse = 1, + sensitivity = 0, + + touchpad = { + natural_scroll = false + } + } +}) + +-- keybinds +local mainMod = "SUPER" + +hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal)) +hl.bind(mainMod .. " + Q", hl.dsp.window.close()) +hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager)) +hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(menu)) +hl.bind(mainMod .. " + P", hl.dsp.window.pseudo()) +hl.bind(mainMod .. " + T", hl.dsp.layout("togglesplit")) +hl.bind(mainMod .. " + M", + hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'")) + +-- move focus +hl.bind(mainMod .. "h", hl.dsp.focus({ direction = "left" })) +hl.bind(mainMod .. "j", hl.dsp.focus({ direction = "down" })) +hl.bind(mainMod .. "k", hl.dsp.focus({ direction = "up" })) +hl.bind(mainMod .. "l", hl.dsp.focus({ direction = "right" })) + +-- switch/move workspaces +for i in 1, 10 do + 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 + +-- move workspace to unfocused monitor (two monitors only) +hl.bind(mainMod .. " + TAB", function() + local toMonitor = hl.exec_cmd("hyprctl monitors -j | jq -r 'first(.[] | select(.focused == false) | .name)'") + hl.dsp.workspace.move({ monitor = toMonitor }) +end) + +-- focus on unfocused monitor (2 monitors only) +hl.bind(mainMod .. " + SHIFT + TAB", function() + local toMonitor = hl.exec_cmd("hyprctl monitors -j | jq -r 'first(.[] | select(.focused == false) | .name)'") + hl.dsp.focus({ monitor = toMonitor }) +end) + +-- 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" })) + +-- 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 }) + +-- Laptop multimedia keys for volume and LCD brightness +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), + { locked = true, repeating = true }) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), + { locked = true, repeating = true }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), + { locked = true, repeating = true }) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), + { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true }) + +-- Requires playerctl +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) +hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) + +-- Fix some dragging issues with XWayland +hl.window_rule({ + name = "fix-xwayland-drags", + match = { + class = "^$", + title = "^$", + xwayland = true, + float = true, + fullscreen = false, + pin = false, + }, + + no_focus = true, +}) diff --git a/roy-config/hypr/scripts/move-workspace-to-unfocused-monitor.sh b/roy-config/hypr/scripts/move-workspace-to-unfocused-monitor.sh deleted file mode 100755 index 4a22173..0000000 --- a/roy-config/hypr/scripts/move-workspace-to-unfocused-monitor.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -monitor=$(hyprctl monitors -j | jq -r 'first(.[] | select(.focused == false) | .name)') -hyprctl dispatch movecurrentworkspacetomonitor $monitor diff --git a/roy-config/hypr/scripts/switch-to-unfocused-monitor.sh b/roy-config/hypr/scripts/switch-to-unfocused-monitor.sh deleted file mode 100755 index 85c7bdb..0000000 --- a/roy-config/hypr/scripts/switch-to-unfocused-monitor.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -monitor=$(hyprctl monitors -j | jq -r 'first(.[] | select(.focused == false) | .name)') - -hyprctl dispatch focusmonitor $monitor