aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui/statusbar/panel/widgets
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/ui/statusbar/panel/widgets')
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua60
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua46
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/calendar.lua1
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/displays.lua104
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/power_menu.lua62
5 files changed, 167 insertions, 106 deletions
diff --git a/.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua b/.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua
deleted file mode 100644
index c1466f4..0000000
--- a/.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua
+++ /dev/null
@@ -1,60 +0,0 @@
-local qmath = require "quarrel.math"
-local qvars = require "quarrel.vars"
-local wibox = require "wibox"
-
-local battery_bar = wibox.widget {
- widget = wibox.container.place,
- forced_height = qvars.char_height,
- {
- {
- widget = wibox.container.constraint,
- width = qvars.char_width * 4,
- strategy = "exact",
- {
- widget = wibox.widget.textbox,
- text = "0%"
- },
- id = "text"
- },
- nil,
- {
- widget = wibox.container.margin,
- margins = {
- left = qvars.padding
- },
- {
- widget = wibox.container.place,
- {
- widget = wibox.widget.progressbar,
- max_value = 100,
- value = 0,
- forced_height = qvars.char_height / 4,
- shape = qvars.shape,
- background_color = qvars.colors.black,
- color = qvars.colors.red,
- }
- },
- id = "bar"
- },
- layout = wibox.layout.align.horizontal,
- -- expand = "outside"
- }
-}
-
-awesome.connect_signal("services::battery", function(capacity)
- local color = qmath.step_value(capacity, {
- { 0, "red" },
- { 20, "red" },
- { 40, "yellow" },
- { 60, "green" },
- { 80, "green" },
- { 100 }
- })
-
- battery_bar.widget.bar.widget.widget.color = qvars.colors[color]
- battery_bar.widget.bar.widget.widget.value = capacity
-
- battery_bar.widget.text.widget.text = capacity .. "%"
-end)
-
-return battery_bar
diff --git a/.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua b/.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua
deleted file mode 100644
index 7d3e5f0..0000000
--- a/.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-local qmath = require "quarrel.math"
-local qvars = require "quarrel.vars"
-local wibox = require "wibox"
-
-local brightness_bar = wibox.widget {
- widget = wibox.container.place,
- forced_height = qvars.char_height,
- {
- {
- widget = wibox.widget.textbox,
- text = "0%",
- id = "text"
- },
- nil,
- {
- widget = wibox.container.margin,
- margins = {
- left = qvars.padding
- },
- {
- widget = wibox.container.place,
- {
- widget = wibox.widget.progressbar,
- max_value = 100,
- value = 0,
- forced_height = qvars.char_height / 4,
- shape = qvars.shape,
- background_color = qvars.colors.black,
- color = qvars.colors.fg,
- }
- },
- id = "bar"
- },
- layout = wibox.layout.align.horizontal,
- }
-}
-
-awesome.connect_signal("services::brightness", function(brightness)
- brightness = math.floor(qmath.translate_range(brightness, 0, 255, 0, 100))
-
- brightness_bar.widget.bar.widget.widget.value = brightness
-
- brightness_bar.widget.text.text = brightness .. "%"
-end)
-
-return brightness_bar
diff --git a/.config/awesome/ui/statusbar/panel/widgets/calendar.lua b/.config/awesome/ui/statusbar/panel/widgets/calendar.lua
index e69de29..8b13789 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/calendar.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/calendar.lua
@@ -0,0 +1 @@
+
diff --git a/.config/awesome/ui/statusbar/panel/widgets/displays.lua b/.config/awesome/ui/statusbar/panel/widgets/displays.lua
new file mode 100644
index 0000000..cd05253
--- /dev/null
+++ b/.config/awesome/ui/statusbar/panel/widgets/displays.lua
@@ -0,0 +1,104 @@
+local qmath = require "quarrel.math"
+local qvars = require "quarrel.vars"
+local qui = require "quarrel.ui"
+local wibox = require "wibox"
+local phosphor = require "assets.phosphor"
+local gcolor = require "gears.color"
+
+local function create_display(icon, color)
+ return wibox.widget(qui.styled {
+ widget = wibox.container.background,
+ {
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ {
+ widget = wibox.container.place,
+ {
+ {
+ widget = wibox.container.radialprogressbar,
+ max_value = 100,
+ border_color = qvars.colors.black,
+ color = color,
+ border_width = qvars.border_width * 2,
+ forced_height = qvars.element_size * 4,
+ forced_width = qvars.element_size * 4,
+ {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.imagebox,
+ image = icon,
+ forced_height = qvars.char_height,
+ forced_width = qvars.char_height,
+ id = "icon"
+ }
+ },
+ id = "indicator"
+ },
+ {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.textbox,
+ text = "0%",
+ id = "text"
+ }
+ },
+ layout = wibox.layout.fixed.vertical,
+ spacing = qvars.big_padding
+ }
+ }
+ }
+ })
+end
+
+local d_battery = create_display(gcolor.recolor_image(phosphor.battery_vertical_warning_fill, qvars.colors.fg), qvars.colors.red)
+
+awesome.connect_signal("services::battery", function(capacity, status)
+ local icon_data = status == "Charging" and { "charging", "green" } or qmath.step_value(capacity, {
+ { 0, { "empty", "red" } },
+ { 20, { "low", "red" } },
+ { 40, { "medium", "yellow" } },
+ { 60, { "high", "green" } },
+ { 80, { "full", "green" } },
+ { 100 }
+ })
+
+ d_battery:get_children_by_id("indicator")[1].color = qvars.colors[icon_data[2]]
+ d_battery:get_children_by_id("indicator")[1].value = capacity
+ d_battery:get_children_by_id("icon")[1].image = gcolor.recolor_image(phosphor["battery_vertical_" .. icon_data[1] .. "_fill"], qvars.colors[icon_data[2]])
+
+ d_battery:get_children_by_id("text")[1].text = capacity .. "%"
+end)
+
+local d_volume = create_display(gcolor.recolor_image(phosphor.speaker_simple_high_fill, qvars.colors.fg), qvars.colors.fg)
+
+awesome.connect_signal("services::audio", function(volume, muted)
+ d_volume:get_children_by_id("indicator")[1].value = math.min(volume, 100)
+ d_volume:get_children_by_id("text")[1].text = volume .. "%"
+
+ if muted then
+ d_volume:get_children_by_id("icon")[1].image = gcolor.recolor_image(phosphor["speaker_simple_x_fill"], qvars.colors.red)
+ return
+ end
+
+ local icon_data = qmath.step_value(volume, {
+ { 0, "slash" },
+ { 25, "none" },
+ { 50, "low" },
+ { 75, "high" },
+ { 100 }
+ })
+
+ d_volume:get_children_by_id("icon")[1].image = gcolor.recolor_image(phosphor["speaker_simple_" .. icon_data .. "_fill"], qvars.colors.fg)
+end)
+
+local d_brightness = create_display(gcolor.recolor_image(phosphor.sun_fill, qvars.colors.fg), qvars.colors.fg)
+
+awesome.connect_signal("services::brightness", function(brightness)
+ brightness = math.floor(qmath.translate_range(brightness, 0, 255, 0, 100))
+
+ d_brightness:get_children_by_id("indicator")[1].value = brightness
+
+ d_brightness:get_children_by_id("text")[1].text = brightness .. "%"
+end)
+
+return { battery = d_battery, volume = d_volume, brightness = d_brightness }
diff --git a/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua b/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua
new file mode 100644
index 0000000..ffb5a76
--- /dev/null
+++ b/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua
@@ -0,0 +1,62 @@
+local q = require "quarrel"
+local qbind = require "quarrel.bind"
+local qvars = require "quarrel.vars"
+local qui = require "quarrel.ui"
+local wibox = require "wibox"
+
+local power_menu = wibox.widget {
+ qui.styled {
+ widget = wibox.container.background,
+ bg = qvars.colors.black,
+ {
+ widget = wibox.widget.textbox,
+ text = "1",
+ buttons = {
+ qbind:new {
+ triggers = qvars.btns.left,
+ press = function()
+ q.debug("from 1")
+ end,
+ hidden = true
+ }
+ }
+ }
+ },
+ qui.styled {
+ widget = wibox.container.background,
+ bg = qvars.colors.black,
+ {
+ widget = wibox.widget.textbox,
+ text = "2",
+ buttons = {
+ qbind:new {
+ triggers = qvars.btns.left,
+ press = function()
+ q.debug("from 2")
+ end,
+ hidden = true
+ }
+ }
+ }
+ },
+ qui.styled {
+ widget = wibox.container.background,
+ bg = qvars.colors.black,
+ {
+ widget = wibox.widget.textbox,
+ text = "3",
+ buttons = {
+ qbind:new {
+ triggers = qvars.btns.left,
+ press = function()
+ q.debug("from 3")
+ end,
+ hidden = true
+ }
+ }
+ }
+ },
+ layout = wibox.layout.flex.horizontal
+}
+
+return power_menu