Skip to content

Instantly share code, notes, and snippets.

@tyjak
Last active September 10, 2021 22:07
Show Gist options
  • Save tyjak/e8e5001619c9d8755b08be2ae4f0516d to your computer and use it in GitHub Desktop.
Save tyjak/e8e5001619c9d8755b08be2ae4f0516d to your computer and use it in GitHub Desktop.
Simple wrapper to have website embeded in an i3 floating window
#!/bin/zsh
#
# Simple wrapper to havce website embedded in a vimb floating window
# depends on i3 and vimb
# GistID:e8e5001619c9d8755b08be2ae4f0516d
URI=$1
NAME=${2:-$1}
_width=${3:-1000}
_height=${4:-600}
_position_x=${5}
_position_y=${6}
_position="center"
[ ! -z "${_position_x}" ] || [ ! -z "${_position_y}" ] && _position="${_position_x}px ${_position_y}px"
ISRUNNING=$( ps -C vimb -o cmd | grep -c "webapp-${NAME}" )
i3-msg -q "border 1pixel; exec [ $ISRUNNING -eq 0 ] && /usr/bin/vimb --class=webapp-$NAME --name=float_borderless_app -p webapp $URI"
while ! i3-msg -t get_tree | grep -qs "\"class\":\"webapp-${NAME}\""
do
echo "waiting.."
done
i3-msg -q "[class=webapp-$NAME] resize set ${_width}px ${_height}px, move position ${_position}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment