Reno is the second iteration of the AWMTK-powered AwesomeWM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.8 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. -- This file is part of Reno desktop.
  2. --
  3. -- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  4. --
  5. -- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  6. --
  7. -- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
  8. -- Power/lock/suspend buttons for the global context menu
  9. local awmtk2 = require("awmtk2")
  10. local wibox = require("wibox")
  11. local gears = require("gears")
  12. local awful = require("awful")
  13. local beautiful = require("beautiful")
  14. return function(args)
  15. local style = awmtk2.create_style("root_buttons",
  16. awmtk2.generic.button_list,args.style)
  17. local templates = awmtk2.create_template_lib("root_buttons",awmtk2.templates,args.templates)
  18. local t = awmtk2.build_templates(templates,style,args.vertical)
  19. local poweroff = wibox.widget(t.button(t.icon({
  20. image = beautiful["action-poweroff-symbolic"],
  21. }),{
  22. forced_width = style.button.forced_width,
  23. forced_height = style.button.forced_height
  24. }))
  25. poweroff:connect_signal("button::press",style.button.onpress)
  26. poweroff:connect_signal("button::release",style.button.onrelease)
  27. poweroff:connect_signal("button::press",function()
  28. awful.spawn("systemctl poweroff") -- Works only with systemd
  29. awful.spawn("loginctl poweroff") -- Works only with elogind
  30. end)
  31. local lock = wibox.widget(t.button(t.icon({
  32. image = beautiful["action-lock-screen-symbolic"],
  33. }),{
  34. forced_width = style.button.forced_width,
  35. forced_height = style.button.forced_height
  36. }))
  37. lock:connect_signal("button::press",style.button.onpress)
  38. lock:connect_signal("button::release",style.button.onrelease)
  39. lock:connect_signal("button::press",function()
  40. awesome.emit_signal("lock_screen")
  41. end)
  42. local suspend = wibox.widget(t.button(t.icon({
  43. image = beautiful["action-suspend-symbolic"],
  44. }),{
  45. forced_width = style.button.forced_width,
  46. forced_height = style.button.forced_height
  47. }))
  48. suspend:connect_signal("button::press",style.button.onpress)
  49. suspend:connect_signal("button::release",style.button.onrelease)
  50. suspend:connect_signal("button::press",function()
  51. awful.spawn("systemctl suspend")
  52. awful.spawn("loginctl suspend")
  53. end)
  54. local widget = wibox.widget {
  55. poweroff,
  56. lock,
  57. suspend,
  58. layout = wibox.layout.fixed.horizontal,
  59. spacing = style.base.spacing
  60. }
  61. return widget
  62. end