From 8be19de0c611b1dc15a59db8ac5086b53ac633d0 Mon Sep 17 00:00:00 2001 From: hender Date: Sun, 14 Jul 2019 15:10:41 -0400 Subject: Originales --- RaspberryPITVHDMI | 1606 ++++++++++++++++++++ .../0c41b826d1c81f42e55160501605d3c96ded0ae1.png | Bin 0 -> 3351 bytes RaspberryPITVHDMI_archivos/20.png | Bin 0 -> 188 bytes RaspberryPITVHDMI_archivos/2566_2.jpg | Bin 0 -> 1365 bytes RaspberryPITVHDMI_archivos/2566_2_002.jpg | Bin 0 -> 2498 bytes RaspberryPITVHDMI_archivos/2566_2_003.jpg | Bin 0 -> 988 bytes RaspberryPITVHDMI_archivos/32.png | Bin 0 -> 237 bytes RaspberryPITVHDMI_archivos/32_002.png | Bin 0 -> 707 bytes RaspberryPITVHDMI_archivos/45.png | Bin 0 -> 285 bytes RaspberryPITVHDMI_archivos/45_002.png | Bin 0 -> 280 bytes RaspberryPITVHDMI_archivos/45_003.png | Bin 0 -> 278 bytes .../75e71344378ac84843e886b21c71301deab5d960.js | 9 + ...91e1a171524cdf20a1a5bea75eb18455293e45dc37f4.js | 75 + .../bd34dee19ab76bc4f22cba22a34edbdab790a807.js | 19 + ...41a2ed67a367faeb0a582af064457e8b1b1354e52e6e.js | 2 + RaspberryPITVHDMI_archivos/css.css | 96 ++ ..._1_581866bb4050fdf1451a3946f2c02310c650f57b.css | 6 + ..._7_c7a073874a27ebdc0acb6535652305a0edb8a061.css | 1 + ...b720d634bb6a2ba84cad84c05078fd391_2_401x500.png | Bin 0 -> 48698 bytes ...6c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df.js | 19 + ...80a0ddd80943fb0530045088c839730119480af4c3d8.js | 8 + RaspberryPITVHDMI_archivos/facebook.svg | 56 + RaspberryPITVHDMI_archivos/jquery.js | 4 + RaspberryPITVHDMI_archivos/mastodon.svg | 16 + ...4c66e75c9ad0d17efb33e5633e91ae4b556c155058c9.js | 4 + ...y-01ba4719c80b6fe911b091a7c05124b64eeece964e.js | 2 + ...on-data-0a59ccab480941aaac91f9e7fa7f77496323.js | 2 + ...120a9f8cb0871483b66a95e534ce8e81f97d19c8cef9.js | 2 + ...e-b33ff981ecc4ae5cc254a569e9bde34f68337b177e.js | 5 + RaspberryPITVHDMI_archivos/rss.svg | 65 + RaspberryPITVHDMI_archivos/slightly_smiling.png | Bin 0 -> 920 bytes ...g-7-a49ad7255a63371eebe293cc86311573fb927cfb.js | 1 + RaspberryPITVHDMI_archivos/twitter.svg | 56 + ...a869fbd399d751711e74544b6d60bf034a5350b61c6c.js | 6 + RaspberryPITVHDMI_archivos/youtube.svg | 56 + 35 files changed, 2116 insertions(+) create mode 100644 RaspberryPITVHDMI create mode 100644 RaspberryPITVHDMI_archivos/0c41b826d1c81f42e55160501605d3c96ded0ae1.png create mode 100644 RaspberryPITVHDMI_archivos/20.png create mode 100644 RaspberryPITVHDMI_archivos/2566_2.jpg create mode 100644 RaspberryPITVHDMI_archivos/2566_2_002.jpg create mode 100644 RaspberryPITVHDMI_archivos/2566_2_003.jpg create mode 100644 RaspberryPITVHDMI_archivos/32.png create mode 100644 RaspberryPITVHDMI_archivos/32_002.png create mode 100644 RaspberryPITVHDMI_archivos/45.png create mode 100644 RaspberryPITVHDMI_archivos/45_002.png create mode 100644 RaspberryPITVHDMI_archivos/45_003.png create mode 100644 RaspberryPITVHDMI_archivos/75e71344378ac84843e886b21c71301deab5d960.js create mode 100644 RaspberryPITVHDMI_archivos/application-e820091e1a171524cdf20a1a5bea75eb18455293e45dc37f4.js create mode 100644 RaspberryPITVHDMI_archivos/bd34dee19ab76bc4f22cba22a34edbdab790a807.js create mode 100644 RaspberryPITVHDMI_archivos/browser-update-1741a2ed67a367faeb0a582af064457e8b1b1354e52e6e.js create mode 100644 RaspberryPITVHDMI_archivos/css.css create mode 100644 RaspberryPITVHDMI_archivos/desktop_1_581866bb4050fdf1451a3946f2c02310c650f57b.css create mode 100644 RaspberryPITVHDMI_archivos/desktop_theme_7_c7a073874a27ebdc0acb6535652305a0edb8a061.css create mode 100644 RaspberryPITVHDMI_archivos/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_401x500.png create mode 100644 RaspberryPITVHDMI_archivos/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df.js create mode 100644 RaspberryPITVHDMI_archivos/en-a2096d7903ea9680a0ddd80943fb0530045088c839730119480af4c3d8.js create mode 100644 RaspberryPITVHDMI_archivos/facebook.svg create mode 100644 RaspberryPITVHDMI_archivos/jquery.js create mode 100644 RaspberryPITVHDMI_archivos/mastodon.svg create mode 100644 RaspberryPITVHDMI_archivos/plugin-d3f2aabe1f4c66e75c9ad0d17efb33e5633e91ae4b556c155058c9.js create mode 100644 RaspberryPITVHDMI_archivos/plugin-third-party-01ba4719c80b6fe911b091a7c05124b64eeece964e.js create mode 100644 RaspberryPITVHDMI_archivos/preload-application-data-0a59ccab480941aaac91f9e7fa7f77496323.js create mode 100644 RaspberryPITVHDMI_archivos/preload-store-081120a9f8cb0871483b66a95e534ce8e81f97d19c8cef9.js create mode 100644 RaspberryPITVHDMI_archivos/pretty-text-bundle-b33ff981ecc4ae5cc254a569e9bde34f68337b177e.js create mode 100644 RaspberryPITVHDMI_archivos/rss.svg create mode 100644 RaspberryPITVHDMI_archivos/slightly_smiling.png create mode 100644 RaspberryPITVHDMI_archivos/svg-7-a49ad7255a63371eebe293cc86311573fb927cfb.js create mode 100644 RaspberryPITVHDMI_archivos/twitter.svg create mode 100644 RaspberryPITVHDMI_archivos/vendor-25f91d66eba869fbd399d751711e74544b6d60bf034a5350b61c6c.js create mode 100644 RaspberryPITVHDMI_archivos/youtube.svg diff --git a/RaspberryPITVHDMI b/RaspberryPITVHDMI new file mode 100644 index 0000000..0bd659a --- /dev/null +++ b/RaspberryPITVHDMI @@ -0,0 +1,1606 @@ + + + + +Controlling Raspberry PI with TV Remote, using HDMI CEC - Tips, Tricks and Tutorials / Raspberry Pi - Ubuntu MATE Community + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + + +
+ +
+
+
+
+ + +
+
+
+
+
+ + + + + + +
+ + +
+
4 / 4
Apr 2018
+ +
+
+
+ +
+
+
+ + + +

Hello everyone.

+

Description:
+I wrote a script that connects to HDMI CEC ( cec-client needed ) and +listens for TV Remote key presses. Based on the keys pressed / released +(or auto-released; holding down certain keys for too long makes them +auto-release) different actions are executed. Some examples:

+
    +
  • write letters and numbers using 0-9 keys (simulating 3x4 keypad +phones - key "2" switches between a-b-c-2, key 9 switches between +w-x-y-z-9) ( xdotool needed )
  • +
  • move mouse cursor using up/down/left/right (the longer you hold the +key down, the faster it goes) and click (enter = left click; channels +list = right click) ( xdotool needed )
  • +
  • opening web sites in chomium (red key for YouTube, green for Google, blue for incognito window)
  • +
+

If you want to use firefox instead of chromium, replace "chromium" with "firefox" in the script below.
+Alternatively, you can just install chromium:

+
sudo apt-get install chromium-browser
+
+

See all the available keys below:

+

+

These are the keys supported by my TV Remote. You can modify the script for your TV Remote, see Modification below.

+

Installation:
+First you need to install cec-client and xdotool; using terminal:

+
sudo apt-get install cec-client xdotool
+
+

Test if you can receive TV Remote button presses with cec-client; using terminal:

+
cec-client
+
+

You should see some diagnostic messages. Press numeric keys (as they +are most likely to be supported) on your TV Remote. Watch out for new +lines, especially of this form:

+
something something **key pressed: 8** something something
+
+

If you see this kind of messages, then this should work for you.
+If not, make sure you've got CEC enabled on your TV (see this WIKI 99 for more info).
+For my TV, pressing the Source button a couple of times helped (so it +kind-of flips trough all the sources and circles back to the Raspberry +Pi, detects CEC and connects to it).

+

So, on to the script / installation:
+Create the file cecremote.sh and mark it as executable; using terminal:

+
touch cecremote.sh
+chmod +x cecremote.sh
+
+

Then open it; using terminal:

+
nano cecremote.sh
+
+

Copy - paste this in the file:

+
#!/bin/bash
+function keychar {
+    parin1=$1 #first param; abc1
+    parin2=$2 #second param; 0=a, 1=b, 2=c, 3=1, 4=a, ...
+    parin2=$((parin2)) #convert to numeric
+    parin1len=${#parin1} #length of parin1
+    parin2pos=$((parin2 % parin1len)) #position mod
+    char=${parin1:parin2pos:1} #char key to simulate
+    if [ "$parin2" -gt 0 ]; then #if same key pressed multiple times, delete previous char; write a, delete a write b, delete b write c, ...
+        xdotool key "BackSpace"
+    fi
+    #special cases for xdotool ( X Keysyms )
+    if [ "$char" = " " ]; then char="space"; fi
+    if [ "$char" = "." ]; then char="period"; fi
+    if [ "$char" = "-" ]; then char="minus"; fi
+    xdotool key $char
+}
+datlastkey=$(date +%s%N)
+strlastkey=""
+intkeychar=0
+intmsbetweenkeys=2000 #two presses of a key sooner that this makes it delete previous key and write the next one (a->b->c->1->a->...)
+intmousestartspeed=10 #mouse starts moving at this speed (pixels per key press)
+intmouseacc=10 #added to the mouse speed for each key press (while holding down key, more key presses are sent from the remote)
+intmousespeed=10
+
+while read oneline
+do
+    keyline=$(echo $oneline | grep " key ")
+    #echo $keyline --- debugAllLines
+    if [ -n "$keyline" ]; then
+        datnow=$(date +%s%N)
+        datdiff=$((($datnow - $datlastkey) / 1000000)) #bla bla key pressed: previous channel (123)
+        strkey=$(grep -oP '(?<=sed: ).*?(?= \()' <<< "$keyline") #bla bla key pres-->sed: >>previous channel<< (<--123)
+        strstat=$(grep -oP '(?<=key ).*?(?=:)' <<< "$keyline") #bla bla -->key >>pressed<<:<-- previous channel (123)
+        strpressed=$(echo $strstat | grep "pressed")
+        strreleased=$(echo $strstat | grep "released")
+        if [ -n "$strpressed" ]; then
+            #echo $keyline --- debug
+            if [ "$strkey" = "$strlastkey" ] && [ "$datdiff" -lt "$intmsbetweenkeys" ]; then
+                intkeychar=$((intkeychar + 1)) #same key pressed for a different char
+            else
+                intkeychar=0 #different key / too far apart
+            fi
+            datlastkey=$datnow
+            strlastkey=$strkey
+            case "$strkey" in
+                "1")
+                    xdotool key "BackSpace"
+                    ;;
+                "2")
+                    keychar "abc2" intkeychar
+                    ;;
+                "3")
+                    keychar "def3" intkeychar
+                    ;;
+                "4")
+                    keychar "ghi4" intkeychar
+                    ;;
+                "5")
+                    keychar "jkl5" intkeychar
+                    ;;
+                "6")
+                    keychar "mno6" intkeychar
+                    ;;
+                "7")
+                    keychar "pqrs7" intkeychar
+                    ;;
+                "8")
+                    keychar "tuv8" intkeychar
+                    ;;
+                "9")
+                    keychar "wxyz9" intkeychar
+                    ;;
+                "0")
+                    keychar " 0.-" intkeychar
+                    ;;
+                "previous channel")
+                    xdotool key "Return" #Enter
+                    ;;
+                "channel up")
+                    xdotool click 4 #mouse scroll up
+                    ;;
+                "channel down")
+                    xdotool click 5 #mouse scroll down
+                    ;;
+                "channels list")
+                    xdotool click 3 #right mouse button click"
+                    ;;
+                "up")
+                    intpixels=$((-1 * intmousespeed))
+                    xdotool mousemove_relative -- 0 $intpixels #move mouse up
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    ;;
+                "down")
+                    intpixels=$(( 1 * intmousespeed))
+                    xdotool mousemove_relative -- 0 $intpixels #move mouse down
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    ;;
+                "left")
+                    intpixels=$((-1 * intmousespeed))
+                    xdotool mousemove_relative -- $intpixels 0 #move mouse left
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    ;;
+                "right")
+                    intpixels=$(( 1 * intmousespeed))
+                    xdotool mousemove_relative -- $intpixels 0 #move mouse right
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    ;;
+                "select")
+                    xdotool click 1 #left mouse button click
+                    ;;
+                "return")
+                    xdotool key "Alt_L+Left" #WWW-Back
+                    ;;
+                "exit")
+                    echo Key Pressed: EXIT
+                    ;;
+                "F2")
+                    chromium-browser "https://www.youtube.com" &
+                    ;;
+                "F3")
+                    chromium-browser "https://www.google.com" &
+                    ;;
+                "F4")
+                    echo Key Pressed: YELLOW C
+                    ;;
+                "F1")
+                    chromium-browser --incognito "https://www.google.com" &
+                    ;;
+                "rewind")
+                    echo Key Pressed: REWIND
+                    ;;
+                "pause")
+                    echo Key Pressed: PAUSE
+                    ;;
+                "Fast forward")
+                    echo Key Pressed: FAST FORWARD
+                    ;;
+                "play")
+                    echo Key Pressed: PLAY
+                    ;;
+                "stop")
+                    ## with my remote I only got "STOP" as key released (auto-released), not as key pressed; see below
+                    echo Key Pressed: STOP
+                    ;;
+                *)
+                    echo Unrecognized Key Pressed: $strkey ; CEC Line: $keyline
+                    ;;
+                    
+            esac
+        fi
+        if [ -n "$strreleased" ]; then
+            #echo $keyline --- debug
+            case "$strkey" in
+                "stop")
+                    echo Key Released: STOP
+                    ;;
+                "up")
+                    intmousespeed=$intmousestartspeed #reset mouse speed
+                    ;;
+                "down")
+                    intmousespeed=$intmousestartspeed #reset mouse speed
+                    ;;
+                "left")
+                    intmousespeed=$intmousestartspeed #reset mouse speed
+                    ;;
+                "right")
+                    intmousespeed=$intmousestartspeed #reset mouse speed
+                    ;;
+            esac
+        fi
+    fi
+done
+
+

Finally, save it; using nano in terminal:
+press "Ctrl+X" to close the file, then "Y" to confirm saving, then "Enter" to save the file under the right file name

+

Try executing it, using terminal:

+
cec-client | ./cecremote.sh
+
+

At this point it should be working.
+Point the TV Remote at the TV, press up/down/left/right and check if the mouse pointer is moving.
+Press 9 44 2 8 7777 0 88 7 and it should write "whats up".

+

The script doesn't output anything, except when it encounters a +button press that it doesn't recognize, or it doesn't have a function +set up for that button yet (play button being one of them).
+If you want it to output all the messages it receives, find the line and uncomment it by deleting the # : #echo $keyline --- debugAllLines

+

So, if everything works, exit the script in terminal: Press Ctrl+C

+

Run at startup:
+If you want to start this script every time the Raspberry starts, create + a new file called cecremotestart.sh and mark it as executable; using +terminal:

+
touch cecremotestart.sh
+chmod +x cecremotestart.sh
+
+

Then open it; using terminal:

+
nano cecremotestart.sh
+
+

Copy - paste this in the file:

+
#!/bin/bash
+cec-client | /home/raspberry/cecremote.sh #<-- change this according to your username / path to the script
+
+

Finally, save it; using nano in terminal:
+press "Ctrl+X" to close the file, then "Y" to confirm saving, then "Enter" to save the file under the right file name

+

Then add this in the Startup Programs (Menu - System - Control Center + - Startup Programs; Add; Give it a name, and enter the path (or press +Browse) of the script in the filesystem).

+

Restart, try, report :slightly_smiling:

+

Modification:
+If you want, you can edit the script to change or add the commands executed on certain button presses.
+You can detect the additional buttons that CEC on your TV supports. Kill + the running cec-client, run the cec-client in the terminal, and watch +for the output while you're pressing all the keys on your TV Remote; +using terminal:

+
killall cec-client
+cec-client
+Ctrl+C when you're ready to stop
+
+

Edit the script, then execute the modified script by manually executing cecremotestart.sh; using terminal:

+
./cecremotescript.sh
+Ctrl+C to stop
+
+

When you're satisfied, just restart your Raspberry PI.

+

That's it from me - a simple and crude way to control your Raspberry +PI with the TV Remote, for when you don't have the keyboard/mouse +connected and VNC-ing is too much of a bother.

+

Try it and report :slightly_smiling:

+
  • created

    Mar '16
  • last reply

    Apr '18
  • 3

    replies

  • 16.7k

    views

  • 4

    users

  • 3

    likes

  • 3

    links

8 months later

You should submit this to https://github.com/raspberrypi/linux/pulls 84 it should be always with a raspberry

+

Look at this one

+
#!/bin/bash
+function keychar {
+    parin1=$1 #first param; abc1
+    parin2=$2 #second param; 0=a, 1=b, 2=c, 3=1, 4=a, ...
+    parin2=$((parin2)) #convert to numeric
+    parin1len=${#parin1} #length of parin1
+    parin2pos=$((parin2 % parin1len)) #position mod
+    char=${parin1:parin2pos:1} #char key to simulate
+    if [ "$parin2" -gt 0 ]; then #if same key pressed multiple times, delete previous char; write a, delete a write b, delete b write c, ...
+        xdotool key "BackSpace"
+    fi
+    #special cases for xdotool ( X Keysyms )
+    if [ "$char" = " " ]; then char="space"; fi
+    if [ "$char" = "." ]; then char="period"; fi
+    if [ "$char" = "-" ]; then char="minus"; fi
+    xdotool key $char
+}
+datlastkey=$(date +%s%N)
+strlastkey=""
+intkeychar=0
+intmsbetweenkeys=500 #two presses of a key sooner that this makes it delete previous key and write the next one (a->b->c->1->a->...)
+intmousestartspeed=15 #mouse starts moving at this speed (pixels per key press)
+intmouseacc=0 #added to the mouse speed for each key press (while holding down key, more key presses are sent from the remote)
+intmousespeed=15
+switch=0
+browser=/etc/alternatives/x-www-browser
+test -e /usr/bin/firefox && browser=firefox
+test -e /usr/bin/chromium-browser && browser=chromium-browser
+
+
+while read oneline
+do
+    keyline=$(echo $oneline | grep " key ")
+    #echo $keyline --- debugAllLines
+    if [ -n "$keyline" ]; then
+        datnow=$(date +%s%N)
+        datdiff=$((($datnow - $datlastkey) / 1000000)) #bla bla key pressed: previous channel (123)
+        strkey=$(grep -oP '(?<=sed: ).*?(?= \()' <<< "$keyline") #bla bla key pres-->sed: >>previous channel<< (<--123)
+        strstat=$(grep -oP '(?<=key ).*?(?=:)' <<< "$keyline") #bla bla -->key >>pressed<<:<-- previous channel (123)
+        strpressed=$(echo $strstat | grep "pressed")
+        strreleased=$(echo $strstat | grep "released")
+        if [ -n "$strpressed" ]; then
+            #echo $keyline --- debug
+            if [ "$strkey" = "$strlastkey" ] && [ "$datdiff" -lt "$intmsbetweenkeys" ]; then
+                intkeychar=$((intkeychar + 1)) #same key pressed for a different char
+                intmousespeed=100
+            else
+                intkeychar=0 #different key / too far apart
+            fi
+            datlastkey=$datnow
+            strlastkey=$strkey
+            case "$strkey" in
+                "1")
+                    xdotool mousemove 270 154
+                    ;;
+                "2")
+                    xdotool mousemove 679 154
+                    ;;
+                "3")
+                    xdotool mousemove 1090 154
+                    ;;
+                "4")
+                    xdotool mousemove 270 382
+                    ;;
+                "5")
+                    xdotool mousemove 679 382
+                    ;;
+                "6")
+                    xdotool mousemove 1090 382 
+                    ;;
+                "7")
+                    xdotool mousemove 270 604 
+                    ;;
+                "8")
+                    xdotool mousemove 679 604
+                    ;;
+                "9")
+                    xdotool mousemove 1090 604 
+                    ;;
+                "0")
+                    xdotool key Prior
+                    ;;
+                "previous channel")
+                    xdotool key Space #Enter
+                    ;;
+                "channel up")
+                    xdotool click 4 #mouse scroll up
+                    ;;
+                "channel down")
+                    xdotool click 5 #mouse scroll down
+                    ;;
+                "channels list")
+                    xdotool click 3 #right mouse button click"
+                    ;;
+                "up")
+                    xgm=$(xdotool getmouselocation   --shell | grep Y | sed -e s/^..// ) 
+                    intpixels=$((-1 * intmousespeed * 2))
+                    test $switch -eq 1 && xdotool key Up || xdotool mousemove_relative -- 0 $intpixels #move mouse up
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    test $xgm$(xdotool getmouselocation   --shell | grep Y | sed -e 's/^..//' ) -eq 00 && xdotool mousemove_relative -- 0 768
+                    ;;
+                "down")
+                    xgm=$(xdotool getmouselocation   --shell | grep Y | sed -e s/^..// ) 
+                    intpixels=$(( 1 * intmousespeed))
+                    test $switch -eq 1 && xdotool key Down || xdotool mousemove_relative -- 0 $intpixels #move mouse down
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    test $xgm$(xdotool getmouselocation   --shell | grep Y | sed -e 's/^..//' ) -eq 767767 &&  xdotool mousemove_relative -- 0 -768
+                    ;;
+                "left")
+                    xgm=$(xdotool getmouselocation   --shell | grep X | sed -e s/^..// ) 
+                    intpixels=$((-1 * intmousespeed * 2 ))
+                    test $switch -eq     1 && xdotool key Left || xdotool mousemove_relative -- $intpixels 0 #move mouse left
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    test $xgm$(xdotool getmouselocation   --shell | grep X | sed -e 's/^..//' ) -eq 00 &&  xdotool mousemove_relative -- 1359 0
+                    ;;
+                "right")
+                    xgm=$(xdotool getmouselocation   --shell | grep X | sed -e s/^..// ) 
+                    intpixels=$(( 1 * intmousespeed))
+                    test $switch -eq 1 &&  xdotool key Right || xdotool mousemove_relative -- $intpixels 0 #move mouse right
+                    intmousespeed=$((intmousespeed + intmouseacc)) #speed up
+                    test $xgm$(xdotool getmouselocation   --shell | grep X | sed -e 's/^..//' ) -eq 13591359 && xdotool mousemove_relative -- -1359 0
+                    ;;
+                "select")
+                    test $switch -eq 1 && xdotool key Return ||  xdotool click 1 #left mouse button click
+                    ;;
+                "return")
+                    #xdotool key "Alt_L+Left" #WWW-Back
+                    ((switch++))
+                    test $switch -eq 2 && switch=0 
+                    ;;
+                "exit")
+                    ((switch++))
+                    test $switch -eq 2 && switch=0
+                    ;;
+                "F2")
+                    ((menu++))
+                    xdotool key  Escape
+                    test $menu -eq 1 &&  xdotool click 3 || xdotool key Super_L
+                    test $menu -eq 2 && menu=0
+                    switch=1
+                    ;;
+                "F3")
+                    $browser &
+                    ;;
+                "F4")
+                    ((xvkbd++))
+                    switch=0
+                    xdotool mousemove 1100 750 
+                    xvkbd