argen: add key for fuzzel and select/swap window by index
This commit is contained in:
@@ -11,6 +11,7 @@ argenctl binding set normal Super Return sh "kitty --single-instance --instance-
|
||||
# Reload config
|
||||
argenctl binding set normal Super+Shift R exec "$0"
|
||||
|
||||
argenctl binding set normal Super P exec fuzzel
|
||||
argenctl binding set normal Super+Shift L exec waylock
|
||||
argenctl binding set normal Super+Shift T sh "lupan-set-theme toggle"
|
||||
|
||||
@@ -115,5 +116,30 @@ argenctl mode declare passthrough
|
||||
argenctl binding set normal Super Grave mode enter passthrough
|
||||
argenctl binding set passthrough Super Grave mode enter normal
|
||||
|
||||
# Select/swap window by index
|
||||
for num in 1 2 3 4 5 6 7 8 9; do
|
||||
idx=$((num - 1))
|
||||
argenctl binding set normal Super $num sh "
|
||||
argenctl window focus \$(argenctl context list --json | jq -r '.[] | select(.current) | .windows | .[$idx]')
|
||||
"
|
||||
argenctl binding set normal Super+Shift $num sh "
|
||||
context_id=\$(argenctl context list --json | jq -r '.[] | select(.current) | .id')
|
||||
length=\$(argenctl context list --json | jq -r '.[] | select(.current) | .windows | length')
|
||||
focused_window=\$(argenctl context list --json | jq -r '.[] | select(.current) | .focused_window')
|
||||
dest_window=\$(argenctl context list --json | jq -r '.[] | select(.current) | .windows | .[$idx]')
|
||||
focused_output_id=\$(argenctl window list --json | jq -r \".[] | select(.id == \\\"\$focused_window\\\") | .contexts[] | select(.id = \$context_id) | .output_id\")
|
||||
dest_output_id=\$(argenctl window list --json | jq -r \".[] | select(.id == \\\"\$dest_window\\\") | .contexts[] | select(.id = \$context_id) | .output_id\")
|
||||
if [ -n \"\$focused_output_id\" -a \"\$focused_output_id\" = \"\$dest_output_id\" ]; then
|
||||
for i in \$(seq \$length); do
|
||||
if [ \"\$focused_window\" = \"\$dest_window\" ]; then
|
||||
break
|
||||
fi
|
||||
argenctl window swap next
|
||||
dest_window=\$(argenctl context list --json | jq -r '.[] | select(.current) | .windows | .[$idx]')
|
||||
done
|
||||
fi
|
||||
"
|
||||
done
|
||||
|
||||
# Rules
|
||||
argenctl rule add float --app-id "my-app"
|
||||
|
||||
Reference in New Issue
Block a user