diff options
Diffstat (limited to 'awesome/widgets')
-rw-r--r-- | awesome/widgets/button.lua | 33 | ||||
-rw-r--r-- | awesome/widgets/classiclayoutbox.lua | 2 | ||||
-rw-r--r-- | awesome/widgets/classiclayouts.lua | 77 | ||||
-rw-r--r-- | awesome/widgets/cpu.lua | 3 | ||||
-rw-r--r-- | awesome/widgets/pipewire.lua | 34 | ||||
-rw-r--r-- | awesome/widgets/ram.lua | 2 | ||||
-rw-r--r-- | awesome/widgets/temperature.lua | 2 |
7 files changed, 91 insertions, 62 deletions
diff --git a/awesome/widgets/button.lua b/awesome/widgets/button.lua new file mode 100644 index 0000000..cd1da1e --- /dev/null +++ b/awesome/widgets/button.lua @@ -0,0 +1,33 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local menubar = require("menubar") + +local hotkeys_popup = require("awful.hotkeys_popup") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: +require("awful.hotkeys_popup.keys") + +-- Menu +-- Create a launcher widget and a main menu +myawesomemenu = { + { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, + { "restart", awesome.restart }, + { "quit", function() awesome.quit() end }, +} + +mymainmenu = awful.menu({ + items = { + { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal } + } +}) + +mylauncher = awful.widget.launcher({ + image = beautiful.awesome_icon, + menu = mymainmenu +}) + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it + +return mylauncher diff --git a/awesome/widgets/classiclayoutbox.lua b/awesome/widgets/classiclayoutbox.lua index 818dc0f..412cb77 100644 --- a/awesome/widgets/classiclayoutbox.lua +++ b/awesome/widgets/classiclayoutbox.lua @@ -19,7 +19,7 @@ local layout_icons = { cornersw = "", cornerse = "", fairh = "", - fairv = "", + fairv = "EEH", max = "[M]", floating = "><>", magnifier = "[M]", diff --git a/awesome/widgets/classiclayouts.lua b/awesome/widgets/classiclayouts.lua index 917ca00..3b4fd64 100644 --- a/awesome/widgets/classiclayouts.lua +++ b/awesome/widgets/classiclayouts.lua @@ -1,27 +1,64 @@ -local awful = require("awful") +local wibox = require("wibox") +local layout = require("awful.layout") -local layoutbox = {} +local screen_widgets = {} -- need one widget per screen local layout_icons = { - cornernw = "", - cornerne = "", - cornersw = "", - cornerse = "", - fairh = "", - fairv = "", - max = "[M]", - floating = "><>", - magnifier = "[M]", - fullscreen = "", - spiral = "", - dwindle = "", - tile = "[]=", - tiletop = "TTT", - tilebottom = "TTT", - tileleft = "=[]", + cornernw = "TT=", + cornerne = "=TT", + cornersw = "LL=", + cornerse = "=LL", + fairh = "#_#", + fairv = "##H", + max = "[M]", + floating = "><>", + magnifier = "=O=", + fullscreen = "[*]", + spiral = "[]@", + dwindle = "[]\\", + tile = "[]=", + tiletop = "LLL", + tilebottom = "TTT", + tileleft = "=[]", } -function(s) - s = screen[s or 1] +function update(screen_index) + local s = screen[screen_index or 1] + local w = screen_widgets[s] + local l = layout.get(s) + -- create widget if not existing + if w == nil then + screen_widgets[s] = { widget = wibox.widget.textbox(), layout = l } + w = screen_widgets[s] + --w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1} + + -- skip if no change + elseif w.layout == l then + return + end + + -- set widget + local name = layout.getname(l) + --w._layoutbox_tooltip:set_text(name) + w.widget:set_text(layout_icons[name]) -- TODO handle nil + return w.widget +end + +function update_screens() + for s, w in pairs(boxes) do + if s.valid then + update(s) + end + end end + +function update_current_tag(t) + update(t.screen) +end + +tag.connect_signal("property::selected", update_current_tag) +tag.connect_signal("property::layout", update_current_tag) +tag.connect_signal("property::screen", update_screens) + +return update diff --git a/awesome/widgets/cpu.lua b/awesome/widgets/cpu.lua index cbd5916..d92bce8 100644 --- a/awesome/widgets/cpu.lua +++ b/awesome/widgets/cpu.lua @@ -1,7 +1,5 @@ local wibox = require("wibox") local widgets = require("util.widgets") -local osname = require("util.osname") - -- this is directly adapted from slstatus's cpu.c module local cpu_time = { 0,0,0,0,0,0,0 } -- user, nice, system, idle, iowait, irq, softirq @@ -32,7 +30,6 @@ function linux_cpu_usage(widget) widget:set_text(math.floor(usage)) end - -- return correct widget for os if osname == "Linux" then return widgets.watchfn(linux_cpu_usage, 5) diff --git a/awesome/widgets/pipewire.lua b/awesome/widgets/pipewire.lua deleted file mode 100644 index 3195ee7..0000000 --- a/awesome/widgets/pipewire.lua +++ /dev/null @@ -1,34 +0,0 @@ -local awful = require("awful") -local wibox = require("wibox") - ---local get_volume_cmd = "wpctl get-volume @DEFAULT_AUDIO_SINK@ | sed 's/Volume: //;s/0*\\.//'" ---local set_volume_cmd = "wpctl set-volume @DEFAULT_AUDIO_SINK@ %d%%%s" -- will be formatted -local get_volume_cmd = "wpctl get-volume @DEFAULT_AUDIO_SINK@" - -local widget = { - textbox = wibox.widget.textbox() -} - -local updating = false -function update_volume() - if updating then - return - end - awful.spawn.easy_async(get_volume_cmd, function(vol) - updating = true - vol = vol:sub(8) * 100 -- skip `Volume: ` whos len is 8 - widget.textbox:set_text(math.floor(vol)) - updating = false - end) -end - --- NOTE pulseaudio-utils (pactl) is still required due to the dependence on the --- `pactl subscribe` command. in the future it would be advantageous to replace --- this. currently it is (probably) only really possible with dbus. -awful.spawn.with_line_callback("pactl subscribe", { stdout = function(stdout) - --update_volume() -end }) - -update_volume() - -return widget.textbox diff --git a/awesome/widgets/ram.lua b/awesome/widgets/ram.lua index 2347ca4..44ab314 100644 --- a/awesome/widgets/ram.lua +++ b/awesome/widgets/ram.lua @@ -1,6 +1,5 @@ local wibox = require("wibox") local widgets = require("util.widgets") -local osname = require("util.osname") function linux_ram_usage(widget) @@ -27,7 +26,6 @@ function linux_ram_usage(widget) widget:set_text(math.floor(used)) end - -- return correct widget for os if osname == "Linux" then return widgets.watchfn(linux_ram_usage, 5) diff --git a/awesome/widgets/temperature.lua b/awesome/widgets/temperature.lua index 985291d..a30e1ed 100644 --- a/awesome/widgets/temperature.lua +++ b/awesome/widgets/temperature.lua @@ -1,6 +1,5 @@ local wibox = require("wibox") local widgets = require("util.widgets") -local osname = require("util.osname") local linux = { file = nil } @@ -16,7 +15,6 @@ function linux.temperature(widget) end end - -- return correct widget for os if osname == "Linux" then return function(file) |