nixos-config/user/sway/sway-modes.nix

103 lines
2.5 KiB
Nix
Raw Normal View History

2023-02-25 18:47:49 -03:00
{ config, pkgs, ... }:
let
inherit (pkgs.uservars)
key
accent
font
theme
;
2023-02-25 18:47:49 -03:00
inherit (theme) color;
inherit (pkgs) lib;
mod = "Mod4";
menu = "wlauncher";
terminal = "alacritty";
locked = lib.mapAttrs' (k: v: lib.nameValuePair "--locked ${k}" v);
to-code = lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v);
2023-11-21 18:01:20 -03:00
quit-mode = lib.mapAttrs (k: v: "${v}; mode default");
2023-02-25 18:47:49 -03:00
playerctl = "exec ${pkgs.playerctl}/bin/playerctl";
2023-11-21 18:01:20 -03:00
bind_group = opts: binds: lib.pipe binds opts;
2023-02-25 18:47:49 -03:00
in
{
wayland.windowManager.sway.config.modes = {
2023-11-21 18:01:20 -03:00
audio =
(bind_group
[
to-code
locked
]
{
${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";
}
)
// (bind_group
[
locked
quit-mode
]
{
"space" = "exec mpc toggle";
"escape" = "";
"q" = "";
}
)
// (bind_group [ quit-mode ] {
2023-11-21 18:01:20 -03:00
"m" = "exec volumesh -t";
"s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
2023-02-25 18:47:49 -03:00
2023-11-21 18:01:20 -03:00
"d" = "exec ${pkgs.musmenu}/bin/musmenu delete";
"f" = "exec ${pkgs.musmenu}/bin/musmenu search";
2023-02-25 18:47:49 -03:00
2023-11-21 18:01:20 -03:00
"a" = "exec ${pkgs.dzadd}/bin/dzadd";
2023-04-11 14:43:38 -03:00
2023-11-21 18:01:20 -03:00
"Shift+y" = "exec ${pkgs.musmenu}/bin/musmenu yank";
"Ctrl+a" = "exec ${pkgs.musmenu}/bin/musmenu padd";
"Ctrl+s" = "exec ${pkgs.musmenu}/bin/musmenu psave";
"Ctrl+o" = "exec ${pkgs.musmenu}/bin/musmenu pload";
"Ctrl+d" = "exec ${pkgs.musmenu}/bin/musmenu pdelete";
})
// {
2023-11-21 18:01:20 -03:00
"p" = "mode playerctl";
"Ctrl+c" = "exec musmenu pclear";
};
2023-11-21 18:01:20 -03:00
playerctl =
(bind_group
[
to-code
locked
]
{
${key.left} = "${playerctl} previous";
${key.right} = "${playerctl} next";
${key.up} = "${playerctl} volume 10+";
${key.down} = "${playerctl} volume 10-";
${key.tabR} = "${playerctl} volume 10+";
${key.tabL} = "${playerctl} volume 10-";
}
)
// (bind_group
[
to-code
quit-mode
]
{
"space" = "${playerctl} play-pause";
"escape" = "";
"q" = "";
}
);
2023-11-21 18:01:20 -03:00
2023-02-25 18:47:49 -03:00
passthrough = {
"${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
};
};
}