Skip to content

Instantly share code, notes, and snippets.

@KokoseiJ
Created August 2, 2021 07:38
Show Gist options
  • Save KokoseiJ/c5802d15dd1ad02dacb772eade312021 to your computer and use it in GitHub Desktop.
Save KokoseiJ/c5802d15dd1ad02dacb772eade312021 to your computer and use it in GitHub Desktop.
Toggle fullscreen on Spotify in Linux
#!/bin/bash
xwininfo -root -tree | grep '("spotify" "Spotify")' | grep -oE '(0x[0-9a-z]{7,8})' | xargs -I % wmctrl -i -r % -b toggle,fullscreen
@KokoseiJ
Copy link
Author

KokoseiJ commented Aug 2, 2021

This works by getting info about every windows using xwininfo, get spotify's one by searching ("spotify" "Spotify"), grab Window ID using that regex which matches hexadecimal with length of 7~8, and toggle the fullscreen using wmctrl.

Only tested on Fedora Cinnamon, but it should work on other systems. if it doesn't, please report with your output of following command:
xwininfo -root -tree | grep 'spotify'

Suggestions and fixes are welcome, if there's one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment