In my first "Corona virus run" where I observed on the HET from home, I that found one of the things I really wanted was a terminal window that constantly displayed the current UT time. I wanted large, easily read text, and I wanted to be able to control the time that the display would run and the cadence of the updates.
It would be nice to have a small window with big text fonts. Below I show a way to do that, where I rely on a gnome-termianl profile that I built using the Edit,Preferences menu on one of my terminal windows. The name of the profile is "SCO3".
Example 1: gnome-terminal --window-with-profile=SCO3 --geometry=30x4+800+40 \ --hide-menubar & Example 2: gnome-terminal --window-with-profile=SCO3 --tab-with-profile=SCO1 \ --geometry=80x22+80+40 --working-directory="/home/mcs/astronomer/sco/Cplay" &In the first example I open a small window with SCO3 and make the menu bar on the resulting termnal window disappear. In the second exmaple I do two other useful thins: 1) I open a tab in the window, and 2) I specify the directory I want to go to when the window is opened. I wrote a more versatile terminal-opening script named gt1. It is pretty simple, but it demonstrates how to open a window with a single small command. Return to top of page.
With the small window opened by gt1 we can now run the routine that will give and updating display of the currebt Universal Time (UT).
Usage: showut 10000 5 arg1 - number of time steps to display (1000) arg2 - sleep time in seconds between steps (5) % showut 10000 5You can see a full listing of showut. Baiscally it first erases the propmt, and then starts a loop that reads and displays the UT in a user-specified cadence. Return to top of page.
In Ubuntu18.04 we can use workspaces. These are like the "virtual desktops" of Redhat or older versions of ubuntu. Basically, we can move windows, like those creates in the previous sections, to other work areas in our destop system. You can read about workspaces.
Return to top of page.In mid-May2020 I began playing around with gnome and firefox profiles to control the placement and style of windows. I was also horsing around with writing bash scripts that use optional command line arguments. Here are some notes on this stuff.
What gnome-terminal profiles do I have? ~/.gconf/apps/gnome-terminal/profiles *** There is no dir like this in my Ubuntu 18.04 setup. % dconf dump /org/gnome/terminal/legacy/profiles:/ | grep -n 'font' 10:use-system-font=false 11:font='Monospace 16' 19:use-system-font=false 21:font='Monospace 30' 30:use-system-font=false 32:font='Monospace 22' % dconf dump /org/gnome/terminal/legacy/profiles:/ | grep -n 'visible-name' 8:visible-name='SCO1' 15:visible-name='SCO3' 26:visible-name='SCObig1' gnome-terminal --window-with-profile=SCObig1 --geometry=80x18+300+60 To get two tabs: gnome-terminal --window-with-profile=SCObig1 --tab-with-profile=SCObig1 -t "MyTitle" --geometry=80x18+300+60 gnome-terminal --window-with-profile=SCO1 --tab-with-profile=SCO1 -t "MyTitleAgain" --geometry=80x18+300+160 gnome-terminal --title="SOME TITLE HERE" --window-with-profile=SCO1 --tab-with-profile=SCO1 -t "MyTitleAgain" --geometry=10x4+300+260 *** When I change the geometry, nothing seems to happen. % gnome-terminal --help-window-options --hide-menubar Turn off the menubar --geometry=GEOMETRY Set the window size; for example: 80x24, or 80x24+200+200 (COLSxROWS+X+Y) gnome-terminal --hide-menubar These change the size and placement easily: gnome-terminal --hide-menubar --geometry=30x8+100+100 gnome-terminal --hide-menubar --geometry=30x8+500+500 gnome-terminal --hide-menubar --geometry=20x5+500+500 % gnome-terminal --help-all % gnome-terminal --print-environment gnome-terminal --hide-menubar --geometry=20x5+500+500 --window-with-profile=SCObig1 --command "showut 40000 1" ========================================== What about my firefox windows? This does change the window size: firefox -height 640 -width 480 % firefox -height 800 -width 1600 # a good size for my (left-hand) acer monitor on sco2019 Note: It seeems that firefox "remembers" that last windo size you used. If I open ff again with just "% firefox" it uses the size I set above (assuming I did not change the window while using it). How do I see/specify a profile? % firefox -P This brings up a box that shows your profiles. I see I have a profile I made named SCO0 % firefox -P SCO0 As astronomer on mcs, my (sco) profiles are: SCO SCO-htopx SCO2 I find that this works on my nomachine, left-hand window: [astronomer@mcs Fplay]$ firefox -height 800 -width 1600 -P SCO2 These also work: [astronomer@mcs Fplay]$ fxo -p SCO2 [astronomer@mcs Fplay]$ fxo -p SCO2 & One last thing: If I close the bookmarks sidebar, and then close firefox, when I execute the above commands, then the browser comes up with the bookmarks sidebar closed. The profile "remembers" the last state of your browser. I wrote a short script (fxo) that does some of this. ==================================================================================== #!/bin/bash usage() { printf "usage: fxo [-v] [-h]] [-p] \n" printf "Usage: fxo \n" printf "Additional options: \n" printf " -v = print verbose comments and run in debug mode \n" printf " -h = show a help file and then exit \n" printf " \n" } #### MAIN interactive="N" prof_name="SCO0" verbose="N" # If there are no command line arguments, just print usage message if [ $# = "0" ] then usage # exit fi prof_name="SCO0" #--------------------------------------------------------------------- # survey the command line arguments while [ "$1" != "" ]; do case $1 in -p | --profile ) shift prof_name=$1 ;; -i | --interactive ) interactive="Y" ;; -v | --verbose ) verbose="Y" ;; -h | --help ) show_help fxo exit esac shift done #--------------------------------------------------------------------- if [ $verbose = "Y" ] then printf "Verbose flag is ON in fxo \n" printf "Firefox profile name (prof_name) = $prof_name \n" message_and_read s fi printf "I will use firefox profile = $prof_name \n" firefox -height 800 -width 1600 -P $prof_name ====================================================================================
I incorporated some of the stuff above and wrote a single script that opens a good terminal winod (big fonts) and uses my showut code to display the current UT time. Here is the source code for this (clock1):
#!/bin/bash cleanit() { \rm -f base.1 } usage() { printf "usage: clock1 [-v] [-h] \n" } #---------------------------------------------------------- # Determine if debug or HELP mode is invoked debug="N" interactive="N" numargs="$#" for var in "$@"; do # echo "\$@ = $var" if [ "$var" = "-v" ] then debug="Y" fi if [ "$var" = "-i" ] then interactive="Y" fi if [ "$var" = "--help" ] then show_help clock1 exit fi done #---------------------------------------------------------- # gnome-terminal --geometry=20x5+500+500 \ # --hide-menubar \ gnome-terminal \ --window-with-profile=SCObig2 \ --command "showut 40000 1" if [ $debug = "Y" ] then message_and_read s exit fi # Perform cleanup cleanitI can change a bucnch of stuff in this code, but the basics point is that I can type one command (clock1) and a nice big windo w pops up running my UT clock.
![]() |
The simple clock1 script made this display in a gnome-terminal. It uses the showut script to make an updating UT time display. |