This commit is contained in:
John Bowdre 2023-09-30 13:14:30 -05:00
parent 211e59e4fd
commit d368ea3f6f
6 changed files with 46 additions and 7 deletions

View file

@ -48,8 +48,11 @@
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
systems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys});
pkgsFor = nixpkgs.legacyPackages;
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs systems (system: import nixpkgs {
inherit system;
config.allowUnfree = true;
});
in
{
inherit lib;

View file

@ -1,2 +1,4 @@
{
imports = [
];
}

View file

@ -24,10 +24,6 @@
gaps_out = 20;
border_size = 2.7;
cursor_inactive_timeout = 4;
"col.active_border" = "0xff${config.colorscheme.colors.base0C}";
"col.inactive_border" = "0xff${config.colorscheme.colors.base02}";
"col.group_border_active" = "0xff${config.colorscheme.colors.base0B}";
"col.group_border" = "0xff${config.colorscheme.colors.base04}";
};
input = {
kb_layout = "br,us";

View file

@ -27,7 +27,7 @@
dconf.enable = true;
};
servies.logind = {
services.logind = {
lidSwitch = "suspend";
lidSwitchExternalPower = "lock";
};

View file

@ -0,0 +1,16 @@
{ writeShellApplication, hyprland, jq, slurp }:
writeShellApplication {
name = "hyprslurp";
runtimeInputs = [ hyprland jq slurp ];
text = ''
hyprctl clients -j | \
jq -r \
--argjson workspaces "$(\
hyprctl monitors -j | \
jq -r 'map(.activeWorkspace.id)'\
)" \
'map(select([.workspace.id] | inside($workspaces)))' | \
jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | \
slurp "$@"
'';
}

View file

@ -0,0 +1,22 @@
# Sets the largest monitor as primary xwayland display, or select one with slurp
{ lib, writeShellApplication, xrandr, slurp }: (writeShellApplication {
name = "primary-xwayland";
runtimeInputs = [ slurp xrandr ];
text = /* bash */ ''
if [ "$#" -ge 1 ] && [ "$1" == "largest" ]; then
output=$(xrandr --listmonitors | tail -n +2 | awk '{printf "%s %s\n", $3, $4}' | sort | tail -1 | cut -d ' ' -f2)
else
selected=$(slurp -f "%wx%h+%x+%y" -o)
output=$(xrandr | grep "$selected" | cut -d ' ' -f1)
fi
echo "Setting $output"
xrandr --output "$output" --primary
'';
}) // {
meta = with lib; {
license = licenses.mit;
platforms = platforms.all;
};
}