I have Webmin with Authentic Theme installed in Ubuntu 16.04. After some period of dormancy, not using Webmin, I have revisited Webmin to build a catalogue of Custom Commands to hold CLI commands in use in development/deployment (Heroku, Google etc.).
I have created Categories for main menu and cloned Custum Commands - all working fine including forms to set parameters for commands.
However, I cannot recollect how to output coloured syntax through the command shell terminal. When I use local gnome-monitor terminal I can generate colour syntax.
For example in gnome-terminal I run this command
msgcat --color=test
But if I run this same test command in Webmin Custom Command the output remains black/white.
How do I get colour syntax in Custom Command output?
A related question is how to apply colour to Execute button when running a Custom Command with a form? This will be a css setting somewhere in Authentic Theme.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After much researching I have found a workaround. Basically I can write a Webmin Command to launch Ubuntu gnome-terminal (bypassing Webmin shell terminal) and then when launched invoke xdotool to emulate key actions on gnome-terminal such as typing a command string.
Here is the above colour test example written as a Webmin Command.
The export DISPLAY=:0 parameter is inserted to avoid an error if it is not used. This can be permanently set in environment to avoid setting this in every command.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I find that an added advantage of the setting export DISPLAY=:0 in the command string is that I can now launch applications directly from a Custom Command. In particular I can launch automation scripts which basically extend the Custom Commands library. I keep these in /etc/webmin-scripts/
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have Webmin with Authentic Theme installed in Ubuntu 16.04. After some period of dormancy, not using Webmin, I have revisited Webmin to build a catalogue of Custom Commands to hold CLI commands in use in development/deployment (Heroku, Google etc.).
I have created Categories for main menu and cloned Custum Commands - all working fine including forms to set parameters for commands.
However, I cannot recollect how to output coloured syntax through the command shell terminal. When I use local gnome-monitor terminal I can generate colour syntax.
For example in gnome-terminal I run this command
msgcat --color=testBut if I run this same test command in Webmin Custom Command the output remains black/white.
https://askubuntu.com/questions/27314/script-to-display-all-terminal-colors
How do I get colour syntax in Custom Command output?
A related question is how to apply colour to Execute button when running a Custom Command with a form? This will be a css setting somewhere in Authentic Theme.
After much researching I have found a workaround. Basically I can write a Webmin Command to launch Ubuntu gnome-terminal (bypassing Webmin shell terminal) and then when launched invoke xdotool to emulate key actions on gnome-terminal such as typing a command string.
Here is the above colour test example written as a Webmin Command.
export DISPLAY=:0 && gnome-terminal && xdotool type --delay 100 "msgcat --color=test" && xdotool key KP_EnterThe export DISPLAY=:0 parameter is inserted to avoid an error if it is not used. This can be permanently set in environment to avoid setting this in every command.
I find that an added advantage of the setting export DISPLAY=:0 in the command string is that I can now launch applications directly from a Custom Command. In particular I can launch automation scripts which basically extend the Custom Commands library. I keep these in /etc/webmin-scripts/