Fixing markdown...

This commit is contained in:
bzgec 2021-04-02 11:38:54 +02:00
parent 3a917fe892
commit 4849730abd
3 changed files with 67 additions and 59 deletions

View File

@ -22,7 +22,7 @@ to improve your Awesome setup.
* [Battery Indicator (UPower)](https://github.com/stefano-m/awesome-power_widget) * [Battery Indicator (UPower)](https://github.com/stefano-m/awesome-power_widget)
* [[Google Play Music Desktop Player|recipes/gpmdp]] * [[Google Play Music Desktop Player|recipes/gpmdp]]
* [Set of simple widgets](https://github.com/streetturtle/awesome-wm-widgets) - widgets for battery, cpu, brightness, volume, email, etc. * [Set of simple widgets](https://github.com/streetturtle/awesome-wm-widgets) - widgets for battery, cpu, brightness, volume, email, etc.
* [Microphone state](../recipes/mic) * [[Microphone state|recipes/mic]]
## Libraries ## Libraries

View File

@ -5,51 +5,55 @@
# Microphone state widget/watcher # Microphone state widget/watcher
This widget can be used to display the current microphone status. This widget can be used to display the current microphone status.
## Requirements ## Requirements
- `amixer` - this command is used to get and toggle microphone state - `amixer` - this command is used to get and toggle microphone state
## Usage ## Usage
- Download [mic.lua](https://awesomewm.org/recipes/mic.lua) file and put it into awesome's - Download [mic.lua](https://awesomewm.org/recipes/mic.lua) file and put it into awesome's
folder (like `~/.config/awesome/widgets/mic.lua`) folder (like `~/.config/awesome/widgets/mic.lua`)
- Add widget to `theme.lua`: - Add widget to `theme.lua`:
```lua ```lua
local widgets = { local widgets = {
mic = require("widgets/mic"), mic = require("widgets/mic"),
} }
theme.mic = widgets.mic({ theme.mic = widgets.mic({
timeout = 10, timeout = 10,
settings = function(self) settings = function(self)
if self.state == "muted" then if self.state == "muted" then
self.widget:set_image(theme.widget_micMuted) self.widget:set_image(theme.widget_micMuted)
else else
self.widget:set_image(theme.widget_micUnmuted) self.widget:set_image(theme.widget_micUnmuted)
end end
end end
}) })
local widget_mic = wibox.widget { theme.mic.widget, layout = wibox.layout.align.horizontal } local widget_mic = wibox.widget { theme.mic.widget, layout = wibox.layout.align.horizontal }
``` ```
- Create a shortcut to toggle microphone state (add to `rc.lua`): - Create a shortcut to toggle microphone state (add to `rc.lua`):
```lua ```lua
-- Toggle microphone state -- Toggle microphone state
awful.key({ modkey, "Shift" }, "m", awful.key({ modkey, "Shift" }, "m",
function () function ()
beautiful.mic:toggle() beautiful.mic:toggle()
end, end,
{description = "Toggle microphone (amixer)", group = "Hotkeys"} {description = "Toggle microphone (amixer)", group = "Hotkeys"}
), ),
``` ```
- You can also add a command to mute the microphone state on boot. Add this to your `rc.lua`: - You can also add a command to mute the microphone state on boot. Add this to your `rc.lua`:
```lua ```lua
-- Mute microphone on boot -- Mute microphone on boot
beautiful.mic:mute() beautiful.mic:mute()
``` ```
--]] --]]

View File

@ -1,46 +1,50 @@
# Microphone state widget/watcher # Microphone state widget/watcher
This widget can be used to display the current microphone status. This widget can be used to display the current microphone status.
## Requirements ## Requirements
- `amixer` - this command is used to get and toggle microphone state - `amixer` - this command is used to get and toggle microphone state
## Usage ## Usage
- Download [mic.lua](https://awesomewm.org/recipes/mic.lua) file and put it into awesome's - Download [mic.lua](https://awesomewm.org/recipes/mic.lua) file and put it into awesome's
folder (like `~/.config/awesome/widgets/mic.lua`) folder (like `~/.config/awesome/widgets/mic.lua`)
- Add widget to `theme.lua`: - Add widget to `theme.lua`:
```lua ```lua
local widgets = { local widgets = {
mic = require("widgets/mic"), mic = require("widgets/mic"),
} }
theme.mic = widgets.mic({ theme.mic = widgets.mic({
timeout = 10, timeout = 10,
settings = function(self) settings = function(self)
if self.state == "muted" then if self.state == "muted" then
self.widget:set_image(theme.widget_micMuted) self.widget:set_image(theme.widget_micMuted)
else else
self.widget:set_image(theme.widget_micUnmuted) self.widget:set_image(theme.widget_micUnmuted)
end end
end end
}) })
local widget_mic = wibox.widget { theme.mic.widget, layout = wibox.layout.align.horizontal } local widget_mic = wibox.widget { theme.mic.widget, layout = wibox.layout.align.horizontal }
``` ```
- Create a shortcut to toggle microphone state (add to `rc.lua`): - Create a shortcut to toggle microphone state (add to `rc.lua`):
```lua ```lua
-- Toggle microphone state -- Toggle microphone state
awful.key({ modkey, "Shift" }, "m", awful.key({ modkey, "Shift" }, "m",
function () function ()
beautiful.mic:toggle() beautiful.mic:toggle()
end, end,
{description = "Toggle microphone (amixer)", group = "Hotkeys"} {description = "Toggle microphone (amixer)", group = "Hotkeys"}
), ),
``` ```
- You can also add a command to mute the microphone state on boot. Add this to your `rc.lua`: - You can also add a command to mute the microphone state on boot. Add this to your `rc.lua`:
```lua ```lua
-- Mute microphone on boot -- Mute microphone on boot
beautiful.mic:mute() beautiful.mic:mute()
``` ```