Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdnghtman/mpv-i3-floating-centered
Show mpv window in the center of the display when it is in floating mode (i3wm)
https://github.com/mdnghtman/mpv-i3-floating-centered
Last synced: 3 months ago
JSON representation
Show mpv window in the center of the display when it is in floating mode (i3wm)
- Host: GitHub
- URL: https://github.com/mdnghtman/mpv-i3-floating-centered
- Owner: mdnghtman
- License: gpl-3.0
- Created: 2019-09-30T03:16:43.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-10T14:41:44.000Z (over 3 years ago)
- Last Synced: 2024-06-30T14:46:53.012Z (4 months ago)
- Language: Lua
- Size: 24.4 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mpv - i3-floating-centered - Show mpv window in the center of the display when it is in floating mode (i3wm) (Other)
README
# mpv-i3-floating-centered
**mpv-i3-floating-centered** is a script for mpv written in Lua. Its purpose is to center a floating mpv window in the i3 window manager.To achieve this it will:
* Get the window id of the mpv process.
* Check if it's in floating mode
* Tell i3-msg to center the window by its window id.# Dependencies
* xdotool
* xpropInstall via your systems package manager.
# Install
Place the file `mpv-i3-floating-centered.lua` in your `~/.config/mpv/scripts/` directory, creating it if needed, and that's it. Run mpv as you normally would and you're now using it.# Recommended settings
Though the Lua script is all you need, combining it with two more settings is pretty great.You can use the **autofit** setting in `~/.config/mpv/mpv.conf` to enforce a window size. For example on a 27in 2560x1440 display enforcing a size of 1920x1080 works well:
```
autofit=1920x1080
```It doesn't modify aspect ratio, only increasing or decreasing the window size within the specified bounds. To use the entire display just toggle fullscreen. This option can also be specified by a percentage, read more about it from the mpv manual: https://mpv.io/manual/stable/
Lastly, in your i3 config file: `~/.config/i3/config` enable floating mpv windows by default:
```
for_window [class="mpv"] floating enable
```Save and reload i3 with **$mod+Shift+r**