From 41e377b06c55a0d8909562a41052e8d28be962c7 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sat, 17 Aug 2019 14:57:19 +0200 Subject: [PATCH] Add screen locking hotkey + config and default to i3lock-color (i3lock) --- README.md | 1 + default_config.lua | 8 ++++++++ simple/init.lua | 21 ++++++++++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bc2d779..f7eda5b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ By default, Simple Awesome uses - `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. +- `i3lock-color` - lock your screen in a simple and elegant way ## To do diff --git a/default_config.lua b/default_config.lua index 8f4c73c..3fcaceb 100644 --- a/default_config.lua +++ b/default_config.lua @@ -23,6 +23,10 @@ config.awesome = { application_launcher_check = "rofi -version", 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 = "terminator", @@ -75,6 +79,10 @@ config.keys.global_keys = { -- Application launcher launcher = { { config.keys.modkey }, "space", }, + -- Screen locker + lock_screen = { { config.keys.modkey }, "l" }, + + -- -- Media and volume controls -- See media_control.lua diff --git a/simple/init.lua b/simple/init.lua index c231f44..f7d7577 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -138,6 +138,17 @@ for _, app in ipairs(config.autostart) do 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) -- @@ -160,7 +171,7 @@ os_menu = awful.widget.launcher({ { "Manual", config.awesome.terminal .. " -e man awesome" }, { "Edit config", config.awesome.editor_cmd .. " " .. awesome.conffile }, { "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 }, { "Restart", function() os.execute('shutdown -r now') end, restart_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, { description = "quit awesome", group = "awesome" }), - awful.key({ config.keys.modkey, }, "l", function() awful.tag.incmwfact(0.05) end, - { description = "increase master width factor", group = "layout" }), - awful.key({ config.keys.modkey, }, "h", function() awful.tag.incmwfact(-0.05) end, - { description = "decrease master width factor", group = "layout" }), + -- awful.key({ config.keys.modkey, }, "l", function() awful.tag.incmwfact(0.05) end, + -- { description = "increase master width factor", group = "layout" }), + -- awful.key({ config.keys.modkey, }, "h", function() awful.tag.incmwfact(-0.05) end, + -- { description = "decrease master width factor", group = "layout" }), awful.key({ config.keys.modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end, { description = "increase the number of master clients", group = "layout" }), awful.key({ config.keys.modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end,