sway: extract modes from config
This commit is contained in:
parent
c82e25f0a4
commit
8b3cdd756d
|
@ -8,6 +8,7 @@ in
|
|||
./kanshi.nix
|
||||
./mako.nix
|
||||
./sway-binds.nix
|
||||
./sway-modes.nix
|
||||
./swayidle.nix
|
||||
./swaylock.nix
|
||||
./theme.nix
|
||||
|
@ -111,62 +112,6 @@ in
|
|||
{ app_id = "WebCord"; }
|
||||
];
|
||||
};
|
||||
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");
|
||||
playerctl = "exec ${pkgs.playerctl}/bin/playerctl";
|
||||
in
|
||||
{
|
||||
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" = "";
|
||||
"m" = "exec volumesh -t";
|
||||
"s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
|
||||
|
||||
"d" = "exec ${pkgs.musmenu}/bin/musmenu delete";
|
||||
"f" = "exec ${pkgs.musmenu}/bin/musmenu search";
|
||||
|
||||
"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";
|
||||
} // {
|
||||
"p" = "mode playerctl";
|
||||
"Ctrl+c" = "exec musmenu pclear";
|
||||
};
|
||||
playerctl = code_binds
|
||||
((locked_binds
|
||||
{
|
||||
${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-";
|
||||
}) //
|
||||
(return_mode {
|
||||
"space" = "${playerctl} play-pause";
|
||||
"escape" = "";
|
||||
"q" = "";
|
||||
}));
|
||||
passthrough = {
|
||||
"${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
|
||||
};
|
||||
};
|
||||
floating = {
|
||||
modifier = "Mod4";
|
||||
criteria = [
|
||||
|
|
66
user/sway/sway-modes.nix
Normal file
66
user/sway/sway-modes.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.uservars) key accent font theme;
|
||||
inherit (theme) color;
|
||||
inherit (pkgs) lib;
|
||||
|
||||
mod = "Mod4";
|
||||
menu = "wlauncher";
|
||||
terminal = "alacritty";
|
||||
|
||||
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");
|
||||
playerctl = "exec ${pkgs.playerctl}/bin/playerctl";
|
||||
in
|
||||
{
|
||||
wayland.windowManager.sway.config.modes = {
|
||||
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" = "";
|
||||
"m" = "exec volumesh -t";
|
||||
"s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
|
||||
|
||||
"d" = "exec ${pkgs.musmenu}/bin/musmenu delete";
|
||||
"f" = "exec ${pkgs.musmenu}/bin/musmenu search";
|
||||
|
||||
"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";
|
||||
} // {
|
||||
"p" = "mode playerctl";
|
||||
"Ctrl+c" = "exec musmenu pclear";
|
||||
};
|
||||
playerctl = code_binds
|
||||
((locked_binds
|
||||
{
|
||||
${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-";
|
||||
}) //
|
||||
(return_mode {
|
||||
"space" = "${playerctl} play-pause";
|
||||
"escape" = "";
|
||||
"q" = "";
|
||||
}));
|
||||
passthrough = {
|
||||
"${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue