Skip to content

Instantly share code, notes, and snippets.

@s-zeid
Last active April 10, 2020 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-zeid/8a815ebbab3773e04969b820f57f1fd0 to your computer and use it in GitHub Desktop.
Save s-zeid/8a815ebbab3773e04969b820f57f1fd0 to your computer and use it in GitHub Desktop.
mpv + kwin - Hack to make the window translucent when there is no video track
[kwin-translucent-hack]
# Hack to make the window translucent when there is no video track.
#
# * Set up 2 KWin window rules:
# * class: exact match `mpv`, title: regular expression `\x034f$`
# -> active/inactive opacity: force 50%
# * class: exact match `mpv`, title: regular expression `^[^\x034f]*$`
# -> active/inactive opacity: force 100%
#
# * U+034F is used because KWin strips non-printable characters and replaces
# whitespace sequences with single U+0020 spaces (using `QChar::isPrint()`
# and `QString::simplify()`, respectively), and U+034F survives those changes.
#
# * Make sure that there is a U+034F after `${?vid==no:` and
# the last `${?track-list/count==0:` below
#
title=${media-title:mpv}${!track-list/count==0:${?vid==no:͏}}${?track-list/count==0:͏}
# Alternative using U+FFFC:
#title=${media-title:mpv}${!track-list/count==0:${?vid==no:}}${?track-list/count==0:}
[example-profile]
force-window=immediate
profile=kwin-translucent-hack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment