Add Niri, a scrolling tiling window manager.

This commit is contained in:
Jimbo 2024-12-03 16:50:23 -05:00
parent 325c176464
commit b3d9d2f396
38 changed files with 758 additions and 376 deletions

View file

@ -3,16 +3,6 @@
imports = [
./swayshot
./swaysleep
];
home.packages = with pkgs; [
clipman
swaybg
libnotify
grim
slurp
wl-clipboard
wdisplays
jq
./swaytools
];
}

View file

@ -2,7 +2,7 @@
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swayshot" ''
handle_swappy() {
swappy() {
# Create an imv window to act as a static screen
grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$!
@ -18,7 +18,7 @@
rm "$temp_file"
}
handle_screen() {
screen() {
temp_file=$(mktemp -u).png
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file"
@ -33,9 +33,9 @@
}
if [ "$1" == "--swappy" ]; then
handle_swappy
swappy
elif [ "$1" == "--screen" ]; then
handle_screen
screen
else
echo "Please use the arguments --swappy or --screen."
fi

View file

@ -0,0 +1,33 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swaytools" ''
# List the app name and whether or not it uses wayland
prop() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
}
# Kill a selected window
kill() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid')
kill -9 "$pid"
fi
}
if [ "$1" == "--prop" ]; then
prop
elif [ "$1" == "--kill" ]; then
kill
else
echo "Please use the arguments --prop or --kill."
fi
'')
];
}