Skip to content

Commit

Permalink
alsabar: added argument for maximum number of ticks in notification; #…
Browse files Browse the repository at this point in the history
  • Loading branch information
lcpz committed Aug 12, 2019
1 parent e8a34ec commit bd636ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
26 changes: 15 additions & 11 deletions widget/alsabar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ local function factory(args)
alsabar.notification_preset = args.notification_preset

if not alsabar.notification_preset then
alsabar.notification_preset = {}
alsabar.notification_preset.font = "Monospace 10"
alsabar.notification_preset = { font = "Monospace 10" }
end

local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel)
Expand Down Expand Up @@ -115,16 +114,21 @@ local function factory(args)
end

-- tot is the maximum number of ticks to display in the notification
-- fallback: default horizontal wibox height
local wib, tot = awful.screen.focused().mywibox, 20

-- if we can grab mywibox, tot is defined as its height if
-- horizontal, or width otherwise
if wib then
if wib.position == "left" or wib.position == "right" then
tot = wib.width
local tot = alsabar.notification_preset.max_ticks

if not tot then
local wib = awful.screen.focused().mywibox
-- if we can grab mywibox, tot is defined as its height if
-- horizontal, or width otherwise
if wib then
if wib.position == "left" or wib.position == "right" then
tot = wib.width
else
tot = wib.height
end
-- fallback: default horizontal wibox height
else
tot = wib.height
tot = 20
end
end

Expand Down
2 changes: 1 addition & 1 deletion widget/temp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local function factory(args)
local settings = args.settings or function() end

function temp.update()
helpers.async({"find", "/sys/devices", "-type", "f", "-name", "*temp*"}, function(f)
helpers.async({"find", "/sys/devices/virtual/thermal", "-type", "f", "-name", "*temp*"}, function(f)

This comment has been minimized.

Copy link
@hcbraun

hcbraun Aug 21, 2019

This broke my setup. For my AMD Ryzen the device is at:
/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon0/temp1_input

temp_now = {}
local temp_fl, temp_value
for t in f:gmatch("[^\n]+") do
Expand Down
2 changes: 1 addition & 1 deletion wiki
Submodule wiki updated from d7fd4d to e37a9e

0 comments on commit bd636ca

Please sign in to comment.