@@ -81,6 +81,12 @@ local function launch(args)
81
81
local onsuspend = args .onsuspend or function () awful .spawn .with_shell (" systemctl suspend" ) end
82
82
local onpoweroff = args .onpoweroff or function () awful .spawn .with_shell (" shutdown now" ) end
83
83
84
+ local onlogout_key = args .onlogout_key or ' l'
85
+ local onlock_key = args .onlock_key or ' k'
86
+ local onreboot_key = args .onreboot_key or ' r'
87
+ local onsuspend_key = args .onsuspend_key or ' u'
88
+ local onpoweroff_key = args .onpoweroff_key or ' s'
89
+
84
90
w :set_bg (bg_color )
85
91
if # phrases > 0 then
86
92
phrase_widget :set_markup (
@@ -92,15 +98,15 @@ local function launch(args)
92
98
phrase_widget ,
93
99
{
94
100
{
95
- create_button (' log-out' , ' Log Out (l )' ,
101
+ create_button (' log-out' , ' Log Out (' .. onlogout_key .. ' )' ,
96
102
accent_color , label_color , onlogout , icon_size , icon_margin ),
97
- create_button (' lock' , ' Lock (k )' ,
103
+ create_button (' lock' , ' Lock (' .. onlock_key .. ' )' ,
98
104
accent_color , label_color , onlock , icon_size , icon_margin ),
99
- create_button (' refresh-cw' , ' Reboot (r )' ,
105
+ create_button (' refresh-cw' , ' Reboot (' .. onreboot_key .. ' )' ,
100
106
accent_color , label_color , onreboot , icon_size , icon_margin ),
101
- create_button (' moon' , ' Suspend (u )' ,
107
+ create_button (' moon' , ' Suspend (' .. onsuspend_key .. ' )' ,
102
108
accent_color , label_color , onsuspend , icon_size , icon_margin ),
103
- create_button (' power' , ' Power Off (s )' ,
109
+ create_button (' power' , ' Power Off (' .. onpoweroff_key .. ' )' ,
104
110
accent_color , label_color , onpoweroff , icon_size , icon_margin ),
105
111
id = ' buttons' ,
106
112
spacing = 8 ,
@@ -141,14 +147,16 @@ local function launch(args)
141
147
phrase_widget :set_text (' ' )
142
148
capi .keygrabber .stop ()
143
149
w .visible = false
144
- elseif key == ' s ' then onpoweroff ()
145
- elseif key == ' r ' then onreboot ()
146
- elseif key == ' u ' then onsuspend ()
147
- elseif key == ' k ' then onlock ()
148
- elseif key == ' l ' then onlogout ()
150
+ elseif string.lower ( key ) == string.lower ( onpoweroff_key ) then onpoweroff ()
151
+ elseif string.lower ( key ) == string.lower ( onreboot_key ) then onreboot ()
152
+ elseif string.lower ( key ) == string.lower ( onsuspend_key ) then onsuspend ()
153
+ elseif string.lower ( key ) == string.lower ( onlock_key ) then onlock ()
154
+ elseif string.lower ( key ) == string.lower ( onlogout_key ) then onlogout ()
149
155
end
150
156
151
- if key == ' Escape' or string.match (" srukl" , key ) then
157
+ local all_keys = onlogout_key .. onlock_key .. onreboot_key .. onsuspend_key .. onpoweroff_key
158
+
159
+ if key == ' Escape' or string.match (all_keys , key ) then
152
160
phrase_widget :set_text (' ' )
153
161
capi .keygrabber .stop ()
154
162
w .visible = false
0 commit comments