2020-09-02 04:19:52 +02:00
# Logout widget
2020-09-03 03:49:20 +02:00
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.
2020-09-03 04:02:58 +02:00
![screenshot ](./screenshot.gif )
2020-09-03 03:49:20 +02:00
2020-09-02 04:19:52 +02:00
# Installation
2020-09-03 21:35:55 +02:00
Clone this (if not cloned yet) and the Awesome-buttons repos under ** ./.config/awesome/**
```bash
cd ./.config/awesome/
git clone https://github.com/streetturtle/awesome-wm-widgets
git clone https://github.com/streetturtle/awesome-buttons
```
Then
2020-09-02 04:19:52 +02:00
2020-09-03 03:30:00 +02:00
- to show by shortcut:
```lua
local logout = require("awesome-wm-widgets.experiments.logout-widget.logout")
2020-09-03 04:02:58 +02:00
...
globalkeys = gears.table.join(
...
2020-09-03 03:30:00 +02:00
-- 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:
```lua
local logout = require("awesome-wm-widgets.experiments.logout-widget.logout")
s.mytasklist, -- Middle widget
{ -- 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
},
...
```
2020-09-02 04:19:52 +02:00
# Customisation
2020-09-03 03:30:00 +02:00
2020-09-03 17:11:51 +02:00
| Name | Default | Description |
|---|---|---|
2020-09-03 17:13:55 +02:00
| `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 |
2020-09-03 17:14:31 +02:00
| `onlogout` | `function() awesome.quit() end` | Function which is called when the logout button is pressed |
2020-09-03 17:11:51 +02:00
| `onlock` | | Function which is called when the lock button is pressed |
| `onreboot` | | Function which is called when the reboot button is pressed |
2020-09-03 17:14:31 +02:00
| `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 |
2020-09-03 03:30:00 +02:00