Comments (1)
I figured it out
local GET_MPD_CMD = "mpc -p 7600 status"
local TOGGLE_MPD_CMD = "mpc -p 7600 toggle"
local mpd_status = function()
local ret = {}
ret.text = 'Loading'
ret.alert = false
ret.value = 0.5
local line = redutil.read.output(GET_MPD_CMD)
local stdout = string.gsub(line, "\n", "")
local mpdpercent = string.match(stdout, "(%d+)%%")
if string.match(stdout, "%[playing]") then
local value = tonumber(mpdpercent/100)
ret.value = value
ret.text = 'MPD: '.. mpdpercent .. '% utworu'
elseif string.match(stdout, "%[paused]") then
local value = tonumber(mpdpercent/100)
ret.value = value
ret.text = 'MPD: '..mpdpercent .. '% utworu'
ret.alert = true
elseif string.match(stdout, "MPD error") then
ret.value = 1
ret.text = "MPD: niepodłączone"
ret.alert = false
else
ret.value = 1
ret.text = "Sprawdź rc-orange.lua +261"
ret.alert = true
end
return ret
end
sysmon.widget.mpd = redflat.widget.sysmon(
{ func = mpd_status },
{ timeout = 1, widget = redflat.gauge.monitor.circle }
)
sysmon.buttons.mpd = awful.util.table.join(
awful.button({ }, 1, function() awful.spawn(TOGGLE_MPD_CMD) end)
)
from redflat.
Related Issues (20)
- Process names with spaces not correctly recognized by system.lua HOT 2
- Task tooltip UX behavior for single clients HOT 4
- Hello how can I install it on arch? HOT 2
- Application launcher fails when program.Name is nil HOT 2
- menu.add_size should be positive HOT 2
- Modifying for HiDPI? HOT 4
- Minitray not drawing background HOT 4
- Mini tray double background
- The error popup is very small HOT 3
- readme or documentation HOT 2
- layout problem on the desktop HOT 1
- "User Map" layout breaks on toggling maximized window HOT 2
- When moving wibar to the top the minitray widget keeps popped up from the bottom HOT 4
- Pulse widget does not update default sink when headset is connected HOT 2
- Qlaunch does not accept any input (mouse and keyboard) HOT 4
- Borderless maximized windows HOT 3
- Initial key registered twice by keychain HOT 1
- Desktop widgets appearing on wrong screen.
- Grid layout multimonitor error popup message HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redflat.