添加状态栏和调整音量的快捷键

This commit is contained in:
2025-08-27 06:51:07 +08:00
parent 96629c3045
commit c5e2b4c081
10 changed files with 552 additions and 9 deletions

View File

@@ -12,7 +12,8 @@ uint32_t *generate_wallpaper(const wallpaper_config_t *wallpaper_config,
uint32_t get_font_height(const char *font_family, const uint32_t font_size,
const uint32_t dpi);
void draw_bar(monitor_t *monitor, bool is_current_monitor,
void draw_bar(monitor_t *monitor, bool is_current_monitor, status_t *status,
color_set_t *color_set, uint32_t height, uint32_t tag_x_padding,
uint32_t layout_x_padding, uint32_t client_name_x_padding);
uint32_t layout_x_padding, uint32_t client_name_x_padding,
uint32_t status_x_padding);
void clean_pango_context(void);

View File

@@ -119,3 +119,44 @@ typedef struct color_set_t {
color_t border_color;
color_t active_border_color;
} color_set_t;
typedef struct {
char mem_used_text[32];
char swap_used_text[32];
float mem_percent;
float swap_percent;
uint64_t mem_used;
uint64_t swap_used;
uint64_t mem_total;
uint64_t mem_free;
uint64_t buffers;
uint64_t cached;
uint64_t swap_total;
uint64_t swap_free;
uint64_t s_reclaimable;
} memory_usage_t;
typedef struct {
uint64_t rx_bytes;
uint64_t tx_bytes;
char up[128];
char down[128];
} net_speed_t;
typedef struct {
uint32_t index;
int mute;
int avg_volume; /* 各通道平均音量(百分比) */
int volumes[5]; /* 各通道音量(百分比) */
char device[512]; /* 音频设备名称 */
} pulse_t;
typedef struct {
pulse_t pulse;
net_speed_t net_speed;
memory_usage_t mem_usage;
double cpu_usage_percent;
char time[256];
} status_t;

View File

@@ -10,8 +10,13 @@
#define LENGTH(X) (sizeof(X) / sizeof(X)[0])
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
double get_time();
void die(const char *format, ...);