Fixed mpc volume and title
This commit is contained in:
		| @ -31,7 +31,7 @@ for k, l in pairs(config.ibus.language_list) do | ||||
|  | ||||
| 	l["widget_text"] = wibox.widget { | ||||
| 		{ | ||||
| 			markup = "" .. l["title"] .. "", | ||||
| 			text = "" .. l["title"] .. "", | ||||
| 			align  = "left", | ||||
| 			valign = "center", | ||||
| 			font = config.core.font.normal_large, | ||||
|  | ||||
| @ -53,8 +53,8 @@ widget.widget:connect_signal("mouse::leave", function(result) | ||||
| end) | ||||
|  | ||||
| widget.update = function() | ||||
| 	widget.ibus_indicator_text.markup = config.ibus.language_list[util.current_engine_index]["indicator_code"] | ||||
| 	widget.xkb_indicator_text.markup = util.current_xkbmap | ||||
| 	widget.ibus_indicator_text.text = config.ibus.language_list[util.current_engine_index]["indicator_code"] | ||||
| 	widget.xkb_indicator_text.text = util.current_xkbmap | ||||
| end | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -132,6 +132,20 @@ mpc_widget.left:connect_signal("button::press", | ||||
| 	end | ||||
| ) | ||||
|  | ||||
|  | ||||
| --[[ | ||||
| function pango.escape(text) | ||||
| 	local replacements = { | ||||
| 		["&"] = "&", | ||||
| 		["<"] = "<", | ||||
| 		[">"] = ">", | ||||
| 		["\""] = """, | ||||
| 		["'"] = "'", | ||||
| 	} | ||||
| 	return string.gsub(text, "[&<>'\"]", replacements) | ||||
| end | ||||
| ]]-- | ||||
|  | ||||
| mpc_widget.readupdate = function() | ||||
| 	-- Update title and artist | ||||
| 	mpc.mpc_command("current --format \"title=%title% artist=%artist%\"", | ||||
| @ -140,8 +154,11 @@ mpc_widget.readupdate = function() | ||||
| 				return | ||||
| 			end | ||||
|  | ||||
| 			mpc_widget.title.markup = string.match(stdout, "title=(.*)artist=") | ||||
| 			mpc_widget.artist.markup = string.match(stdout, "artist=(.*)") | ||||
| 			--debug_message(stdout); | ||||
| 			--debug_message(string.match(stdout, "title=(.*)artist=")); | ||||
|  | ||||
| 			mpc_widget.title.text = string.match(stdout, "title=(.*)artist=") | ||||
| 			mpc_widget.artist.text = string.match(stdout, "artist=(.*)") | ||||
| 		end | ||||
| 	) | ||||
|  | ||||
| @ -160,11 +177,12 @@ mpc_widget.readupdate = function() | ||||
| 				mpc_widget.icon_play.image = beautiful.icons.music.blue.stopped | ||||
| 			end | ||||
|  | ||||
| 			local volume = string.match(stdout, "volume: (%d?%d?%d)%%") | ||||
| 			local volume = string.match(stdout, "volume: ?(%d?%d?%d)%%") | ||||
|  | ||||
| 			if (volume) then | ||||
| 				mpc_widget.volume.markup = volume .. "%" | ||||
| 				mpc_widget.volume.text = volume .. "%" | ||||
| 			else | ||||
| 				mpc_widget.volume.markup = "" | ||||
| 				mpc_widget.volume.text = "" | ||||
| 			end | ||||
| 		end | ||||
| 	) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user