diff options
author | streetturtle <streetturtle@gmail.com> | 2020-09-06 21:47:07 -0400 |
---|---|---|
committer | streetturtle <streetturtle@gmail.com> | 2020-09-06 21:47:07 -0400 |
commit | 1fe7e123175aba76128c4460d226a745f75d71e9 (patch) | |
tree | fea25df49e44a5c9ec0390830d76f44ac869c359 | |
parent | cbe255727385b4b86a3d328c8c7479a8cacbf305 (diff) |
[logout] improvements
-rw-r--r-- | experiments/logout-widget/README.md | 43 | ||||
-rw-r--r-- | experiments/logout-widget/logout-dark.png | bin | 0 -> 27757 bytes | |||
-rw-r--r-- | experiments/logout-widget/logout-nord.png | bin | 0 -> 26289 bytes | |||
-rw-r--r-- | experiments/logout-widget/logout-outrun.png | bin | 0 -> 26151 bytes | |||
-rw-r--r-- | experiments/logout-widget/logout.lua | 16 |
5 files changed, 34 insertions, 25 deletions
diff --git a/experiments/logout-widget/README.md b/experiments/logout-widget/README.md index c1cdf08..232751d 100644 --- a/experiments/logout-widget/README.md +++ b/experiments/logout-widget/README.md @@ -1,12 +1,12 @@ # Logout widget -Widget which allows to perform lock, reboot, log out, power off and sleep actions. If can be called either by a shortcut, or by clicking on a widget in wibar. +Widget which allows to perform lock, reboot, log out, power off and sleep actions. It can be called either by a shortcut, or by clicking on a widget in wibar. ![screenshot](./screenshot.gif) # Installation -Clone this (if not cloned yet) and the Awesome-buttons repos under **./.config/awesome/** +Clone this (if not cloned yet) and the [awesome-buttons](https://github.com/streetturtle/awesome-buttons) repos under **./.config/awesome/** ```bash cd ./.config/awesome/ @@ -15,18 +15,17 @@ git clone https://github.com/streetturtle/awesome-buttons ``` Then -- to show by shortcut: +- to show by a shortcut - define a shortcut in `globalkeys`: ```lua local logout = require("awesome-wm-widgets.experiments.logout-widget.logout") ... globalkeys = gears.table.join( ... - -- define a shorcut in globalkey awful.key({ modkey }, "l", function() logout.launch() end, {description = "Show logout screen", group = "custom"}), ``` -- to show by clicking on a widget in wibar: +- to show by clicking on a widget in wibar - add widget to the wibar: ```lua local logout = require("awesome-wm-widgets.experiments.logout-widget.logout") @@ -35,28 +34,36 @@ Then { -- Right widgets layout = wibox.layout.fixed.horizontal, ... - logout.widget{ - bg_color = "#000000", - accent_color = "#888888", - text_color = '#ffffff', - phrases = {'Yippee ki yay!', 'Hasta la vista, baby', 'See you later, alligator!', 'After a while, crocodile.'}, - onlogout = function() naughty.notify{text = "Logged out!"} end - }, + logout.widget{}, ... ``` # Customisation - | Name | Default | Description | |---|---|---| +| `icon` | `power.svg` | If used as widget - the path to the widget's icon | | `bg_color` | `beautiful.bg_normal` | The color the background of the | -| `accent_color` | `beautiful.bg_focus` | The color of the buttons | -| `text_color` | `beautiful.fg_normal` | The color of text | -| `phrases` | `{'Goodbye!'}` | The table with phrase(s) to show, if more than one provided, the phrase is chosen randomly | +| `accent_color` | `beautiful.bg_focus` | The color of the buttons | +| `text_color` | `beautiful.fg_normal` | The color of text | +| `phrases` | `{'Goodbye!'}` | The table with phrase(s) to show, if more than one provided, the phrase is chosen randomly | | `onlogout` | `function() awesome.quit() end` | Function which is called when the logout button is pressed | -| `onlock` | | Function which is called when the lock button is pressed | -| `onreboot` | | Function which is called when the reboot button is pressed | +| `onlock` | function() awful.spawn.with_shell("systemctl suspend") end | Function which is called when the lock button is pressed | +| `onreboot` | `function() awful.spawn.with_shell("reboot") end` | Function which is called when the reboot button is pressed | | `onsuspend` | `function() awful.spawn.with_shell("systemctl suspend") end` | Function which is called when the suspend button is pressed | | `onpoweroff` | `function() awful.spawn.with_shell("shutdown now") end` | Function which is called when the poweroff button is pressed | +Some color themes for inspiration: + +![nord](logout-nord.png) +![outrun](logout-outrun.png) +![dark](logout-dark.png) + +```lua +logout.launch{ + bg_color = "#261447", accent_color = "#ff4365", text_color = '#f706cf', -- outrun + -- bg_color = "#0b0c10", accent_color = "#1f2833", text_color = '#66fce1', -- dark + -- bg_color = "#3B4252", accent_color = "#88C0D0", text_color = '#D8DEE9', -- nord + phrases = {"exit(0)", "Don't forget to be awesome.", "Yippee ki yay!"}, +} +```
\ No newline at end of file diff --git a/experiments/logout-widget/logout-dark.png b/experiments/logout-widget/logout-dark.png Binary files differnew file mode 100644 index 0000000..06e7c9c --- /dev/null +++ b/experiments/logout-widget/logout-dark.png diff --git a/experiments/logout-widget/logout-nord.png b/experiments/logout-widget/logout-nord.png Binary files differnew file mode 100644 index 0000000..9ab4b55 --- /dev/null +++ b/experiments/logout-widget/logout-nord.png diff --git a/experiments/logout-widget/logout-outrun.png b/experiments/logout-widget/logout-outrun.png Binary files differnew file mode 100644 index 0000000..d711d02 --- /dev/null +++ b/experiments/logout-widget/logout-outrun.png diff --git a/experiments/logout-widget/logout.lua b/experiments/logout-widget/logout.lua index c68506b..f68d9a7 100644 --- a/experiments/logout-widget/logout.lua +++ b/experiments/logout-widget/logout.lua @@ -12,7 +12,7 @@ local capi = {keygrabber = keygrabber } local wibox = require("wibox") local gears = require("gears") local beautiful = require("beautiful") -local fancybuttons = require("awesome-buttons.awesome-buttons") +local awesomebuttons = require("awesome-buttons.awesome-buttons") local HOME_DIR = os.getenv("HOME") @@ -38,7 +38,7 @@ local action = wibox.widget { local function create_button(icon_name, action_name, color, onclick) - local button = fancybuttons.with_icon{ type = 'basic', icon = icon_name, color = color, onclick = onclick } + local button = awesomebuttons.with_icon{ type = 'basic', icon = icon_name, color = color, onclick = onclick } button:connect_signal("mouse::enter", function(c) action:set_text(action_name) end) button:connect_signal("mouse::leave", function(c) action:set_text(' ') end) return button @@ -52,10 +52,10 @@ local function launch(args) local phrases = args.phrases or {'Goodbye!'} local onlogout = args.onlogout or function () awesome.quit() end - local onlock = args.onlock - local onreboot = args.onreboot - local onsuspend = args.onsuspend or function () awful.spawn.with_shell("systemctl suspend") end - local onpoweroff = args.onpoweroff or function () awful.spawn.with_shell("shutdown now") end + local onlock = args.onlock or function() awful.spawn.with_shell("systemctl suspend") end + local onreboot = args.onreboot or function() awful.spawn.with_shell("reboot") end + local onsuspend = args.onsuspend or function() awful.spawn.with_shell("systemctl suspend") end + local onpoweroff = args.onpoweroff or function() awful.spawn.with_shell("shutdown now") end w:set_bg(bg_color) @@ -110,10 +110,12 @@ local function launch(args) end local function widget(args) + local icon = args.icon or WIDGET_DIR .. '/power.svg' + local res = wibox.widget { { { - image = WIDGET_DIR .. '/power.svg', + image = icon, widget = wibox.widget.imagebox }, margins = 4, |