aboutsummaryrefslogtreecommitdiff
path: root/flavors/linux-hyprland/.config/hypr/keybindings.lua
blob: 082d29923a22cbe9844c72ad4adf9e4680a27afc (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
local common = require("common")
local programs = common.programs

local mainMod = "SUPER" -- Sets "Windows" key as main modifier

hl.bind(mainMod .. " + CONTROL + D", function() common.setActiveWorkspaceLayout(common.layouts.dwindle) end)
hl.bind(mainMod .. " + CONTROL + M", function() common.setActiveWorkspaceLayout(common.layouts.master) end)
hl.bind(mainMod .. " + CONTROL + S", function() common.setActiveWorkspaceLayout(common.layouts.scrolling) end)
hl.bind(mainMod .. " + CONTROL + N", function() common.setActiveWorkspaceLayout(common.layouts.monocle) end)

-- --- lanzadores / apps (dmenu, st, slock, plumb) ---
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(programs.launcher))
hl.bind(mainMod .. " + SHIFT + Return", hl.dsp.exec_cmd(programs.terminal))
hl.bind("ALT + CTRL + L", hl.dsp.exec_cmd("hyprlock"))
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("plumb"))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(programs.fileManager))
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd(programs.browser))

-- --- foco / ventanas (focusstack, killclient, togglefloating) ---
hl.bind(mainMod .. " + J", common.ifLayoutOrElseDispatch({ common.layouts.monocle }, hl.dsp.layout("cyclenext"), hl.dsp.window.cycle_next({ next = true })))
hl.bind(mainMod .. " + K", common.ifLayoutOrElseDispatch({ common.layouts.monocle }, hl.dsp.layout("cycleprev"), hl.dsp.window.cycle_next({ next = false })))
hl.bind(mainMod .. " + SHIFT + C", hl.dsp.window.close())
hl.bind(mainMod .. " + SHIFT + Space", hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod .. " + Tab", hl.dsp.focus({ last = true }))
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())

-- --- master
hl.bind(mainMod .. " + I", common.ifLayoutDispatch(common.layouts.master, hl.dsp.layout("addmaster")))
hl.bind(mainMod .. " + D", common.ifLayoutDispatch(common.layouts.master, hl.dsp.layout("removemaster")))
hl.bind(mainMod .. " + H", common.ifLayoutDispatch(common.layouts.master, hl.dsp.layout("mfact -0.05")))
hl.bind(mainMod .. " + L", common.ifLayoutDispatch(common.layouts.master, hl.dsp.layout("mfact +0.05")))
hl.bind(mainMod .. " + Return", common.ifLayoutDispatch(common.layouts.master, hl.dsp.layout("swapwithmaster")))

-- --- dwidle
hl.bind(mainMod .. " + SHIFT + J", common.ifLayoutDispatch(common.layouts.dwindle, hl.dsp.layout("togglesplit")))

-- closeWindowBind:set_enabled(false)
hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'"))

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

-- multimonitor
hl.bind(mainMod .. " + comma",         hl.dsp.focus({ monitor = "-" }))
hl.bind(mainMod .. " + period",        hl.dsp.focus({ monitor = "+" }))
hl.bind(mainMod .. " + SHIFT + comma", hl.dsp.workspace.move({ monitor = "-" }))
hl.bind(mainMod .. " + SHIFT + period",hl.dsp.workspace.move({ monitor = "+" }))

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

-- --- mover/redimensionar con ratón (tus binds de ClkClientWin) ---
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(),               { mouse = true }) -- Button1 movemouse
hl.bind(mainMod .. " + mouse:274", hl.dsp.window.float({ action = "toggle" }))            -- Button2 togglefloating
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(),             { mouse = true }) -- Button3 resizemouse


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

-- Gamemode
hl.bind(mainMod .. " + F1", function ()
    local game_mode = (hl.get_config("animations.enabled") == false)

    if game_mode then
        hl.exec_cmd("hyprctl reload")
        return
    end

    hl.config({
        -- general = {
        --     gaps_in = 0, gaps_out = 0, -- Disable gaps
        -- },

        animations = {
            enabled = false, -- Disable animations
        },

        -- Disable blur, shadow and window rounding
        decoration = {
            shadow = { enabled = false },
            blur = { enabled = false },
            rounding = 0,
        }
    })
end)

-- Waybar. Hide / show
hl.bind(mainMod .. " + F2", hl.dsp.exec_cmd("killall -SIGUSR1 waybar"))