From 9eed8fb9c19519bb229c1e6d1f429de8b4c61be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Sat, 13 Aug 2022 10:08:59 -0300 Subject: [PATCH] add volume notification and changing sound effect --- user/rofi.nix | 15 ++++++------ user/scripts/volumesh | 12 +++++----- user/sway.nix | 54 +++++++++++++++++++++---------------------- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/user/rofi.nix b/user/rofi.nix index 495ac55..fc8411e 100644 --- a/user/rofi.nix +++ b/user/rofi.nix @@ -27,7 +27,7 @@ in { # foreground-color = mkLiteral color.txt; text-color = mkLiteral color.txt; # background-color = mkLiteral color.bg; - background-color= mkLiteral "transparent"; + background-color = mkLiteral "transparent"; # width = 512; }; @@ -54,21 +54,20 @@ in { # }; "#element" = { # text-color = mkLiteral "#252525"; - background-color= mkLiteral "transparent"; + background-color = mkLiteral "transparent"; padding = mkLiteral "3px 10px"; }; "#element selected" = { # text-color = mkLiteral "#252525"; background-color = mkLiteral accent.color; }; - element-icon= { - # background-color= inherit; - # text-color= inherit; - margin-right = mkLiteral "20px"; - size = 24; + element-icon = { + # background-color= inherit; + # text-color= inherit; + margin-right = mkLiteral "20px"; + size = 24; }; - }; }; diff --git a/user/scripts/volumesh b/user/scripts/volumesh index 86726c1..355c26a 100755 --- a/user/scripts/volumesh +++ b/user/scripts/volumesh @@ -38,26 +38,26 @@ min() { } # Pulse{{{ -get_vol_pulse() { +get_vol_system() { pamixer --get-volume } -is_muted_pulse() { +is_muted_system() { pamixer --get-mute >/dev/null } -change_vol_pulse() { +change_vol_system() { pamixer "-$1" "$(min 120 $2)" round_vol pamixer --set-volume "${newvol}" - if + if test -n "$VOLUME_CHANGE_SOUND" then paplay "$VOLUME_CHANGE_SOUND" fi } -toggle_mute_pulse() { +toggle_mute_system() { pactl set-sink-mute @DEFAULT_SINK@ toggle } #}}} @@ -95,7 +95,7 @@ usage() { exit "$1" } -TARGET=pulse +TARGET=system while [ $# -gt 0 ]; do case $1 in diff --git a/user/sway.nix b/user/sway.nix index 9713577..b6d1754 100644 --- a/user/sway.nix +++ b/user/sway.nix @@ -104,13 +104,24 @@ in { { class = "WebCord"; } ]; }; - modes = let return_mode = lib.mapAttrs (k: v: "${v}; mode default"); + modes = let + locked_binds = + lib.mapAttrs' (k: v: lib.nameValuePair "--locked ${k}" v); + code_binds = + lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v); + return_mode = lib.mapAttrs (k: v: "${v}; mode default"); in { - audio = { - ${key.tabL} = "volumes decrease"; - } // return_mode { + audio = code_binds (locked_binds { + ${key.tabR} = "exec volumesh -i 10"; + ${key.tabL} = "exec volumesh -d 10"; + ${key.right} = "exec mpc next"; + ${key.left} = "exec mpc prev"; + ${key.up} = "exec volumesh --mpd -i 10"; + ${key.down} = "exec volumesh --mpd -d 10"; + }) // return_mode { "space" = "exec mpc toggle"; "escape" = ""; + "q" = ""; "s" = "exec ${pulse_sink}/bin/pulse_sink"; }; }; @@ -365,25 +376,24 @@ in { margin = "15"; layer = "overlay"; + font = "${font.interface} ${toString font.size.small}"; + textColor = color.txt; + backgroundColor = color.bg; borderColor = accent.color; progressColor = "over ${accent.color}88"; defaultTimeout = 10000; + + extraConfig = '' + [app-name=volumesh] + default-timeout=5000 + group-by=app-name + format=%s\n%b + ''; + # # {{@@ header() @@}} # # text - # font={{@@ font.interface @@}} {{@@ font.size.small @@}} - # text-color={{@@ color.txt @@}} - - # # colors - # background-color={{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}} - # border-color={{@@ accent_color @@}} - # progress-color=over {{@@ accent_color @@}}88 - - # # decoration - # border-size=2 - # padding=5 - # margin=15 # # features # icons=1 @@ -394,18 +404,6 @@ in { # # position # layer=overlay - # [app-name=volumesh] - # default-timeout=5000 - # group-by=app-name - # format=%s\n%b - - # [app-name=dotdrop] - # default-timeout=5000 - # group-by=app-name - # format=%s\n%b - - # # vim: ft=ini - }; };