Skip to main content

Demystify - Linux GUI


GUI In Linux

GUI ( Graphics User Interface ) as everyone know about.  I am writing this article so that we can able to understand how to run GUI apps in containers but we need to understand how it works in linux.
Why linux? 
Most of the container we use are Linux based inorder run GUI in Linux we need know how it works..
Back in early days computer fill the entire room and if you want to access it you will be presented TTY (TeleType Machine)



you can still see this screen if you press CTRL + ALT + F1 in Linux. ( To get back to GUI press CTRL + ALT + F7 )
Linux spin off 8 TTY when it boots ( we can configure more or less )
Graphics in linux is handled by bunch of little programs.
They are


Display manager

Display manger which is the key component for graphics in which mainly graphics servers lie
in linux the X.org is the defacto of Display manger.

which has two components
  • X Server 
  • X Client
Here little twist server talks to the client ( opposite of client-server architecture )
server send and recieve data from client through X protocols

Display manager can able to draw windows in the screen but cannot able to manage window this where Window Manager comes into play

typing  startx to start the basic X client from the TTY



Other than X.org there are few
  • wayland
  • mir

Window manager

Window manage take care of the window decoration, which manage window layouts such as tiling,tabs,stack,floating( which is what we mostly use ) and enable us to resize,move,hide,show windows.Window manager is enough to control graphics in most part.

There are lot of window manager to use below are the few
  • openbox
  • fluxbox
  • i3wm - my favourite
  • dwm
  • awesome
  • xmonad

This is my old configuration of the i3wm. you can find the configuration file for the above image in https://github.com/ThangaAyyanar/dotfile

These window manager communicate with X server only.Window manager comes with a price - you need to configure it most of the times.
                                  The configuration may vary from editing simple text file to writing in programming language.Funny thing is you need to set wallpaper using other programs mostly.
if your using wayland then you cannot use the above window manager directly ( we can able to run X.org on top of wayland and run window manager but it is costly ).

To make it even more simple we create a desktop environment.

Desktop environment (or) Graphical Interface

which contain window manager and other extra features such as Icons,toolbars,wallpapers,widgets
few desktop environment are
  • GNOME
  • KDE
  • Mate
  • XFCE
  • LXDE
  • Budgie
  • Cinnamon

This is XFCE desktop environment with little bit customization.

This is simple article to illustrate the Linux graphics. In upcoming article we will discover how we can able to run GUI from docker.

Resources:
  • DotShareIt -> here you can find the different configuration for window managers and TUI apps (TUI - Terminal User Interface).
  • X over SSH -> how you can forward x-server through SSH.
  • Desktop Environment -> More desktop environment screenshots and concepts.
  • X Protocol -> How X protocol works.

Comments

Popular posts from this blog

Ecosia

ECOSIA - A Green search engine “ Ecosia donates 80% profits to planting trees” Site: www.ecosia.org Lauched on 7 th December 2009 and created by Christian Kroll available in more than 26 language. It is located in Berlin, Germany.It is also called as CO2-neutral company.Ecosia has donated to different tree-planting programs. Until December 2010 Ecosia’s donations went to a program by WWF Germany that protected the Juruena-National park in the Amazonas. In order to make sure the protection was kept up, the program also drew up and financed plans with timber companies and the  local communities. According to B-labs, as of January 2015, "In donating 80 percent of its ad revenue, the search engine has raised over $1.5 million for rainforest protection since its founding in December 2009." According to Ecosia, by 2015, the search engine had almost 2.5 million active users, and searches through it had resulted in more than 2 million trees being planted.Since October 201

C program jackpot

/*Program to show sum of 10 elements of array & show the average.*/ #include<stdio.h> int main () { int a[ 10 ],i,sum = 0 ; float av; printf( "enter elements of an aaray: " ); for (i = 0 ;i < 10 ;i ++ ) scanf( "%d" , & a[i]); for (i = 0 ;i < 10 ;i ++ ) sum = sum + a[i]; printf( "sum=%d" ,sum); av = sum / 10 ; printf( "average=%.2f" ,av); return 0 ; } Output: enter elements of an array : 4 4 4 4 4 4 4 4 4 4 sum = 40 average = 4.00 /*Program to find the maximum no. in an array.*/ #include<stdio.h> void main () { int a[ 5 ],max,i; printf( "enter element for the array: " ); for (i = 0 ;i < 5 ;i ++ ) scanf( "%d" , & a[i]); max = a[ 0 ]; for (i = 1 ;i < 5 ;i ++ ) { if (max < a[i]) max = a[i]; } printf( "maximum no= %d" ,max); } Output: enter elements for array : 5 4 7 1 2 maximum no = 7 /*Swapp

C program for bracket matching

# include < stdio.h > int main ( ) { char a [ 24 ] , stack [ 24 ] ; int n , i , top = 0 , cnt = 0 ; scanf ( " %s " , a ) ; n = strlen ( a ) ; if ( n % 2 = = 0 ) { for ( i = 0 ; i < n ; i + + ) { switch ( a [ i ] ) { case '(' : case '{' : case '[' : case '<' : stack [ top + + ] = a [ i ] ; break ; case ')' : if ( stack [ - - top ] = = '(' ) { cnt + + ; } break ; case '}' : if ( stack [ - - top ] = = '{' ) cnt + + ; break ; case ']' : if ( stack [ - - top ] = = '[' ) cnt + + ; break ; case '>' : if ( stack [ - - top ] = = '<' ) cnt + + ; break ; default : break ; } } //printf("%s %d %d",stack,cnt,n); if ( n / 2 = = cnt ) printf ( " valid " ) ; else printf ( " invalid " ) ; } else printf ( " invalid " ) ; return 200 ; } if u have