How to exit full screen in chromium if using tocuh scrren - raspbian

How to exit full screen in chromium programmatically?
Here is my scenario:
Running this command when raspbian startup
chromium-browser --start-fullscreen -incognito http://ooxx.com/index.html
Basically this html contain only a .png image
We use touch panel (no keyboard and mouse)
Is there anyway I can create a <div>, and allow user to tap it and run some script to exit full screen mode?

You can simulate keypress (F11) via JavaScript.
https://www.tutorialspoint.com/How-to-simulate-a-keypress-event-in-JavaScript

Related

Developing task switcher, code changes not reflected on Alt+Tab

I'm developing my own task switcher in QML. When I change the code (main.qml) and press Alt+Tab, the KDE task switcher stays the same even if its preview from the System Settings shows the changes. The task switcher gets updated only after the next login.
I use Kubuntu 22.10, KDE 5.26.5 and my Task switcher is in ~/.local/share/kwin/tabbox/ folder.
Is there a way to apply QML code changes or to notify KDE about the source code being modified? Or is there another way to develop a task switcher (not invoking it by Alt+Tab)?
I tried removing qmlcache rm -rf ~/.cache/*qmlcache*, but it didn't help.
Restarting KWin should work: kwin_x11 --replace (if you're on X11; afaik it's not possible to restart the window manager on Wayland).
You can also try qdbus org.kde.KWin /KWin org.kde.KWin.reconfigure.

autoit +selanium on jenkins does not work

enter image description hereI have a selenium test implement for web application and implemented autoit to do a folder upload to my application. This folder upload initiates a chrome popup warning which has no title but 2 buttons "Upload" and "Cancel" (default selected). The folder upload is in the control of my application and has title for the popup window. So I could see controlfocus worked on upload folder popup even when my test was deployed on jenkins. But it does not click on the Chrome popup warning
#include <WinAPIFiles.au3>
ControlFocus("Select Folder to Upload","","Edit1")
ControlSetText("Select Folder to Upload","","Edit1","<Myfolder Path>")
sleep(4000)
ControlClick("Select Folder to Upload","","Button1")
sleep(4000)
;this is for the popup warning from chrome
ControlFocus("[CLASS:Edit; INSTANCE:1]","","Edit1")
Send("{LEFT}") <===== this and below does not ever work on jenkins but works on local
execution
Send("{ENTER}")
;sleep(10000)
exit(0)
my selenium code has
String filepath = ".\\uploadfile.bat";
Process p1 = Runtime.getRuntime().exec( filepath );
uploadfile.bat is ....
START /wait c:\AutoIT\uploadfld.exe
As first step run yours AutoIt script, and just after that click the HTML element using selenium.
Do not try to run AutoIt script after clicking the HTML element in selenium, as this stops your selenium because browser waits for file selection.
And as I said in one other cases (question which I answer some time ago), there should be other possibilities to do that without AutoIt, even without invoking the pop up window.

How can I enable Live Reload or Hot Reload without having to shake my phone?

I started using React Native for about 2 weeks, and sometimes I need to reinstall the app, then shake the phone again and enable the live reload.
It's funny at the first week, but then it gets boring to have to shake the phone while developing.
Is there any config file which I can set those development properties to be always enabled?
You can add hot reload function with hold the menu button in your phone
it show the developer menu setting for react native app
after that you can select the hotreload function
or you can type this on your terminal
adb shell input keyevent 82
There's a closed issue related to open the menu by pressing the screen with 3 fingers. You can check if in the latest versions (or in expo) it is working: https://github.com/facebook/react-native/issues/10191
Also there are other 3 solutions:
1) You can run adb shell input keyevent KEYCODE_MENU in your terminal
2) Try this: https://github.com/facebook/react-native/issues/10191#issuecomment-328854286
Open RN dev menu
/usr/local/bin/adb shell input keyevent KEYCODE_MENU Reload RN
/usr/local/bin/adb shell input keyevent 82 /usr/local/bin/adb shell
input keyevent 66 /usr/local/bin/adb shell input keyevent 66 (reload
was not always working without adding the last line)
In Preferences->Keyboard->Keyboard shortcuts you can then map these
services to keyboard shortcuts. I added the shortcuts for the context
of my editor (Webstorm) and React Native debugger. In these programs I
can now press Ctrl+D to show the developer menu and Ctrl+R to reload
which works perfectly.
3) Or you can try this (Android only) https://medium.com/delivery-com-engineering/react-native-stop-shaking-your-phone-1f4863140146
Set up an Automator Service by opening Automator, clicking “New
Document”, and choosing “Service”.
Find and select the “Run Shell Script” action. Choose “no input” for “Service receives” and enter: /usr/local/bin/adb shell input
keyevent 82 If adb is located elsewhere in your system, change the
path to adb. You can find out with: $ which adb
Save and remember what name you give the action.
Open “System Preferences”, go to “Keyboard” and select the “Shortcuts” tab. Select “Services” on the left column and find your
service by name.
Click where it says “none” and enter the keyboard shortcut you want to use. Make it something unique or it will conflict with an existing
shortcut.
Notes: Android only Must be plugged in If you’ve never run the
following with this device, run it first before trying the shortcut: $
adb reverse tcp:8081 tcp:8081
Hope it helps.
run adb shell input keyevent KEYCODE_MENU in your terminal

Reload a React Native app on an Android device manually via command line

I'd like to manually force a Reload of my React Native app on demand without physically shaking the device. (I'm getting carpal tunnel.)
I know that Live Reload / Hot Reload are available. I'm looking for a on-demand command line solution.
Using the cmd line you can send a command to the Android device.
adb shell input text "RR"
This command tells the Android device to type the character "R" twice which is the React Native command to Reload on Android.
The adb shell command has many useful features many of which are described here:
ADB Shell Input Events
To open the developer menu:
adb shell input keyevent 82
Just posting it here in case you didn't know this trick
long press the menu button in your android device. Then you'll get this menu
tap the reload option and you are good to go
I use the following command. It doesn't reload the app, but it brings up the developper menu on the device, so I can then press the "Reload" option:
adb shell input keyevent KEYCODE_MENU
I develop with a real device (not the emulator) and sending the "double-R" through adb doesn't work (it just shows the keyboard and types 2 Rs).
Add the following script to your package.json:
"android-shake": "adb shell input keyevent 82"
Then you will be able to call
yarn android-shake
If you are looking for ios then checkout my answer on this link
One trick would be to add this command on ~/.bashrc profile in the case you're using unix.
use your favorite editor (ex: nano on Ubuntu) and type nano ~/.bashrc
on the end of file write alias rnreload='adb shell input text "RR"'
save it and run source ~/.bashrc in order to active it.
Now whenever you need, just type rnreload on a terminal.
Next time you enter your computer it should be already done.
Also, there's the possibility to add an other alias as well: alias rnshake='adb shell input keyevent 82' which "shakes" android. You can use it to access other commands like Hot Reloading, Debugger, Inspector, etc.
Made an autohotkey script to reload and open the menu with keyboard shortcuts.
^+r:: run, %comspec% /c adb shell input text "RR",,hide
^+e:: run, %comspec% /c adb shell input keyevent 82,,hide
ctrl+shift+r to reload
ctrl+shift+e to open dev menu
If you're on a Mac and using Hammerspoon, you can put the following bit of code in your ~/.hammerspoon/init.lua file:
hyper = {'ctrl', 'alt', 'cmd'}
placid = {'ctrl', 'cmd'}
-- React native reload JS on connected device
hs.hotkey.bind(placid, 'R', function()
os.execute('/Users/peter/Library/Android/sdk/platform-tools/adb shell input text "RR"')
end)
-- React native show dev menu on connected device
hs.hotkey.bind(hyper, 'R', function()
os.execute('/Users/peter/Library/Android/sdk/platform-tools/adb shell input keyevent 82')
end)
the os.execute command doesn't load your ENV (doing so would make running commands really slow), so make sure to run which adb in your terminal to figure out what the exact path to adb is. (in my case it was /Users/peter/Library/Android/sdk/platform-tools/adb).
Now you can reload your app using ctrl+cmd+R and show the dev menu using ctrl+option+cmd+R from anywhere and without even bothering to cmd-tab out of your favorite editor!
For device you have just to shake your device than a menu appears so click on Reload

Computer overriding autorun behaviour of CD?

I'm hoping this isnt too much of a problem, but I want to make sure.
I'm creating an autorun CD that when put in, will launch a Flash Video with links for customers to navigate through.
I've created my autorun.inf file in the root directory of the CD with the following info in it:
[autorun]
open=catmenu.exe
However, when I try and run the file on an other computer I still get the options screen 'run program or open to view files'. If I click 'run program' then it launches like normal. I think this is just the computer overiding the autorun feature, but I've never made a CD before so I cant be sure. Is there a way to bypass this 'run or view' option or is that just the way it is?
The autorun is determined by the operating system. For Windows 7 as an example - you can go to the Control Panel | AutoPlay and change the settings for each type of media (software, music, video). It is generally safest to work with the "Ask me" option or "Take no action"