mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-21 19:53:55 -05:00
hyprland: improve clamshell script off checks
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
This commit is contained in:
parent
75e187bfc5
commit
a1225d7b49
|
@ -6,21 +6,24 @@
|
|||
}: let
|
||||
cfg = config.ar.home;
|
||||
hyprctl = lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl";
|
||||
pkill = lib.getExe' pkgs.procps "pkill";
|
||||
virtKeyboard = lib.getExe' pkgs.squeekboard "squeekboard";
|
||||
in {
|
||||
clamshell = pkgs.writeShellScript "hyprland-clamshell" ''
|
||||
NUM_MONITORS=$(${hyprctl} monitors all | grep Monitor | wc --lines)
|
||||
EDP_STATUS=$(${hyprctl} monitors all | grep -A 15 "Monitor eDP-1" | grep "disabled:")
|
||||
if [ "$1" == "on" ]; then
|
||||
if [ $NUM_MONITORS -gt 1 ]; then
|
||||
${hyprctl} keyword monitor "eDP-1, disable"
|
||||
fi
|
||||
elif [ "$1" == "off" ]; then
|
||||
${
|
||||
# Check if the monitor is disabled
|
||||
if echo "$EDP_STATUS" | grep -q "disabled: true"; then
|
||||
${
|
||||
lib.strings.concatMapStringsSep "${hyprctl}\n"
|
||||
(monitor: ''${hyprctl} keyword monitor "${monitor}"'')
|
||||
cfg.desktop.hyprland.laptopMonitors
|
||||
}
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue