mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-29 22:09:17 -05:00
Aly Raffauf
8dd1e5c113
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
22 lines
468 B
Nix
22 lines
468 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
|
|
in {
|
|
clamshell = pkgs.writeShellScript "sway-clamshell" ''
|
|
docked() {
|
|
[ "$(${swaymsg} -t get_outputs | ${lib.getExe pkgs.jq} '. | length')" -ne 1 ] && return 0
|
|
return 1
|
|
}
|
|
|
|
if [ "$1" == "on" ]; then
|
|
docked && swaymsg output eDP-1 disable
|
|
elif [ "$1" == "off" ]; then
|
|
swaymsg output eDP-1 enable
|
|
fi
|
|
'';
|
|
}
|