Skip to content

idadzie/zsh-picture-in-picture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-picture-in-picture

License: MIT Maintenance

This plugin allows you to open a video with VLC simulating 'Picture-in-Picture' while you interact with other applications.

How it works

  • xdpyinfo to figure out the display dimensions
  • mediainfo to figure out video dimensions
  • VLC to open the video file
  • xdotool to resize & position the VLC window

Installation

Dependencies

Install Dependencies.

sudo apt-get install mediainfo xdotool vlc libx11-dev

Amazing Zsh plugin manager with clean fpath, reports, completion management, turbo mode etc.

zplugin ice wait'0' lucid make"PREFIX=$ZPFX"
zplugin light idadzie/zsh-picture-in-picture

Usage

# Open video.
picture-in-picture VIDEO.mkv

# Toggle window decorations.
twind

Settings

Alias

picture-in-picture is aliased pnp.

Customizing Paths

The following variables can be set to custom values using the $ZPNP hash.

# Add to .zshrc
declare -A ZPNP

# Examples
ZPNP[PORTRAIT_VIDEO_SCALE_DIMENSION]=400
ZPNP[LANDSCAPE_VIDEO_SCALE_DIMENSION]=500
# Max width/height of scaled down video window. Default: 300
ZPNP[VIDEO_SCALE_DIMENSION]

# Max height of scaled down portrait video window. Default: 300
ZPNP[PORTRAIT_VIDEO_SCALE_DIMENSION]

# Max width of scaled down landscape video window. Default: 300
ZPNP[LANDSCAPE_VIDEO_SCALE_DIMENSION]

# Minimum distance from the right & bottom edge of primary display. Default: 40
ZPNP[OFFSET]

# Minimum distance from the right edge of primary display. Default: 40
ZPNP[X_AXIS_OFFSET]

# Minimum distance from the bottom edge of primary display.  Default: 40
ZPNP[Y_AXIS_OFFSET] 

# X axis dimension of primary display. Defaults to 1920 for a 1080p display.
ZPNP[PRIMARY_X_SPACE]  

# Y axis dimension of primary display. Defaults to 1080 for a 1080p display.
ZPNP[PRIMARY_Y_SPACE]

# Allowed X axis dimension within which a scaled down video window can be positioned.
# Defaults to 1880 since the default offset is 40.
ZPNP[USABLE_X_SPACE]

# Allowed Y axis dimension within which a scaled down video window can be positioned.
# Defaults to 1040 since the default offset is 40.
ZPNP[USABLE_Y_SPACE]  

# Delay time (in seconds) for xdotool to find opened VLC window. Default: 0.5
ZPNP[RESIZE_SLEEP_TIME] 

# Toggle window decorations. Default: false
ZPNP[TOGGLE_WINDOW_DECORATIONS]

Disclaimer

Only tested on Ubuntu 18.04.

Credit

Major props to Alberts Muktupāvels for the toggle-decorations lib.

License

The MIT License (MIT)

Copyright (c) 2019 idadzie