aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/components/keybinds/global.lua
blob: 56e4ea03c8f49911b2ef41ddc4e9f4a42dfc8108 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
local awful = require "awful"
local gears = require "gears"
local naughty = require "naughty"
local hkp = require "awful.hotkeys_popup.widget"
local vars = require "themes.prismite.vars"

local labels = {
    Control          = "Ctrl",
    Mod1             = "Alt",
    ISO_Level3_Shift = "Alt Gr",
    Mod4             = "Super",
    Insert           = "Ins",
    Delete           = "Del",
    Next             = "PgDn",
    Prior            = "PgUp",
    Left             = "",
    Up               = "",
    Right            = "",
    Down             = "",
    KP_End           = "Num1",
    KP_Down          = "Num2",
    KP_Next          = "Num3",
    KP_Left          = "Num4",
    KP_Begin         = "Num5",
    KP_Right         = "Num6",
    KP_Home          = "Num7",
    KP_Up            = "Num8",
    KP_Prior         = "Num9",
    KP_Insert        = "Num0",
    KP_Delete        = "Num.",
    KP_Divide        = "Num/",
    KP_Multiply      = "Num*",
    KP_Subtract      = "Num-",
    KP_Add           = "Num+",
    KP_Enter         = "NumEnter",
    -- Some "obvious" entries are necessary for the Escape sequence
    -- and whitespace characters:
    Escape           = "Esc",
    Tab              = "Tab",
    space            = "Space",
    Return           = "Enter",
    -- Dead keys aren't distinct from non-dead keys because no sane
    -- layout should have both of the same kind:
    dead_acute       = "´",
    dead_circumflex  = "^",
    dead_grave       = "`",
    -- Basic multimedia keys:
    XF86MonBrightnessUp   = "🔆+",
    XF86MonBrightnessDown = "🔅-",
    XF86AudioRaiseVolume = "ﱛ",
    XF86AudioLowerVolume = "ﱜ",
    XF86AudioMute = "ﱝ",
    XF86AudioPlay = "⏯",
    XF86AudioPrev = "⏮",
    XF86AudioNext = "⏭",
    XF86AudioStop = "⏹",
}

local globalkeys = gears.table.join(
    -- awesome
    awful.key {
        modifiers = { modkey, "Control" }, 
        key = "r", 
        on_press = awesome.restart,
        group = "awesome",
        description = "restart awesome"
    },
    awful.key {
        modifiers = { modkey, "Control" },
        key = "s",
        on_press = function()
            hkp.new {
                shape = vars.shape,
                modifiers_fg = "#8893a5",
                labels = labels
            }:show_help()
        end,
        group = "awesome",
        description = "toggle help"
    },

    -- general
    awful.key {
        modifiers = {},
        key = "XF86AudioMute",
        on_press = function()
            naughty.notification {
                message = "mute"
            }
        end,
        group = "general",
        description = "mute audio"
    },

    -- launcher
    awful.key {
        modifiers = { modkey }, 
        key = "Return", 
        on_press = function () 
            awful.spawn("kitty")
        end,
        group = "launcher",
        description = "launch kitty"
    },

    -- client
    awful.key {
        modifiers = { modkey, "Control" }, 
        key = "q", 
        on_press = function()
            local c = client.focus
            if c then
                c:kill()
            end
        end,
        group = "client",
        description = "kill client"
    },
    awful.key {
        modifiers = { modkey, "Control" }, 
        key = "f", 
        on_press = function()
            local c = client.focus
            if c then
                c.fullscreen = not c.fullscreen
            end
        end,
        group = "client",
        description = "toggle fullscreen"
    },

    -- tag
    awful.key {
        modifiers = { modkey }, 
        key = "Up", 
        on_press = awful.tag.viewprev,
        group = "tag",
        description = "switch to previous tag"
    },
    awful.key {
        modifiers = { modkey }, 
        key = "Down", 
        on_press = awful.tag.viewnext,
        group = "tag",
        description = "switch to next tag"
    }
)

root.keys(globalkeys)