Hi. First off, I am new of this year to Linux and have only used Hyprland for 3 weeks or so, but like it and want to rice it.
I have had few problems, only icons in waybar not working until the lua change. I thought I would change to lua now, rather than continue ricing in soon obsolete hyprlang. Everything went supersmooth, following the wiki and making a new set of configs.
But the binds.lua, referenced with require() from hyprland.lua has given me a headache. Any one had similar problems or can spot the problem? Any input would be appreciated
I run CachyOS with Hyprland 0.55.1
Binds do not work and I always get the same message, even with the official config example.
require (modules.binds"): bad argument #1 to â?â (string expected, got nil)
I tried to move everything from binds.lua into hyprland.lua and then got this error message instead:
Your config has errors: bad argument #1 to â?â (string expected, got nil)
stack trackback:
[C]: in ?
[C]: in field âexec_cmdâ
(1 moreâŚ)
Also worth noting I have tried to change from UWSM-manager to Hyprland but the same result there. And somehow, the emergency shortcuts no longer works either. I have to keep my Vivaldi windows open to be able to trick myself into the terminal and file manager/kate. If I closed these now, I would be stuck I guess ![]()
hyprland.lua :
require(âmodules.monitorsâ)
require(âmodules.programsâ)
require(âmodules.bindsâ)
require(âmodules.autostartâ)
require(âmodules.envâ)
require(âmodules.decorationsâ)
require(âmodules.animationsâ)
require(âmodules.windowrulesâ)
require(âmodules.layoutâ)
require(âmodules.miscâ)
require(âmodules.inputâ)
modules/ Binds.lua
hl.exec_cmd(âdbus-update-activation-environment --systemd --allâ)
hl.exec_cmd(âsystemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOPâ)
local mainMod = âSUPERâ
local closeWindowBind = hl.bind(mainMod .. " + C", hl.dsp.window.close())
â closeWindowBind:set_enabled(false)
hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd(terminal))
â hl.bind(mainMod .. " + A", hl.dsp.exec_cmd(waybar/scripts/launch.sh))
hl.bind(mainMod .. " + A", hl.dsp.exec_cmd(âpkill waybar; waybar &â))
hl.bind(mainMod .. " + B", hl.dsp.exec_cmd(swaync-client -t))
hl.bind(mainMod .. " + D", hl.dsp.exec_cmd(menu))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd(Fullscreen))
âhl.bind(mainMod .. " + H", hl.dsp.exec_cmd(cliphist list | rofi -dmenu -display-columns 2 -p âClipboardâ -theme ~/.config/rofi/style-1.rasi | cliphist decode | wl-copy))
hl.bind(mainMod .. " + J", hl.dsp.layout(âtogglesplitâ)) â dwindle only
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd(wlogout))
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(pwvucontrol))
â Example special workspace (scratchpad)
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special(âmagicâ))
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = âspecial:magicâ }))
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd(cachyos-pi))
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = âtoggleâ }))
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd(killactive))
hl.bind(mainMod .. " + Z", hl.dsp.exec_cmd(vivaldi))
â Normal Binds :
â hl.bind(âPrintâ, hl.dsp.exec_cmd(hyprshot -m region -o ~/Pictures/Screenshots))
â To switch between windows in a floating workspace:
hl.bind(âSUPER + Tabâ, function()
hl.dispatch(hl.dsp.window.cycle_next()) â Change focus to another window
hl.dispatch(hl.dsp.window.bring_to_top()) â Bring it to the top
end)
â Move focus with mainMod + arrow keys
hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = âleftâ }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = ârightâ }))
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = âupâ }))
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = âdownâ }))
â Switch workspaces with mainMod + [0-9]
â Move active window to a workspace with mainMod + SHIFT + [0-9]
for i = 1, 10 do
local key = i % 10 â 10 maps to key 0
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i}))
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
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 })