mirror of
https://github.com/Noratrieb/nixos.git
synced 2026-01-14 11:45:06 +01:00
gamer
This commit is contained in:
parent
67c1ae558d
commit
968ae89998
6 changed files with 57 additions and 4 deletions
9
custom-pkgs/sl/default.nix
Normal file
9
custom-pkgs/sl/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ pkgs, ... }: pkgs.writeShellApplication {
|
||||
name = "sl";
|
||||
runtimeInputs = with pkgs; [ niri jq ];
|
||||
derivationArgs = {
|
||||
# shellcheck can't comprehend our amazingly new bash syntax
|
||||
checkPhase = null;
|
||||
};
|
||||
text = builtins.readFile ./sl.sh;
|
||||
}
|
||||
30
custom-pkgs/sl/sl.sh
Normal file
30
custom-pkgs/sl/sl.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
win_id=$(niri msg --json windows | jq '.[] | select(.is_focused==true) | .id')
|
||||
|
||||
niri msg action move-window-to-floating
|
||||
|
||||
position() {
|
||||
niri msg --json windows | jq ".[] | select(.id==${win_id}) | .layout.tile_pos_in_workspace_view.[0] | round"
|
||||
}
|
||||
|
||||
while true; do
|
||||
before_pos_x=${ position; }
|
||||
niri msg action move-floating-window --id "$win_id" -x +50
|
||||
after_pos_x=${ position; }
|
||||
|
||||
if [[ "$before_pos_x" == "$after_pos_x" ]]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
while true; do
|
||||
niri msg action move-floating-window --id "$win_id" -x -50
|
||||
after_pos_x=${ position; }
|
||||
|
||||
if (( $after_pos_x <= 0 )); then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
niri msg action toggle-window-floating --id "$win_id"
|
||||
Loading…
Add table
Add a link
Reference in a new issue