diff --git a/de/home/.config/sway/config.d/keys.d/windows b/de/home/.config/sway/config.d/keys.d/windows index 756cfce..4b955d7 100644 --- a/de/home/.config/sway/config.d/keys.d/windows +++ b/de/home/.config/sway/config.d/keys.d/windows @@ -25,7 +25,8 @@ bindsym { #focus parent $mod+a focus parent #toggle floating - $mod+Shift+space floating toggle, resize set 50ppt 50ppt +# $mod+Shift+space floating toggle + $mod+Shift+space exec '$HOME/.config/sway/scripts/floating_toggle.sh' #swap between tiles and floats $mod+space focus mode_toggle #enter resize mode diff --git a/de/home/.config/sway/scripts/floating_toggle.sh b/de/home/.config/sway/scripts/floating_toggle.sh new file mode 100755 index 0000000..738b677 --- /dev/null +++ b/de/home/.config/sway/scripts/floating_toggle.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +swaymsg floating toggle +active_window_scratchstate="$(swaymsg -t get_tree | jq -r '.. | select(.type?) | select(.focused==true).type')" +if [[ "${active_window_type}" == "floating_con" ]];then + active_screen_dim="$(swaymsg -t get_outputs | jq -r '.. | select(.type?) | select(.focused==true).rect')" + active_screen_width="$(jq '.width' <<<${active_screen_dim})" + active_screen_height="$(jq '.height' <<<${active_screen_dim})" + if [[ "${active_screen_width}" -gt "${active_screen_height}" ]];then + swaymsg resize set 50ppt 50ppt + else + swaymsg resize set 75ppt 25ppt + fi +fi diff --git a/de/home/.config/sway/scripts/scratchpad_cycle.sh b/de/home/.config/sway/scripts/scratchpad_cycle.sh index 26ab00d..482712e 100755 --- a/de/home/.config/sway/scripts/scratchpad_cycle.sh +++ b/de/home/.config/sway/scripts/scratchpad_cycle.sh @@ -1,17 +1,11 @@ #!/bin/bash swaymsg scratchpad show -#active_window_type="$(swaymsg -t get_tree | jq -r '.. | select(.type?) | select(.focused==true).type')" -#if [[ "${active_window_type}" == "floating_con" ]];then active_window_scratchstate="$(swaymsg -t get_tree | jq -r '.. | select(.type?) | select(.focused==true).scratchpad_state')" if [[ "${active_window_scratchstate}" != "none" ]];then active_screen_dim="$(swaymsg -t get_outputs | jq -r '.. | select(.type?) | select(.focused==true).rect')" active_screen_width="$(jq '.width' <<<${active_screen_dim})" active_screen_height="$(jq '.height' <<<${active_screen_dim})" - echo "width: ${active_screen_width}" - echo "half width: $((${active_screen_width}/2))" - echo "height: ${active_screen_height}" - echo "half height: $((${active_screen_height}/2))" if [[ "${active_screen_width}" -gt "${active_screen_height}" ]];then swaymsg resize set 50ppt 50ppt else