Comments (6)
I updated it a bit to also show a bluetooth symbol if bluetooth speakers are used, works for me but port name might be different for others
# Colors
gray = '%{F\\#989898}'
green = '%{F\\#9fbc00}'
blue = '%{F\\#0000ff}'
pink = '%{F\\#f268ae}'
light_blue = '%{F\\#28b4c9}'
purple = '%{F\\#b057fd}'
bright_green = '%{F\\#d3f1e3}'
# Volume status
vol_off_symb = gray + '\ue202'
speaker_symb = purple + '\ue203'
headphone_symb = purple + '\ue0fd'
bluetooth_symb = blue + '\ue1b5'
vol_on_symb = '${if_match \"$pa_sink_active_port_name\" == \"analog-output-headphones\"}'
vol_on_symb += headphone_symb
vol_on_symb += '${else}'
vol_on_symb += '${if_match \"$pa_sink_active_port_name\" == \"headset-output\"}'
vol_on_symb += headphone_symb + bluetooth_symb
vol_on_symb += '${else}'
vol_on_symb += speaker_symb
vol_on_symb += '${endif}'
vol_on_symb += '${endif}'
volume = '${if_pa_sink_muted}' + vol_off_symb + '${else}' + vol_on_symb + '${endif}'
volume += gray + '${pa_sink_volume}%'
also added an indicator of wifi quality (similar to how battery was done)
########
# wifi #
########
wifi_icons = ['\ue218', '\ue219', '\ue21a']
wifi_delta = 100 / len(wifi_icons)
wifi_qual = '${wireless_link_qual_perc wlp0s20f3}'
wifi = ''
for i, icon in enumerate(wifi_icons[:-1]):
wifi += '${if_match ' + wifi_qual + ' < %d}' % ((i + 1) * wifi_delta)
wifi += light_blue + icon
wifi += '${else}'
wifi += light_blue + wifi_icons[-1] # 100 %
for _ in range(len(wifi_icons) - 1):
wifi += '${endif}'
wifi += gray + ' ' + wifi_qual + '%'
which gets added to my list of things as
conky_elements = [
test,
mail,
wifi,
volume,
disk_usage,
cpu,
ram,
# net_down_speed,
# net_up_speed,
battery,
uptime,
]
conky_text = ' '.join(conky_elements) + ' '
from barpyrus.
The $battery
variable comes from conky (see man conky
). Conky also comes with many options for displaying the volume (pa_sink_volume
, if_mixer_mute
, etc). Maybe this does directly what you are trying to accomplish.
Regarding the refresh rate, you can pass
config = {'update_interval': '2'}
to ConkyWidget
. For all available options here, see the section CONFIGURATION SETTINGS
in the conky man page.
I don't think it's possible to make conky refresh automatically when the volume changes. The best solution is probably to implement a volume control directly as a barpyrus widget.
from barpyrus.
Awesome thanks, I'll try this out!
from barpyrus.
Works great, first neither $mixer
nor $pa_sink_volume
worked for me but after installing conky-all
$pa_sink_volume
started working (but not $mixer
).
from barpyrus.
Here's how I added volume indicator:
gray = '%{F\\#989898}'
green = '%{F\\#9fbc00}'
vol_off_symb = gray + '\ue202'
speaker_symb = green + '\ue203'
headphone_symb = green + '\ue0fd'
vol_on_symb = '${if_match \"$pa_sink_active_port_name\" == \"analog-output-speaker\"}' + speaker_symb + '${else}' + headphone_symb + '${endif}'
conky_text = ''
conky_text += '${if_pa_sink_muted}' + vol_off_symb + '${else}' + vol_on_symb + '${endif}'
conky_text += gray + '${pa_sink_volume}% '
showing if volume is on/off and if headphone are plugged in.
from barpyrus.
Great! Thanks for sharing!
from barpyrus.
Related Issues (9)
- TypeError because self.readlines() is None on EOF HOT 2
- How to change color of HLWM Tags in bar? HOT 7
- barpyrus does not start anymore on Arch HOT 9
- cg.space results in AttributeError: 'LBPainter' object has no attribute 'spacing_font_width' HOT 1
- Siji symbols not displaying in bar HOT 8
- Wrong screen geometry when using xrandr's `--same-as` HOT 3
- Feature request: Only show the bar on mod key down like i3wm HOT 1
- Cilckable areas on conky items HOT 2
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 barpyrus.