bin: add sway_resize
This commit is contained in:
parent
36f1a3557c
commit
f3829160db
3 changed files with 95 additions and 13 deletions
55
bin/sway_resize
Executable file
55
bin/sway_resize
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# inspired by sway_move from bob hepple
|
||||||
|
#
|
||||||
|
|
||||||
|
initialise() {
|
||||||
|
PROG=$(basename $0)
|
||||||
|
VERSION="1.0"
|
||||||
|
ARGUMENTS="top-right|bottom-right|bottom-left"
|
||||||
|
USAGE="move a floating window to the edges because sway lacks a way to do it!"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
-h|--help)
|
||||||
|
echo "$USAGE"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
1*|2*|3*|4*|5*|6*|7*|8*|9*)
|
||||||
|
command="$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$PROG: bad argument" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
initialise "$@"
|
||||||
|
# win_dim=( $( swaymsg -t get_tree |
|
||||||
|
# jq '.. | select(.type?) | select(.type=="floating_con") | select(.focused?)|.rect.width, .rect.height, .deco_rect.height' ) )
|
||||||
|
|
||||||
|
type=$( swaymsg -t get_tree | jq '.. | select(.focused?)|.type' | sed 's/"//g')
|
||||||
|
|
||||||
|
case "$type" in
|
||||||
|
"con")
|
||||||
|
if [ $1 -ge 10 -a $1 -le 90 ]
|
||||||
|
then
|
||||||
|
width=${1}ppt
|
||||||
|
echo swaymsg "resize set width ${width}"
|
||||||
|
swaymsg "resize set width ${width}"
|
||||||
|
else
|
||||||
|
echo "invalid width $1"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"floating_con")
|
||||||
|
width=$((${1} * 21))
|
||||||
|
height=$((${width} * 9 / 16))
|
||||||
|
echo swaymsg "resize set width ${width}px height ${height}px"
|
||||||
|
swaymsg "resize set width ${width} height ${height}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo wrong type $type
|
||||||
|
;;
|
||||||
|
esac
|
32
config
32
config
|
@ -25,6 +25,7 @@ set $idle_cmd $HOME/.config/sway/bin/start_swayidle.sh
|
||||||
set $sov_cmd $HOME/.config/sway/bin/start_sov.sh
|
set $sov_cmd $HOME/.config/sway/bin/start_sov.sh
|
||||||
set $lock_cmd $HOME/.config/sway/bin/sway_lock lock
|
set $lock_cmd $HOME/.config/sway/bin/sway_lock lock
|
||||||
set $move_cmd $HOME/.config/sway/bin/sway_move
|
set $move_cmd $HOME/.config/sway/bin/sway_move
|
||||||
|
set $resize_cmd $HOME/.config/sway/bin/sway_resize
|
||||||
set $font Cascadia Code PL Regular 10
|
set $font Cascadia Code PL Regular 10
|
||||||
set $notify_cmd dunstify -r 123
|
set $notify_cmd dunstify -r 123
|
||||||
|
|
||||||
|
@ -292,16 +293,25 @@ mode "move" {
|
||||||
# resize presets
|
# resize presets
|
||||||
# bindsym -1 resize set width 600px height 360px
|
# bindsym -1 resize set width 600px height 360px
|
||||||
# bindsym 0 resize set width 700px height 420px
|
# bindsym 0 resize set width 700px height 420px
|
||||||
bindsym 1 resize set width 800px height 480px
|
# bindsym 1 resize set width 800px height 480px
|
||||||
bindsym 2 resize set width 900px height 540px
|
# bindsym 2 resize set width 900px height 540px
|
||||||
bindsym 3 resize set width 1000px height 600px
|
# bindsym 3 resize set width 1000px height 600px
|
||||||
bindsym 4 resize set width 1100px height 660px
|
# bindsym 4 resize set width 1100px height 660px
|
||||||
bindsym 5 resize set width 1200px height 720px
|
# bindsym 5 resize set width 1200px height 720px
|
||||||
bindsym 6 resize set width 1300px height 780px
|
# bindsym 6 resize set width 1300px height 780px
|
||||||
bindsym 7 resize set width 1400px height 840px
|
# bindsym 7 resize set width 1400px height 840px
|
||||||
bindsym 8 resize set width 1500px height 900px
|
# bindsym 8 resize set width 1500px height 900px
|
||||||
bindsym 9 resize set width 1600px height 1040px
|
# bindsym 9 resize set width 1600px height 1040px
|
||||||
bindsym 0 resize set width 1700px height 1200px
|
# bindsym 0 resize set width 1700px height 1200px
|
||||||
|
bindsym 1 exec $resize_cmd 10
|
||||||
|
bindsym 2 exec $resize_cmd 20
|
||||||
|
bindsym 3 exec $resize_cmd 30
|
||||||
|
bindsym 4 exec $resize_cmd 40
|
||||||
|
bindsym 5 exec $resize_cmd 50
|
||||||
|
bindsym 6 exec $resize_cmd 60
|
||||||
|
bindsym 7 exec $resize_cmd 70
|
||||||
|
bindsym 8 exec $resize_cmd 80
|
||||||
|
bindsym 9 exec $resize_cmd 90
|
||||||
# focus
|
# focus
|
||||||
bindsym $mod+h focus left
|
bindsym $mod+h focus left
|
||||||
bindsym $mod+j focus down
|
bindsym $mod+j focus down
|
||||||
|
@ -350,6 +360,7 @@ for_window [app_id="pavucontrol"] floating enable
|
||||||
for_window [app_id="com.nextcloud.desktopclient.nextcloud"] floating enable
|
for_window [app_id="com.nextcloud.desktopclient.nextcloud"] floating enable
|
||||||
for_window [app_id="imv"] floating enable
|
for_window [app_id="imv"] floating enable
|
||||||
for_window [app_id="nm-openconnect-auth-dialog"] floating enable
|
for_window [app_id="nm-openconnect-auth-dialog"] floating enable
|
||||||
|
for_window [app_id="com.obsproject.Studio"] floating enable
|
||||||
for_window [app_id=".*"] title_format '<span font_weight="bold">%title</span> <span>(%app_id)</span>'
|
for_window [app_id=".*"] title_format '<span font_weight="bold">%title</span> <span>(%app_id)</span>'
|
||||||
for_window [class=".*"] title_format '<span font_weight="bold">%title</span> <span>(%class:%instance)</span>'
|
for_window [class=".*"] title_format '<span font_weight="bold">%title</span> <span>(%class:%instance)</span>'
|
||||||
# different dashes!
|
# different dashes!
|
||||||
|
@ -360,6 +371,7 @@ for_window [title="bluetoothctl"] floating enable
|
||||||
for_window [title="fzf"] floating enable
|
for_window [title="fzf"] floating enable
|
||||||
# mark rules
|
# mark rules
|
||||||
for_window [class="Plexamp" window_type="normal"] mark s
|
for_window [class="Plexamp" window_type="normal"] mark s
|
||||||
|
for_window [app_id="com.obsproject.Studio"] mark d
|
||||||
for_window [class="Ferdium" window_type="normal" window_role="browser-window"] mark z
|
for_window [class="Ferdium" window_type="normal" window_role="browser-window"] mark z
|
||||||
for_window [class="Signal" window_type="normal" window_role="browser-window"] mark x
|
for_window [class="Signal" window_type="normal" window_role="browser-window"] mark x
|
||||||
for_window [class="Chromium" instance="crx_cifhbcnohmdccbgoicgdjpfamggdegmo" window_type="normal"] mark c
|
for_window [class="Chromium" instance="crx_cifhbcnohmdccbgoicgdjpfamggdegmo" window_type="normal"] mark c
|
||||||
|
|
|
@ -83,9 +83,9 @@
|
||||||
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null"
|
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null"
|
||||||
},
|
},
|
||||||
"clock": {
|
"clock": {
|
||||||
"format": "<span foreground='#ebdbb2'> </span>{:%H:%M, %b %d}",
|
"format": "<span foreground='#ebdbb2'></span>{: %H:%M, %b %d }",
|
||||||
"format-alt": "<span foreground='#ebdbb2'> </span>{:%A, %B %d, %Y (%R)}",
|
"format-alt": "<span foreground='#ebdbb2'> </span>{:%A, %B %d, %Y (%R)}",
|
||||||
// "tooltip-format": "\n<span size='9pt'>{calendar}</span>",
|
"tooltip-format": "\n<span size='9pt'>{calendar}</span>",
|
||||||
// "calendar": {
|
// "calendar": {
|
||||||
// "mode" : "year",
|
// "mode" : "year",
|
||||||
// "mode-mon-col" : 3,
|
// "mode-mon-col" : 3,
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
// "weekdays": "<span color='#b8bb26'><b>{}</b></span>",
|
// "weekdays": "<span color='#b8bb26'><b>{}</b></span>",
|
||||||
// "today": "<span color='#fb4934'><b><u>{}</u></b></span>"
|
// "today": "<span color='#fb4934'><b><u>{}</u></b></span>"
|
||||||
// }
|
// }
|
||||||
},
|
// },
|
||||||
"actions": {
|
"actions": {
|
||||||
"on-click-right": "mode",
|
"on-click-right": "mode",
|
||||||
"on-click-forward": "tz_up",
|
"on-click-forward": "tz_up",
|
||||||
|
@ -160,6 +160,21 @@
|
||||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||||
"on-click": "foot -T float nmtui"
|
"on-click": "foot -T float nmtui"
|
||||||
},
|
},
|
||||||
|
"network#ub0": {
|
||||||
|
"interval": 2,
|
||||||
|
"interface": "ub0",
|
||||||
|
"format": "{ifname}",
|
||||||
|
"format-wifi": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||||
|
"format-linked": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||||
|
"format-disconnected": "<span foreground='#606060'> </span>{ifname}",
|
||||||
|
"min-length": 8,
|
||||||
|
"max-length": 30,
|
||||||
|
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||||
|
"tooltip-format-ethernet": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||||
|
"tooltip-format-wifi": "{ifname} {essid} ({signalStrength:3}%)\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||||
|
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||||
|
"on-click": "foot -T float nmtui"
|
||||||
|
},
|
||||||
"network#wl0": {
|
"network#wl0": {
|
||||||
"interval": 2,
|
"interval": 2,
|
||||||
"interface": "wl0",
|
"interface": "wl0",
|
||||||
|
|
Loading…
Reference in a new issue