• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle
  • I’m still on i3 as it’s been convenient, but this:

    this has all become very specialized over the past decade

    resonates. I keep incrementally adding personal tweaks and hotkeys to my setup, and I have all my dotfiles in a repo so it’s persistent across installations.

    One example was I made my headphone button pause/play videos with i3’s config:

    bindsym XF86AudioPlay exec playerctl play-pause
    

    But then I adopted a script to toggle mic mute on work Zoom meetings, so I combined it with the above - if I’m in a meeting it toggles mute, otherwise it play-pauses any current video. The script, for now:

    #!/bin/bash
    #
    # Handler script for hitting mute on the headphone.
    #
    
    CURRENT=$(xdotool getwindowfocus)
    ZOOM=$(xdotool search --limit 1 --name "Zoom Meeting")
    
    if [[ -n "$ZOOM" ]]; then
        # if zoom is active, toggle mic mute
        xdotool windowactivate --sync ${ZOOM}
        xdotool key --clearmodifiers "alt+a"
        xdotool windowactivate --sync ${CURRENT}
    else
        # otherwise do play/pause
        playerctl play-pause # will fail if no player found
    fi
    

    and of course I altered the i3 config to launch that script rather than playerctl directly.