aboutsummaryrefslogtreecommitdiff
path: root/.config/hypr/binds.lua
blob: 0d373b0e5f4f0113eadc0b03964c430e9f8ea403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
local mainMod = "SUPER"

-- https://wiki.hypr.land/Configuring/Basics/Binds/
hl.bind(mainMod.." + Return",	hl.dsp.exec_cmd(terminal))
local closeWindowBind = hl.bind(mainMod.." + C", hl.dsp.window.close())
-- closeWindowBind:set_enabled(false)
hl.bind(mainMod.." + SHIFT + E",	hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'"))
hl.bind(mainMod.." + Space",		hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod.." + R",			hl.dsp.exec_cmd(menu))
hl.bind(mainMod.." + P",			hl.dsp.window.pseudo())

-- Move focus with mainMod + arrow keys
hl.bind(mainMod.." + H",	hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod.." + L",	hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod.." + K",	hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod.." + J",	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

-- 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" }))

-- 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 })

-- media
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 })
-- volume
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 })
-- brightness
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 })

-- screenshots
hl.bind("Print",	hl.dsp.exec_cmd("grim -g \"$(slurp)\" - | wl-copy"))