Add clamshell config

This commit is contained in:
alejandro-angulo 2026-02-13 20:12:46 -08:00
parent 4417a89ab0
commit 38f69c47e3

View file

@ -24,6 +24,18 @@ let
emoji_picker = "${pkgs.bemoji}/bin/bemoji -t"; emoji_picker = "${pkgs.bemoji}/bin/bemoji -t";
terminal = "${pkgs.kitty}/bin/kitty"; terminal = "${pkgs.kitty}/bin/kitty";
internal_display_settings = "eDP-1,preferred,auto,1.6";
clamshell_script = pkgs.writeShellScriptBin "clamshell" ''
if ${pkgs.hyprland}/bin/hyprctl monitors | ${pkgs.ripgrep}/bin/rg -q '\sDP-'; then
echo "Detected external monitor..."
if [[ "$1" == "open" ]]; then
${pkgs.hyprland}/bin/hyprctl keyword monitor ${internal_display_settings}
else
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,disable"
fi
fi
'';
generate_grim_command = target: '' generate_grim_command = target: ''
exec mkdir -p ~/screenshots \ exec mkdir -p ~/screenshots \
&& ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" \ && ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" \
@ -171,6 +183,9 @@ in
"$mod, d, exec, ${emoji_picker}" "$mod, d, exec, ${emoji_picker}"
"$mod, z, exec, hyprctl reload" "$mod, z, exec, hyprctl reload"
# Move workspace across monitors
"$mod, semicolon, movecurrentworkspacetomonitor, +1"
# Focus # Focus
"$mod, ${left}, movefocus, l" "$mod, ${left}, movefocus, l"
"$mod, ${down}, movefocus, d" "$mod, ${down}, movefocus, d"
@ -238,6 +253,8 @@ in
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
", XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -U 5" ", XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -U 5"
", XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 5" ", XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 5"
", switch:off:Lid Switch, exec, ${clamshell_script}/bin/clamshell open"
", switch:on:Lid Switch, exec, ${clamshell_script}/bin/clamshell close"
]; ];
}; };
}; };