You are not logged in.

#1 2019-08-16 14:24:17

dpx
Member
Registered: 2017-01-09
Posts: 48

Start app, hide it, show it. dwm or tiling wm happy.

I am using deezer player (it is badly written electron abomination but country limitations dictate) and dwm. SInce dwm doesn't have window minimization or tray support I wrote small script to a) start app if it is not already started; b) hide app window if it is visible; c) show app window if it is hidden. In short just define app class and executable and start script repeatedly or in Deezer case don't change anything. It should work quite well on any WM/DE.

#!/usr/bin/env sh

appclass="Deezer"
app="deezer"

#find  window id
wid=`xdotool search --classname "${appclass}"`
#if it is active app toggle its visibility
if [ $? -eq 0 ]; then
        #it is active but is it visible?
        widvisible=`xdotool search --onlyvisible --classname "${appclass}"`
        if [ $? -eq 0 ]; then
                #hide window
                xdotool windowunmap $wid
        else
                #show window
                xdotool windowmap $wid
        fi
else
        #start app
        "${app}" &
fi

Offline

Board footer

Powered by FluxBB