update and move inputs, WIP ezpc hyprland, improve elvish module, improve locking, disable systemd initrd by default

This commit is contained in:
notgne2 2022-12-26 22:29:11 -07:00
parent cc56729c13
commit 6c6556b8d6
No known key found for this signature in database
6 changed files with 255 additions and 79 deletions

View file

@ -91,18 +91,22 @@ in {
events = [
{
event = "before-sleep";
command = "${lockCommand}";
command = "${pkgs.systemd}/bin/loginctl lock-session";
}
{
event = "lock";
command = "${lockCommand}";
}
{
event = "unlock";
command = "${pkgs.procps}/bin/pkill -USR1 swaylock";
}
];
timeouts = [
{
timeout = cfg.screensaver.lockTime;
command = "${lockCommand}";
command = "${pkgs.systemd}/bin/loginctl lock-session";
}
{
timeout = cfg.screensaver.offTime;
@ -112,6 +116,81 @@ in {
];
};
wayland.windowManager.hyprland = {
enable = false;
systemdIntegration = true;
extraConfig = let
swayConfig = config.wayland.windowManager.sway.config;
swayBindings = swayConfig.keybindings;
swayToHyprlandBinding = key: binding: let
splitKey = lib.splitString "+" key;
isMod = m: m == "Mod4" || m == "Shift";
convertMod = m:
if m == "Mod4"
then "SUPER"
else lib.toUpper m;
mods = filter isMod splitKey;
modsStr = "${(lib.concatStringsSep "_" (map convertMod mods))},";
normalKeys = filter (m: isMod m == false) splitKey;
normalKey = lib.elemAt normalKeys 0;
convertedKey = "${modsStr}${normalKey}";
convertDir = dir: lib.elemAt (lib.stringToCharacters dir) 0;
splitBinding = lib.splitString " " binding;
bindingAction = lib.elemAt splitBinding 0;
newBinding =
if bindingAction == "exec"
then "exec, ${lib.concatStringsSep " " (lib.tail splitBinding)}"
else if bindingAction == "workspace"
then let n = lib.last splitBinding; in "workspace, ${n}"
else if bindingAction == "kill"
then "killactive,"
else if bindingAction == "focus"
then let
l = lib.last splitBinding;
in
if l == "mode_toggle"
then "togglefloating,"
else "movefocus,${convertDir l}"
else if bindingAction == "fullscreen"
then "fullscreen,0"
else if bindingAction == "floating"
then "togglefloating,"
else if bindingAction == "move"
then let
splitMove = lib.tail splitBinding;
moveThing = lib.elemAt splitMove 0;
toThing =
if lib.length splitMove >= 3
then lib.elemAt splitMove 2
else null;
in
if toThing == null
then "movewindow,${convertDir moveThing}"
else if moveThing == "container" && toThing == "workspace"
then "movetoworkspacesilent,${lib.last splitMove}"
else null
else null;
in
if newBinding == null
then "# ${key} - ${binding}"
else "bind=${convertedKey}, ${newBinding}";
convertedBindings = lib.concatStringsSep "\n" (lib.mapAttrsToList swayToHyprlandBinding swayBindings);
bindingsStr = "${convertedBindings}\n";
in ''
monitor=,preferred,auto,auto
gestures {
workspace_swipe = on
}
${convertedBindings}
'';
};
wayland.windowManager.sway = {
enable = lib.mkDefault true;