alsa -> pipewire
This commit is contained in:
@@ -30,17 +30,7 @@ namespace
|
||||
bool has_child;
|
||||
Proc child;
|
||||
|
||||
Cmd browser(
|
||||
#if !defined(PULSEAUDIO) && !defined(PIPEWIRE)
|
||||
"apulse",
|
||||
#endif
|
||||
BROWSER);
|
||||
|
||||
Cmd amixer("amixer"
|
||||
#if defined(PULSEAUDIO)
|
||||
,"-Dpulse"
|
||||
#endif
|
||||
);
|
||||
Cmd browser(BROWSER);
|
||||
|
||||
Cmd low_battery_notify("notify-send", "--urgency=critical", "Battery Low");
|
||||
}
|
||||
@@ -209,19 +199,23 @@ extern "C"
|
||||
catch(...){ cerr << "EXCEPT\n"; }
|
||||
|
||||
// Volume
|
||||
string amix_out = $(amixer + "get" + AUDIO_DEV);
|
||||
size_t vol_bracket = amix_out.find('[');
|
||||
string vol_out = $({"wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@"});
|
||||
size_t vol_begin = vol_out.find(' ');
|
||||
|
||||
if(vol_bracket != string::npos)
|
||||
if(vol_begin != string::npos)
|
||||
{
|
||||
bool is_muted = amix_out.find("[on]") == string::npos;
|
||||
bool is_muted = vol_out.find("[MUTED]") != string::npos;
|
||||
new_stat += is_muted ? "🔇" : "🔉";
|
||||
|
||||
size_t first_digit = vol_bracket + 1;
|
||||
size_t close_bracket = amix_out.find(']', first_digit);
|
||||
new_stat.append(amix_out, first_digit, close_bracket - first_digit);
|
||||
size_t first_digit = vol_begin + 1;
|
||||
size_t vol_end = vol_out.find(' ', first_digit);
|
||||
|
||||
new_stat += ' ';
|
||||
if(vol_end == string::npos)
|
||||
vol_end = vol_out.size() + 1;
|
||||
|
||||
float vol = stof( vol_out.substr(first_digit, vol_end - first_digit) );
|
||||
|
||||
new_stat += to_string(int(vol * 100)) + "% ";
|
||||
}
|
||||
|
||||
// Time
|
||||
@@ -334,28 +328,28 @@ extern "C"
|
||||
|
||||
void vene_inc_vol(const Arg*)
|
||||
{
|
||||
Cmd inc_vol(amixer + "-q" + "set" + AUDIO_DEV + "3%+");
|
||||
Cmd inc_vol("wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "3%+");
|
||||
child = detach(inc_vol);
|
||||
has_child = true;
|
||||
}
|
||||
|
||||
void vene_dec_vol(const Arg*)
|
||||
{
|
||||
Cmd dec_vol(amixer + "-q" + "set" + AUDIO_DEV + "3%-");
|
||||
Cmd dec_vol("wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "3%-");
|
||||
child = detach(dec_vol);
|
||||
has_child = true;
|
||||
}
|
||||
|
||||
void vene_toggle_vol(const Arg*)
|
||||
{
|
||||
Cmd toggle_vol(amixer + "-q" + "set" + AUDIO_DEV + "toggle");
|
||||
Cmd toggle_vol("wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle");
|
||||
child = detach(toggle_vol);
|
||||
has_child = true;
|
||||
}
|
||||
|
||||
void vene_toggle_mic(const Arg*)
|
||||
{
|
||||
Cmd toggle_mic(amixer + "-q" + "set" + "Capture" + "toggle");
|
||||
Cmd toggle_mic("wpctl", "set-mute", "@DEFAULT_AUDIO_SOURCE@", "toggle");
|
||||
child = detach(toggle_mic);
|
||||
has_child = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user