How to use the command xwinwrap (with examples)
- Linux
- December 25, 2023
The xwinwrap command is a tool that allows you to run a player or a program as your desktop background. It is a useful utility for customizing your desktop and adding dynamic elements to your wallpaper. With xwinwrap, you can play videos, animations, or run any program you want in the background while still being able to interact with your desktop.
Use case 1: Run a video using mpv
Code:
xwinwrap -b -nf -ov -- mpv -wid wid --loop --no-audio --no-resume-playback --panscan=1.0 path/to/video.mp4
Motivation:
This use case allows you to set a video as your desktop background using the mpv video player. It is a great way to add some visual interest to your desktop and personalize it with your favorite videos.
Explanation:
-b
: Runs the program in the background.-nf
: Disables the focus-follows-mouse behavior, ensuring that the video stays in the background.-ov
: Enables override-redirect mode, which tells the window manager that this window should be handled specially (as a desktop background).--
: Separates the xwinwrap arguments from the mpv arguments.mpv -wid wid
: The command to run mpv with the window ID specified bywid
. This allows mpv to render its output on the xwinwrap-created window.--loop
: Loops the video playback.--no-audio
: Disables audio playback.--no-resume-playback
: Starts the video from the beginning every time.--panscan=1.0
: Sets the panscan value to 1.0, which displays the video at its original aspect ratio.
Example output:
The video specified by path/to/video.mp4
starts playing as the desktop background, looping indefinitely without audio.
Use case 2: Run a video in fullscreen using mpv
Code:
xwinwrap -b -nf -fs -ov -- mpv -wid wid --loop --no-audio --no-resume-playback --panscan=1.0 path/to/video.mp4
Motivation:
This use case is similar to the previous one, but it plays the video in fullscreen mode. It creates a more immersive experience and allows you to focus on the video without any distractions.
Explanation:
-fs
: Launches mpv in fullscreen mode.- Other arguments have the same meaning as in the previous use case.
Example output:
The video specified by path/to/video.mp4
starts playing as the desktop background in fullscreen mode, with the same properties as the previous use case.
Use case 3: Run a video using mpv with 80% opacity
Code:
xwinwrap -b -nf -ov -o 0.8 --- mpv -wid wid --loop --no-audio --no-resume-playback --panscan=1.0 path/to/video.mp4
Motivation:
This use case allows you to set the opacity of the video. By adjusting the opacity, you can have a more subtle background video that doesn’t interfere too much with your desktop activities.
Explanation:
-o 0.8
: Sets the opacity of the xwinwrap-created window to 0.8, making it 80% transparent.- Other arguments have the same meaning as in the first use case.
Example output:
The video specified by path/to/video.mp4
starts playing as the desktop background with an opacity of 80%. The desktop and other windows are slightly visible behind the video.
Use case 4: Run a video using mpv in a second monitor 1600x900 with 1920 offset on X-axis
Code:
xwinwrap -g 1600x900+1920 -b -nf -ov -- mpv -wid wid --loop --no-audio --no-resume-playback --panscan=1.0 path/to/video.mkv
Motivation:
This use case allows you to specify the dimensions and position of the video window. It is useful if you have a multi-monitor setup and want to display the video on a specific monitor at a specific location.
Explanation:
-g 1600x900+1920
: Sets the geometry of the xwinwrap-created window to 1600x900 with an offset of 1920 pixels on the X-axis. This positions the video window on the second monitor.- Other arguments have the same meaning as in the first use case.
Example output:
The video specified by path/to/video.mkv
starts playing as the desktop background on the second monitor. It has a resolution of 1600x900 and is positioned with a 1920-pixel offset on the X-axis.