Add screen locking hotkey + config and default to i3lock-color (i3lock)

This commit is contained in:
Alice Gaudon 2019-08-17 14:57:19 +02:00
parent 12668472f8
commit 41e377b06c
3 changed files with 25 additions and 5 deletions

View File

@ -14,6 +14,7 @@ By default, Simple Awesome uses
- `playerctl` - enables global media control. If not present on your system, only Spotify will work. - `playerctl` - enables global media control. If not present on your system, only Spotify will work.
- `network-manager-applet` (`nm-applet`) - network control "widget" **for `NetworkManager` only**. If present on your system, we will automatically run it. - `network-manager-applet` (`nm-applet`) - network control "widget" **for `NetworkManager` only**. If present on your system, we will automatically run it.
- `i3lock-color` - lock your screen in a simple and elegant way
## To do ## To do

View File

@ -23,6 +23,10 @@ config.awesome = {
application_launcher_check = "rofi -version", application_launcher_check = "rofi -version",
application_launcher = "rofi -show run -config " .. awful.util.getdir("config") .. "/assets/rofi/themes/paper-float.rasi", application_launcher = "rofi -show run -config " .. awful.util.getdir("config") .. "/assets/rofi/themes/paper-float.rasi",
-- Screen locker
lock_command = "i3lock --blur=5 -f -k --timecolor=ffffffff --datecolor=ffffffff --indicator --ringcolor=aaaaaaaa",
-- lock_command = "xscreensaver-command -lock",
-- Terminal -- Terminal
terminal = "terminator", terminal = "terminator",
@ -75,6 +79,10 @@ config.keys.global_keys = {
-- Application launcher -- Application launcher
launcher = { { config.keys.modkey }, "space", }, launcher = { { config.keys.modkey }, "space", },
-- Screen locker
lock_screen = { { config.keys.modkey }, "l" },
-- --
-- Media and volume controls -- Media and volume controls
-- See media_control.lua -- See media_control.lua

View File

@ -138,6 +138,17 @@ for _, app in ipairs(config.autostart) do
end end
end end
--
-- Screen locker
--
function lockScreen()
awful.spawn(config.awesome.lock_command)
end
hotkey.registerKeys(hotkey.make(config.keys.global_keys.lock_screen, lockScreen,
{ description = "lock your screen", group = "awesome" }))
-- --
-- Launcher (start menu) -- Launcher (start menu)
-- --
@ -160,7 +171,7 @@ os_menu = awful.widget.launcher({
{ "Manual", config.awesome.terminal .. " -e man awesome" }, { "Manual", config.awesome.terminal .. " -e man awesome" },
{ "Edit config", config.awesome.editor_cmd .. " " .. awesome.conffile }, { "Edit config", config.awesome.editor_cmd .. " " .. awesome.conffile },
{ "Open terminal", config.awesome.terminal }, { "Open terminal", config.awesome.terminal },
{ "Lock", function() awful.spawn("xscreensaver-command -lock") end, lock_icon }, { "Lock", lockScreen, lock_icon },
{ "Logout", function() awesome.quit() end, logout_icon }, { "Logout", function() awesome.quit() end, logout_icon },
{ "Restart", function() os.execute('shutdown -r now') end, restart_icon }, { "Restart", function() os.execute('shutdown -r now') end, restart_icon },
{ "Shutdown", function() os.execute('shutdown now') end, shutdown_icon }, { "Shutdown", function() os.execute('shutdown now') end, shutdown_icon },
@ -380,10 +391,10 @@ hotkey.registerKeys(awful.key({ config.keys.modkey, }, "s", hotkeys_popup.show_h
awful.key({ config.keys.modkey, "Shift" }, "q", awesome.quit, awful.key({ config.keys.modkey, "Shift" }, "q", awesome.quit,
{ description = "quit awesome", group = "awesome" }), { description = "quit awesome", group = "awesome" }),
awful.key({ config.keys.modkey, }, "l", function() awful.tag.incmwfact(0.05) end, -- awful.key({ config.keys.modkey, }, "l", function() awful.tag.incmwfact(0.05) end,
{ description = "increase master width factor", group = "layout" }), -- { description = "increase master width factor", group = "layout" }),
awful.key({ config.keys.modkey, }, "h", function() awful.tag.incmwfact(-0.05) end, -- awful.key({ config.keys.modkey, }, "h", function() awful.tag.incmwfact(-0.05) end,
{ description = "decrease master width factor", group = "layout" }), -- { description = "decrease master width factor", group = "layout" }),
awful.key({ config.keys.modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end, awful.key({ config.keys.modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end,
{ description = "increase the number of master clients", group = "layout" }), { description = "increase the number of master clients", group = "layout" }),
awful.key({ config.keys.modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end, awful.key({ config.keys.modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end,