summaryrefslogtreecommitdiff
path: root/change_class
blob: f41ecc1da24ea0f2f7d9acd2fd9ba6b9de19144f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

if [ "$#" -lt 2 ]; then
    echo "Usage: $0 <class-name> <video-file>"
    exit 1
fi

class_name=$1
shift

# Start mpv in the background
mpv "$@" &

# Give mpv a moment to start
sleep 2

# Find the window ID
window_id=$(xdotool search --class mpv | tail -n1)

if [ -n "$window_id" ]; then
    # Set the window class
    xprop -id "$window_id" -f WM_CLASS 8s -set WM_CLASS "$class_name"
    echo "Set class of window $window_id to $class_name"
else
    echo "Could not find mpv window"
fi