switch to sway

This commit is contained in:
cy 2024-12-04 22:53:37 -05:00
parent 8b89e664ea
commit b8b6922e53
7 changed files with 39 additions and 31 deletions

21
sway/scripts/remote.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
active_window=$(swaymsg -t get_tree |jq -r '..|try select(.focused == true) |.app_id')
if [ "$1" = "btn1" ]; then
if [ "$active_window" = "anki" ]; then
wtype " "
elif [ "$active_window" = "foot" ]; then
wtype -M ctrl -M shift -k c
else
wtype -M ctrl -k c
fi
else
if [ "$active_window" = "anki" ]; then
wtype "1"
elif [ "$active_window" = "foot" ]; then
wtype -M ctrl -M shift -k v
else
wtype -M ctrl -k v
fi
fi

View file

@ -2,13 +2,13 @@
focused_workspace=$(swaymsg -t get_workspaces | jq '.[] | select(.focused == true) | .num')
kitty_window_count=$(swaymsg -t get_tree | jq --argjson workspace $focused_workspace '[recurse(.nodes[]?) | select(.type == "workspace" and .num == $workspace) | recurse(.nodes[]?) | select(.app_id == "kitty")] | length')
foot_window_count=$(swaymsg -t get_tree | jq --argjson workspace $focused_workspace '[recurse(.nodes[]?) | select(.type == "workspace" and .num == $workspace) | recurse(.nodes[]?) | select(.app_id == "foot")] | length')
next_session=$((focused_workspace * 10))
if [ $kitty_window_count -gt 0 ]
if [ $foot_window_count -gt 0 ]
then
next_session=$((next_session + kitty_window_count))
next_session=$((next_session + foot_window_count))
fi
kitty tmux new-session -A -s ${next_session}
foot tmux new-session -A -s ${next_session}

View file

@ -1,5 +0,0 @@
#!/bin/bash
url=$(wl-paste)
notify-send "fetching video: ${url}"
mpv --really-quiet $url > /dev/null 2>&1 &