user-none / KDocker

KDocker will help you dock any application into the system tray
GNU General Public License v2.0
295 stars 22 forks source link

Command line option: Iconify when minimized #84

Open samuelznewton opened 3 years ago

samuelznewton commented 3 years ago

Hello! I would love to see an option added to the command line to allow a program to iconify when minimized. The option exists in the GUI already, but strangely no CLI support as far as I can tell.

samuelznewton commented 3 years ago

Per Issue 34, the -m CLI option apparently negates "iconify when minimized". Re-reading the documentation, I can see that this is the meaning of -m. However, -m also seems to tell a program not to minimize on startup (maybe this is an issue specifically with xfce?). I have been using -m because I want a program to start visible but be dockable.

Current behavior: Starting a program with kdocker -m will show the program immediately, but will not iconify it when minimized. Starting a program with kdocker (without -m) will hide the program (almost) immediately, iconifying it any time it is minimized.

Expected behavior: Starting a program with kdocker -m will iconify it any time it is minimized. Without -m will not iconify when minimized. Starting a program with kdocker --start-minimized (or some such thing) will start the program minimized. Starting without that option will start it visible. The 2 options will not be tied together.

samuelznewton commented 3 years ago

Trying to make sense of the code, it appears to me that the -m option only changes the program setting "IconifyMinimized". So, somehow, that setting must tell a program to immediately minimize or iconify - or again, it could be some strange behavior related to xfce.

voccer commented 3 years ago

like

Daxx commented 3 years ago

Have you considered .......... cheating ;) I leave this here to use at your own risk:

You can use the XDOTOOL utility to raise the window that kdocker hides. This function attempts to automate the process. If you know the Window ID, xdotool windowmap <WindowID> should be all that's needed to make it appear.

It's usually suggested that bash shell functions go into ~/.bashrc but, for the purposes of testing, you can put it in any file, for example ~/tmp/kdock_func.sh and then source it from a console after making any changes:

source ~/tmp/kdock_func.sh kdock1 kcalc

Code here: https://pastebin.com/WXWU6xyL (I don't trust github's formatting)

If it doesn't work for you, please try working it out for yourself and reply with feedback or else I might regret spending a couple of hours trying to help.

I use '-t' option (skip taskbar) on kdocker, so I can't tell whether the program is iconified or not. It doesn't bother me. Reading the code and your comments, I'm not even as aware of the difference between iconified and minimised as you seem to be except that, with '-t' option, it never appears on the taskbar, even when the window is showing -- which is what I'm used to.

Hope this helps to set you in the right direction.

Daxx commented 3 years ago

In reply to the question "Wouldn't it have been quicker to change the code?"

Possibly. Try again after https://github.com/user-none/KDocker/issues/85 has been attended to :))