1
0
Fork 0

[sway] Use $mod+c with my own sway-center-window

main
Sebastian Schulze 2022-07-14 17:07:47 +02:00
parent 907e774ee4
commit 6bae4448d0
No known key found for this signature in database
GPG Key ID: F6BA63C6A7D3044E
2 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
client_info=$(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true)')
pid=$(echo "$client_info"| jq .id)
info_file="/dev/shm/sway-width-${pid}"
current_info_file="/dev/shm/sway-width-${pid}.current"
echo "$client_info" > "$info_file"
if [[ -f $current_info_file ]]; then
width=$(<"$current_info_file")
fi;
if [[ -z "${width}" ]]; then
echo "None yet"
echo 25 > "${current_info_file}"
swaymsg resize set 25ppt 50ppt
elif [[ "${width}" == "25" ]]; then
echo 50 > "${current_info_file}"
swaymsg resize set 50ppt 50ppt
elif [[ "${width}" == "50" ]]; then
echo 75 > "${current_info_file}"
swaymsg resize set 75ppt 75ppt
elif [[ "${width}" == "75" ]]; then
rm -f "${current_info_file}"
old_width=$(echo "$client_info"| jq .geometry.width)
old_height=$(echo "$client_info"| jq .geometry.height)
swaymsg resize set "${old_width}px" "${old_height}px"
else
echo "ui"
fi
swaymsg move position center

View File

@ -240,8 +240,7 @@ bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+b splith
bindsym $mod+v splitv
bindsym $mod+c move position center
bindsym $mod+Alt+c move position center, resize set 80ppt 80ppt
bindsym $mod+c exec sway-center-window
# Switch the current container between different layout styles
bindsym $mod+s layout stacking