diff options
author | Tim Keller <tjkeller.xyz> | 2025-04-12 14:34:55 -0500 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2025-04-12 14:34:55 -0500 |
commit | 39f8a32b96c86a442c6cdc4aae7a870a5f65b45f (patch) | |
tree | 301b6b623f80838de954c8afdd0d19cb2665f11a | |
parent | 3ab998e85b7eb487d129530c5ec437259e305c81 (diff) | |
download | awesome-39f8a32b96c86a442c6cdc4aae7a870a5f65b45f.tar.xz awesome-39f8a32b96c86a442c6cdc4aae7a870a5f65b45f.zip |
cleanup and tasklist tooltip + wibox tooltip lib
-rw-r--r-- | bar.lua | 37 | ||||
-rw-r--r-- | hosts/libreX60.lua | 5 | ||||
-rw-r--r-- | lib/wiboxtooltip.lua | 56 | ||||
-rw-r--r-- | rc.lua | 3 | ||||
-rw-r--r-- | theme.lua | 20 | ||||
-rw-r--r-- | widgets/tasklist.lua | 75 |
6 files changed, 148 insertions, 48 deletions
@@ -11,11 +11,11 @@ local widget_temperature = require("widgets.temperature") local widget_battery = require("widgets.battery") local classiclayoutbox = require("widgets.classiclayouts") local volume_control = require("widgets.pavolctld") +local tasklist = require("widgets.tasklist") local widget_volume = volume_control.textbox -- store widgets here local spacing = 8 -local separator = { widget = wibox.widget.separator, opacity = 0 } local widgets = { temperature_file = nil; @@ -33,22 +33,7 @@ local widgets = { filter = awful.widget.taglist.filter.noempty, buttons = taglist_buttons, } end, - tasklist = function(s) return wibox.widget { - layout = wibox.layout.align.horizontal, - expand = "outside", - separator, - awful.widget.tasklist { - screen = s, - filter = awful.widget.tasklist.filter.focused, - buttons = tasklist_buttons, - widget_template = { - id = "text_role", - widget = wibox.widget.textbox, - align = "center", - }, - }, - separator, - } end, + tasklist = tasklist, textclock = { widget = wibox.widget.textclock, format = "%A, %B %-e, %-I:%M %p", @@ -144,22 +129,4 @@ awful.screen.connect_for_each_screen(function (s) } end) ----- signal for changing tasklist filter based on layout ----- DOESNT WORK TODO ---local naughty = require("naughty") ---s:connect_signal("property::layout", function() --- naughty.notify({ --- title = "Hello, AwesomeWM!", --- text = "This is a notification.", --- timeout = 5, -- Timeout in seconds --- position = "top_right" -- Position on the screen --- }) --- if awful.layout.get(s) == awful.layout.suit.max then --- s.mytasklist.filter = awful.widget.tasklist.filter.currenttags --- else --- s.mytasklist.filter = awful.widget.tasklist.filter.focused --- end ---end ---) - return widgets diff --git a/hosts/libreX60.lua b/hosts/libreX60.lua index 13f2d8b..08dcec0 100644 --- a/hosts/libreX60.lua +++ b/hosts/libreX60.lua @@ -3,6 +3,7 @@ local bar_widgets = require("bar") local beautiful = require("beautiful") bar_widgets.textclock.format = "%a, %b %-e, %-H:%M" -bar_widgets.temp.file = "/sys/class/hwmon/hwmon2/temp1_input" +bar_widgets.temp.file = "/sys/class/thermal/thermal_zone0/temp" -beautiful.font = beautiful.font_sans = beautiful.font_mono +beautiful.font = beautiful.font_mono +beautiful.font_sans = beautiful.font_mono diff --git a/lib/wiboxtooltip.lua b/lib/wiboxtooltip.lua new file mode 100644 index 0000000..c101f92 --- /dev/null +++ b/lib/wiboxtooltip.lua @@ -0,0 +1,56 @@ +local awful = require("awful") +local wibox = require("wibox") +local beautiful = require("beautiful") +local gears = require("gears") + +local margin_leftright = beautiful.xresources.apply_dpi(5) +local margin_topbottom = beautiful.xresources.apply_dpi(3) + +-- TODO more args +-- TODO use tooltip theme vars +function create_wibox_tooltip(parent, widget) + local p = { + parent = parent, + popup = awful.popup { + widget = wibox.container.margin ( + widget, + margin_leftright, margin_leftright, + margin_topbottom, margin_topbottom + ), + ontop = true, + visible = false, + preferred_positions = "bottom", + preferred_anchors = "middle", + } + } + -- hover timer + p.timer = gears.timer { + timeout = 1, + single_shot = true, + callback = function() + p.popup:move_next_to(mouse.current_widget_geometry) + p.popup.visible = true + end, + } + -- signal functions + p._mouse_enter = function() + p.timer:again() + end + p._mouse_leave = function() + p.timer:stop() + p.popup.visible = false + end + p.connect_signals = function() + p.parent:connect_signal("mouse::enter", p._mouse_enter) + p.parent:connect_signal("mouse::leave", p._mouse_leave) + end + p.disconnect_signals = function() + p.parent:disconnect_signal("mouse::enter", p._mouse_enter) + p.parent:disconnect_signal("mouse::leave", p._mouse_leave) + end + + p.connect_signals() + return p +end + +return create_wibox_tooltip @@ -28,4 +28,5 @@ require("func.tagnames") --require("widgets.audio") -- call override module if exists -pcall(function() require("hosts." .. hostname) end) +--pcall(function() require("hosts." .. hostname) end) +require("hosts.libreX60") @@ -14,22 +14,22 @@ beautiful.init(gears.filesystem.get_themes_dir() .. "gtk/theme.lua") beautiful.useless_gap = 0 beautiful.gap_single_client = false --- overrides -beautiful.tasklist_font_focus = beautiful.font -- prevent bold -beautiful.wibar_height = math.floor(beautiful.get_font_height(beautiful.font) * 1.15) -beautiful.wibar_bg = darkgray ---beautiful.layoutlist_font = "Monospace 8" ---beautiful.font = "Tamzen 10" ---beautiful.tasklist_align = "center" -- does nothing? - +-- fonts beautiful.font_sans = beautiful.font -beautiful.font_mono = "monospace 10" +beautiful.font_mono = "monospace 8" +beautiful.font_mono_bold = "monospace, bold 8" beautiful.font = beautiful.font_mono ---beautiful.layoutlist_font = beautiful.font_mono beautiful.taglist_font = beautiful.font_sans beautiful.tasklist_font = beautiful.font_sans beautiful.textclock_font = beautiful.font_sans +beautiful.tooltip_font = beautiful.font_mono + +-- bar +beautiful.tasklist_font_focus = beautiful.font -- prevent bold +beautiful.wibar_height = math.floor(beautiful.get_font_height(beautiful.font) * 1.15) +beautiful.wibar_bg = darkgray +beautiful.tasklist_plain_task_name = true -- don't use client status icons -- hotkeys menu beautiful.hotkeys_font = beautiful.font_mono -- TODO make bold diff --git a/widgets/tasklist.lua b/widgets/tasklist.lua new file mode 100644 index 0000000..5caac3e --- /dev/null +++ b/widgets/tasklist.lua @@ -0,0 +1,75 @@ +local awful = require("awful") +local wibox = require("wibox") +local wibox_tooltip = require("lib.wiboxtooltip") +local beautiful = require("beautiful") + +local separator = { widget = wibox.widget.separator, opacity = 0 } + +function tooltip_tag_clients() + local text = "" + for _, c in ipairs(awful.screen.focused():get_clients(false)) do + local ctext = c.name + if c == client.focus then + ctext = "* " .. ctext + end + text = text .. ctext .. "\n" + end + return text:sub(1, -2) -- remove last newline +end + +function create_tasklist(s) + local tasklist = wibox.widget { + layout = wibox.layout.align.horizontal, + expand = "outside", + separator, + awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.focused, + buttons = tasklist_buttons, + widget_template = { + id = "text_role", + widget = wibox.widget.textbox, + align = "center", + }, + }, + separator, + } + + local popup = wibox_tooltip(tasklist, awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = { + layout = wibox.layout.fixed.vertical, + }, + widget_template = { + id = "text_role", + widget = wibox.widget.textbox, + align = "center", + }, + style = { + font_focus = beautiful.font_mono_bold, + }, + }) + + return tasklist +end + +---- signal for changing tasklist filter based on layout +---- DOESNT WORK TODO +--local naughty = require("naughty") +--s:connect_signal("property::layout", function() +-- naughty.notify({ +-- title = "Hello, AwesomeWM!", +-- text = "This is a notification.", +-- timeout = 5, -- Timeout in seconds +-- position = "top_right" -- Position on the screen +-- }) +-- if awful.layout.get(s) == awful.layout.suit.max then +-- s.mytasklist.filter = awful.widget.tasklist.filter.currenttags +-- else +-- s.mytasklist.filter = awful.widget.tasklist.filter.focused +-- end +--end +--) + +return create_tasklist |