mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
parent
85ae4cca37
commit
db53cf9245
4 changed files with 7 additions and 4 deletions
|
@ -42,6 +42,7 @@ endif
|
||||||
|
|
||||||
# Common dependencies
|
# Common dependencies
|
||||||
dl = cc.find_library('dl')
|
dl = cc.find_library('dl')
|
||||||
|
m = cc.find_library('m')
|
||||||
threads = dependency('threads')
|
threads = dependency('threads')
|
||||||
pixman = dependency('pixman-1')
|
pixman = dependency('pixman-1')
|
||||||
yaml = dependency('yaml-0.1')
|
yaml = dependency('yaml-0.1')
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ content(struct module *mod)
|
||||||
struct private *m = mod->private;
|
struct private *m = mod->private;
|
||||||
|
|
||||||
int percent = m->vol_max - m->vol_min > 0
|
int percent = m->vol_max - m->vol_min > 0
|
||||||
? 100 * m->vol_cur / (m->vol_max - m->vol_min)
|
? round(100. * m->vol_cur / (m->vol_max - m->vol_min))
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
mtx_lock(&mod->lock);
|
mtx_lock(&mod->lock);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
@ -46,7 +47,7 @@ content(struct module *mod)
|
||||||
|
|
||||||
const long current = m->current_brightness;
|
const long current = m->current_brightness;
|
||||||
const long max = m->max_brightness;
|
const long max = m->max_brightness;
|
||||||
const long percent = max > 0 ? 100 * current / max : 0;
|
const long percent = max > 0 ? round(100. * current / max) : 0;
|
||||||
|
|
||||||
struct tag_set tags = {
|
struct tag_set tags = {
|
||||||
.tags = (struct tag *[]){
|
.tags = (struct tag *[]){
|
||||||
|
|
|
@ -10,8 +10,8 @@ xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
|
||||||
|
|
||||||
# Module name -> (source-list, dep-list)
|
# Module name -> (source-list, dep-list)
|
||||||
deps = {
|
deps = {
|
||||||
'alsa': [[], [alsa]],
|
'alsa': [[], [m, alsa]],
|
||||||
'backlight': [[], [udev]],
|
'backlight': [[], [m, udev]],
|
||||||
'battery': [[], [udev]],
|
'battery': [[], [udev]],
|
||||||
'clock': [[], []],
|
'clock': [[], []],
|
||||||
'i3': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
|
'i3': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue