diff options
author | streetturtle <streetturtle@gmail.com> | 2020-09-07 14:20:13 -0400 |
---|---|---|
committer | streetturtle <streetturtle@gmail.com> | 2020-09-07 14:20:55 -0400 |
commit | 85fd3a78e55819788306fb7437d2e132bfb5a853 (patch) | |
tree | b893ebb63dbb2a4295a5e5f3e8c045246c395bda /experiments/logout-widget | |
parent | 227b6d5a3214796e96f592df52cdfe5fc0cbe359 (diff) |
[logout] not an experiment anymore
Diffstat (limited to 'experiments/logout-widget')
-rw-r--r-- | experiments/logout-widget/README.md | 71 | ||||
-rw-r--r-- | experiments/logout-widget/logout-dark.png | bin | 27757 -> 0 bytes | |||
-rw-r--r-- | experiments/logout-widget/logout-nord.png | bin | 26289 -> 0 bytes | |||
-rw-r--r-- | experiments/logout-widget/logout-outrun.png | bin | 26151 -> 0 bytes | |||
-rw-r--r-- | experiments/logout-widget/logout.lua | 141 | ||||
-rw-r--r-- | experiments/logout-widget/power.svg | 1 | ||||
-rw-r--r-- | experiments/logout-widget/screenshot.gif | bin | 172152 -> 0 bytes | |||
-rw-r--r-- | experiments/logout-widget/screenshot.png | bin | 129588 -> 0 bytes |
8 files changed, 0 insertions, 213 deletions
diff --git a/experiments/logout-widget/README.md b/experiments/logout-widget/README.md deleted file mode 100644 index 07e75fa..0000000 --- a/experiments/logout-widget/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Logout widget - -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. - -<p align="center"> - <img src="https://github.com/streetturtle/awesome-wm-widgets/raw/master/experiments/logout-widget/screenshot.gif" alt="screenshot"> -</p> - -# Installation - -Clone this (if not cloned yet) and the [awesome-buttons](https://github.com/streetturtle/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 - -- 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( - ... - awful.key({ modkey }, "l", function() logout.launch() end, {description = "Show logout screen", group = "custom"}), - ``` - -- 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") - - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - ... - 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 | -| `onlogout` | `function() awesome.quit() end` | Function which is called when the logout 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!"}, -} -``` diff --git a/experiments/logout-widget/logout-dark.png b/experiments/logout-widget/logout-dark.png Binary files differdeleted file mode 100644 index 06e7c9c..0000000 --- a/experiments/logout-widget/logout-dark.png +++ /dev/null diff --git a/experiments/logout-widget/logout-nord.png b/experiments/logout-widget/logout-nord.png Binary files differdeleted file mode 100644 index 9ab4b55..0000000 --- a/experiments/logout-widget/logout-nord.png +++ /dev/null diff --git a/experiments/logout-widget/logout-outrun.png b/experiments/logout-widget/logout-outrun.png Binary files differdeleted file mode 100644 index d711d02..0000000 --- a/experiments/logout-widget/logout-outrun.png +++ /dev/null diff --git a/experiments/logout-widget/logout.lua b/experiments/logout-widget/logout.lua deleted file mode 100644 index f68d9a7..0000000 --- a/experiments/logout-widget/logout.lua +++ /dev/null @@ -1,141 +0,0 @@ -------------------------------------------------- --- Logout widget for Awesome Window Manager --- More details could be found here: --- https://github.com/streetturtle/awesome-wm-widgets/tree/master/logout-widget - --- @author Pavel Makhov --- @copyright 2020 Pavel Makhov -------------------------------------------------- - -local awful = require("awful") -local capi = {keygrabber = keygrabber } -local wibox = require("wibox") -local gears = require("gears") -local beautiful = require("beautiful") -local awesomebuttons = require("awesome-buttons.awesome-buttons") - - -local HOME_DIR = os.getenv("HOME") -local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/experiments/logout-widget' - - -local w = wibox { - bg = beautiful.fg_normal, - max_widget_size = 500, - ontop = true, - height = 200, - width = 400, - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 8) - end -} - -local action = wibox.widget { - text = ' ', - widget = wibox.widget.textbox -} - - -local function create_button(icon_name, action_name, color, 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 -end - -local function launch(args) - - local bg_color = args.bg_color or beautiful.bg_normal - local accent_color = args.accent_color or beautiful.bg_focus - local text_color = args.text_color or beautiful.fg_normal - local phrases = args.phrases or {'Goodbye!'} - - local onlogout = args.onlogout or function () awesome.quit() 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) - - local phrase_widget = wibox.widget{ - markup = '<span color="'.. text_color .. '" size="20000">' .. phrases[ math.random( #phrases ) ] .. '</span>', - align = 'center', - widget = wibox.widget.textbox - } - - w:setup { - { - phrase_widget, - { - { - create_button('log-out', 'Log Out', accent_color, onlogout), - create_button('lock', 'Lock', accent_color, onlock), - create_button('refresh-cw', 'Reboot', accent_color, onreboot), - create_button('moon', 'Suspend', accent_color, onsuspend), - create_button('power', 'Power Off', accent_color, onpoweroff), - id = 'buttons', - spacing = 8, - layout = wibox.layout.fixed.horizontal - }, - valigh = 'center', - layout = wibox.container.place - }, - { - action, - haligh = 'center', - layout = wibox.container.place - }, - spacing = 32, - layout = wibox.layout.fixed.vertical - }, - id = 'a', - shape_border_width = 1, - valigh = 'center', - layout = wibox.container.place - } - - w.visible = true - - awful.placement.centered(w) - capi.keygrabber.run(function(_, key, event) - if event == "release" then return end - if key then - phrase_widget:set_text('') - capi.keygrabber.stop() - w.visible = false - end - end) -end - -local function widget(args) - local icon = args.icon or WIDGET_DIR .. '/power.svg' - - local res = wibox.widget { - { - { - image = icon, - widget = wibox.widget.imagebox - }, - margins = 4, - layout = wibox.container.margin - }, - layout = wibox.layout.fixed.horizontal, - } - - res:buttons( - awful.util.table.join( - awful.button({}, 1, function() - launch(args) - end) - )) - - return res - -end - -return { - launch = launch, - widget = widget -} diff --git a/experiments/logout-widget/power.svg b/experiments/logout-widget/power.svg deleted file mode 100644 index 1f9c4e3..0000000 --- a/experiments/logout-widget/power.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ECEFF4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>
\ No newline at end of file diff --git a/experiments/logout-widget/screenshot.gif b/experiments/logout-widget/screenshot.gif Binary files differdeleted file mode 100644 index 8fcf9ab..0000000 --- a/experiments/logout-widget/screenshot.gif +++ /dev/null diff --git a/experiments/logout-widget/screenshot.png b/experiments/logout-widget/screenshot.png Binary files differdeleted file mode 100644 index 74ed7f0..0000000 --- a/experiments/logout-widget/screenshot.png +++ /dev/null |