Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e365e295f3 | |||
|
|
469e684143 |
||
|
|
38cadc6427 |
||
|
|
fe538a7a2f |
||
|
|
8ebe985db8 |
||
|
|
dea248b824 |
||
|
|
12d4decdd4 |
||
|
|
c42a4215c8 |
||
|
|
56e6e2ef64 |
||
|
|
5f45160b65 |
17 changed files with 99 additions and 63 deletions
8
Makefile
8
Makefile
|
|
@ -5,6 +5,7 @@ BUILD_DIR := build
|
||||||
SRC_DIR := src
|
SRC_DIR := src
|
||||||
INC_DIR := include
|
INC_DIR := include
|
||||||
|
|
||||||
|
DEBUG := 0
|
||||||
VERBOSE := 0
|
VERBOSE := 0
|
||||||
LIBS := xcb-atom
|
LIBS := xcb-atom
|
||||||
|
|
||||||
|
|
@ -26,6 +27,10 @@ ifeq ($(VERBOSE), 0)
|
||||||
Q := @
|
Q := @
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DEBUG), 1)
|
||||||
|
CFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
all: $(BUILD_DIR)/$(BIN)
|
all: $(BUILD_DIR)/$(BIN)
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c config.h
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c config.h
|
||||||
|
|
@ -33,7 +38,6 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c config.h
|
||||||
$(PRINTF) "CC" $@
|
$(PRINTF) "CC" $@
|
||||||
$Q$(COMPILE.c) -o $@ $<
|
$Q$(COMPILE.c) -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
$(BUILD_DIR)/$(BIN): $(OBJS)
|
$(BUILD_DIR)/$(BIN): $(OBJS)
|
||||||
$(PRINTF) "LD" $@
|
$(PRINTF) "LD" $@
|
||||||
$Q$(LINK.o) $^ $(LDLIBS) -o $@
|
$Q$(LINK.o) $^ $(LDLIBS) -o $@
|
||||||
|
|
@ -45,6 +49,8 @@ clean:
|
||||||
install: $(BUILD_DIR)/$(BIN)
|
install: $(BUILD_DIR)/$(BIN)
|
||||||
$(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN)
|
$(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN)
|
||||||
$Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN)
|
$Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN)
|
||||||
|
cp ./bat.sh /usr/local/bin
|
||||||
|
cp ./wp.sh /usr/local/bin
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(PRINTF) "RM" $(INSTALL_DIR)/$(BIN)
|
$(PRINTF) "RM" $(INSTALL_DIR)/$(BIN)
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,8 @@ You can define your status bar blocks in `config.h`:
|
||||||
```c
|
```c
|
||||||
#define BLOCKS(X) \
|
#define BLOCKS(X) \
|
||||||
...
|
...
|
||||||
X("volume", 0, 5), \
|
X(" ", "wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f2", 0, 5) \
|
||||||
X("date", 1800, 1), \
|
X(" ", "date '+%H:%M:%S'", 1, 1) \
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -99,6 +99,7 @@ Each block has the following properties:
|
||||||
|
|
||||||
| Property | Description |
|
| Property | Description |
|
||||||
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| Icon | An icon you wish to prepend to your block output. |
|
||||||
| Command | The command you wish to execute in your block. |
|
| Command | The command you wish to execute in your block. |
|
||||||
| Update interval | Time in seconds, after which you want the block to update. If `0`, the block will never be updated. |
|
| Update interval | Time in seconds, after which you want the block to update. If `0`, the block will never be updated. |
|
||||||
| Update signal | Signal to be used for triggering the block. Must be a positive integer. If `0`, a signal won't be set up for the block and it will be unclickable. |
|
| Update signal | Signal to be used for triggering the block. Must be a positive integer. If `0`, a signal won't be set up for the block and it will be unclickable. |
|
||||||
|
|
|
||||||
14
bat.sh
Executable file
14
bat.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
||||||
|
status=$(cat /sys/class/power_supply/BAT0/status)
|
||||||
|
level=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||||
|
|
||||||
|
case $status in
|
||||||
|
Full)
|
||||||
|
echo $level%o
|
||||||
|
;;
|
||||||
|
Charging)
|
||||||
|
echo $level%+
|
||||||
|
;;
|
||||||
|
Discharging)
|
||||||
|
echo $level%-
|
||||||
|
;;
|
||||||
|
esac
|
||||||
21
config.h
21
config.h
|
|
@ -2,13 +2,13 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// String used to delimit block outputs in the status.
|
// String used to delimit block outputs in the status.
|
||||||
#define DELIMITER " "
|
#define DELIMITER " "
|
||||||
|
|
||||||
// Maximum number of Unicode characters that a block can output.
|
// Maximum number of Unicode characters that a block can output.
|
||||||
#define MAX_BLOCK_OUTPUT_LENGTH 45
|
#define MAX_BLOCK_OUTPUT_LENGTH 45
|
||||||
|
|
||||||
// Control whether blocks are clickable.
|
// Control whether blocks are clickable.
|
||||||
#define CLICKABLE_BLOCKS 1
|
#define CLICKABLE_BLOCKS 0
|
||||||
|
|
||||||
// Control whether a leading delimiter should be prepended to the status.
|
// Control whether a leading delimiter should be prepended to the status.
|
||||||
#define LEADING_DELIMITER 0
|
#define LEADING_DELIMITER 0
|
||||||
|
|
@ -16,17 +16,10 @@
|
||||||
// Control whether a trailing delimiter should be appended to the status.
|
// Control whether a trailing delimiter should be appended to the status.
|
||||||
#define TRAILING_DELIMITER 0
|
#define TRAILING_DELIMITER 0
|
||||||
|
|
||||||
// Define blocks for the status feed as X(cmd, interval, signal).
|
// Define blocks for the status feed as X(icon, cmd, interval, signal).
|
||||||
#define BLOCKS(X) \
|
#define BLOCKS(X) \
|
||||||
X("sb-mail", 600, 1) \
|
X(" ", "date +%H:%M:%S", 1, 1) \
|
||||||
X("sb-music", 0, 2) \
|
X(" ", "bat.sh", 1, 1) \
|
||||||
X("sb-disk", 1800, 3) \
|
X(" ", "wp.sh", 1, 1)
|
||||||
X("sb-memory", 10, 4) \
|
|
||||||
X("sb-loadavg", 5, 5) \
|
|
||||||
X("sb-mic", 0, 6) \
|
|
||||||
X("sb-record", 0, 7) \
|
|
||||||
X("sb-volume", 0, 8) \
|
|
||||||
X("sb-battery", 5, 9) \
|
|
||||||
X("sb-date", 1, 10)
|
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
#ifndef BLOCK_H
|
#ifndef BLOCK_H
|
||||||
#define BLOCK_H
|
#define BLOCK_H
|
||||||
|
|
||||||
#include <bits/stdint-uintn.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
const char *const icon;
|
||||||
const char *const command;
|
const char *const command;
|
||||||
const unsigned int interval;
|
const unsigned int interval;
|
||||||
const int signal;
|
const int signal;
|
||||||
|
|
@ -18,12 +19,11 @@ typedef struct {
|
||||||
pid_t fork_pid;
|
pid_t fork_pid;
|
||||||
} block;
|
} block;
|
||||||
|
|
||||||
block block_new(const char *const command, const unsigned int interval,
|
block block_new(const char *const icon, const char *const command,
|
||||||
const int signal);
|
const unsigned int interval, const int signal);
|
||||||
int block_init(block *const block);
|
int block_init(block *const block);
|
||||||
int block_deinit(block *const block);
|
int block_deinit(block *const block);
|
||||||
int block_execute(block *const block, const uint8_t button);
|
int block_execute(block *const block, const uint8_t button);
|
||||||
int block_update(block *const block);
|
int block_update(block *const block);
|
||||||
bool block_must_run(const block *const block, const unsigned int time);
|
|
||||||
|
|
||||||
#endif // BLOCK_H
|
#endif // BLOCK_H
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ typedef struct {
|
||||||
bool is_debug_mode;
|
bool is_debug_mode;
|
||||||
} cli_arguments;
|
} cli_arguments;
|
||||||
|
|
||||||
int cli_init(cli_arguments* const args, const char* const argv[],
|
cli_arguments cli_parse_arguments(const char* const argv[], const int argc);
|
||||||
const int argc);
|
|
||||||
|
|
||||||
#endif // CLI_H
|
#endif // CLI_H
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef SIGNAL_HANDLER_H
|
#ifndef SIGNAL_HANDLER_H
|
||||||
#define SIGNAL_HANDLER_H
|
#define SIGNAL_HANDLER_H
|
||||||
|
|
||||||
#include <bits/types/sigset_t.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#define TIMER_H
|
#define TIMER_H
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
|
||||||
|
|
@ -15,5 +16,6 @@ typedef struct {
|
||||||
|
|
||||||
timer timer_new(const block *const blocks, const unsigned short block_count);
|
timer timer_new(const block *const blocks, const unsigned short block_count);
|
||||||
int timer_arm(timer *const timer);
|
int timer_arm(timer *const timer);
|
||||||
|
bool timer_must_run_block(const timer *const timer, const block *const block);
|
||||||
|
|
||||||
#endif // TIMER_H
|
#endif // TIMER_H
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef WATCHER_H
|
#ifndef WATCHER_H
|
||||||
#define WATCHER_H
|
#define WATCHER_H
|
||||||
|
|
||||||
|
#include <poll.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/poll.h>
|
|
||||||
|
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
|
||||||
20
src/block.c
20
src/block.c
|
|
@ -1,9 +1,8 @@
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
|
||||||
#include <bits/stdint-uintn.h>
|
|
||||||
#include <bits/types/FILE.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -14,9 +13,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
block block_new(const char *const command, const unsigned int interval,
|
block block_new(const char *const icon, const char *const command,
|
||||||
const int signal) {
|
const unsigned int interval, const int signal) {
|
||||||
block block = {
|
block block = {
|
||||||
|
.icon = icon,
|
||||||
.command = command,
|
.command = command,
|
||||||
.interval = interval,
|
.interval = interval,
|
||||||
.signal = signal,
|
.signal = signal,
|
||||||
|
|
@ -145,15 +145,3 @@ int block_update(block *const block) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool block_must_run(const block *const block, const unsigned int time) {
|
|
||||||
if (time == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block->interval == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return time % block->interval == 0;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
21
src/cli.c
21
src/cli.c
|
|
@ -1,30 +1,33 @@
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int cli_init(cli_arguments *const args, const char *const argv[],
|
cli_arguments cli_parse_arguments(const char* const argv[], const int argc) {
|
||||||
const int argc) {
|
errno = 0;
|
||||||
args->is_debug_mode = false;
|
cli_arguments args = {
|
||||||
|
.is_debug_mode = false,
|
||||||
|
};
|
||||||
|
|
||||||
int opt = -1;
|
int opt = -1;
|
||||||
opterr = 0; // Suppress getopt's built-in invalid opt message
|
opterr = 0; // Suppress getopt's built-in invalid opt message
|
||||||
while ((opt = getopt(argc, (char *const *)argv, "dh")) != -1) {
|
while ((opt = getopt(argc, (char* const*)argv, "dh")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'd':
|
case 'd':
|
||||||
args->is_debug_mode = true;
|
args.is_debug_mode = true;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
// fall through
|
|
||||||
case '?':
|
case '?':
|
||||||
(void)fprintf(stderr, "error: unknown option `-%c'\n", optopt);
|
(void)fprintf(stderr, "error: unknown option `-%c'\n", optopt);
|
||||||
// fall through
|
// fall through
|
||||||
|
case 'h':
|
||||||
|
// fall through
|
||||||
default:
|
default:
|
||||||
(void)fprintf(stderr, "usage: %s [-d]\n", BINARY);
|
(void)fprintf(stderr, "usage: %s [-d]\n", BINARY);
|
||||||
return 1;
|
errno = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
src/main.c
16
src/main.c
|
|
@ -1,5 +1,6 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
@ -38,10 +39,10 @@ static int deinit_blocks(block *const blocks,
|
||||||
|
|
||||||
static int execute_blocks(block *const blocks,
|
static int execute_blocks(block *const blocks,
|
||||||
const unsigned short block_count,
|
const unsigned short block_count,
|
||||||
const unsigned int time) {
|
const timer *const timer) {
|
||||||
for (unsigned short i = 0; i < block_count; ++i) {
|
for (unsigned short i = 0; i < block_count; ++i) {
|
||||||
block *const block = &blocks[i];
|
block *const block = &blocks[i];
|
||||||
if (!block_must_run(block, time)) {
|
if (!timer_must_run_block(timer, block)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ static int execute_blocks(block *const blocks,
|
||||||
|
|
||||||
static int trigger_event(block *const blocks, const unsigned short block_count,
|
static int trigger_event(block *const blocks, const unsigned short block_count,
|
||||||
timer *const timer) {
|
timer *const timer) {
|
||||||
if (execute_blocks(blocks, block_count, timer->time) != 0) {
|
if (execute_blocks(blocks, block_count, timer) != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,7 +69,7 @@ static int trigger_event(block *const blocks, const unsigned short block_count,
|
||||||
|
|
||||||
static int refresh_callback(block *const blocks,
|
static int refresh_callback(block *const blocks,
|
||||||
const unsigned short block_count) {
|
const unsigned short block_count) {
|
||||||
if (execute_blocks(blocks, block_count, 0) != 0) {
|
if (execute_blocks(blocks, block_count, NULL) != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,8 +118,8 @@ static int event_loop(block *const blocks, const unsigned short block_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(const int argc, const char *const argv[]) {
|
int main(const int argc, const char *const argv[]) {
|
||||||
cli_arguments cli_args;
|
const cli_arguments cli_args = cli_parse_arguments(argv, argc);
|
||||||
if (cli_init(&cli_args, argv, argc) != 0) {
|
if (errno != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +128,8 @@ int main(const int argc, const char *const argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BLOCK(command, interval, signal) block_new(command, interval, signal),
|
#define BLOCK(icon, command, interval, signal) \
|
||||||
|
block_new(icon, command, interval, signal),
|
||||||
block blocks[BLOCK_COUNT] = {BLOCKS(BLOCK)};
|
block blocks[BLOCK_COUNT] = {BLOCKS(BLOCK)};
|
||||||
#undef BLOCK
|
#undef BLOCK
|
||||||
const unsigned short block_count = LEN(blocks);
|
const unsigned short block_count = LEN(blocks);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "signal-handler.h"
|
#include "signal-handler.h"
|
||||||
|
|
||||||
#include <bits/stdint-uintn.h>
|
|
||||||
#include <bits/types/sigset_t.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/signalfd.h>
|
#include <sys/signalfd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -110,6 +109,8 @@ int signal_handler_process(signal_handler *const handler, timer *const timer) {
|
||||||
// fall through
|
// fall through
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
return 1;
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned short i = 0; i < handler->block_count; ++i) {
|
for (unsigned short i = 0; i < handler->block_count; ++i) {
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ bool status_update(status *const status) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)strncat(status->current, block->icon, LEN(block->output));
|
||||||
(void)strncat(status->current, block->output, LEN(block->output));
|
(void)strncat(status->current, block->output, LEN(block->output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
src/timer.c
21
src/timer.c
|
|
@ -1,6 +1,7 @@
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
@ -32,10 +33,12 @@ static unsigned int compute_reset_value(const block *const blocks,
|
||||||
}
|
}
|
||||||
|
|
||||||
timer timer_new(const block *const blocks, const unsigned short block_count) {
|
timer timer_new(const block *const blocks, const unsigned short block_count) {
|
||||||
|
const unsigned int reset_value = compute_reset_value(blocks, block_count);
|
||||||
|
|
||||||
timer timer = {
|
timer timer = {
|
||||||
.time = 0,
|
.time = reset_value, // Initial value to execute all blocks.
|
||||||
.tick = compute_tick(blocks, block_count),
|
.tick = compute_tick(blocks, block_count),
|
||||||
.reset_value = compute_reset_value(blocks, block_count),
|
.reset_value = reset_value,
|
||||||
};
|
};
|
||||||
|
|
||||||
return timer;
|
return timer;
|
||||||
|
|
@ -51,7 +54,19 @@ int timer_arm(timer *const timer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap `time` to the interval [1, reset_value].
|
// Wrap `time` to the interval [1, reset_value].
|
||||||
timer->time = (timer->time + timer->tick) % timer->reset_value + 1;
|
timer->time = (timer->time + timer->tick) % timer->reset_value;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool timer_must_run_block(const timer *const timer, const block *const block) {
|
||||||
|
if (timer == NULL || timer->time == timer->reset_value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block->interval == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return timer->time % block->interval == 0;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#include "watcher.h"
|
#include "watcher.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <poll.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/poll.h>
|
|
||||||
|
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
||||||
11
wp.sh
Executable file
11
wp.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
vol=$(echo "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk -F' ' '{print $2}') * 100" | bc)
|
||||||
|
status=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q "[MUTED]")
|
||||||
|
|
||||||
|
if wpctl get-volume @DEFAULT_AUDIO_SINK@| grep -q "[MUTED]"; then
|
||||||
|
echo "mut": $vol%
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo vol: $vol%
|
||||||
Loading…
Reference in a new issue