Chrome losing focus on webpage
Hi guys!
Today I am going to share with you guys a tip.
For those that uses vimium, have you always encountered a time where the focus is lost and not on the webpage and will render every shortcut in viumium useless?
I always used to hate that as I didn’t wanted to move my hands to my mouse and always trying to hit the tab
button and hopefully the focus would magically appear.
Well! There’s a workaround for that! 🙂
To open your search engines settings, type the following in your URL bar in chrome.
chrome://settings/searchEngines
Then add a entry to it under the Other search engines
, scroll to the bottom, you should see 3 empty fields like the second image below.
Now, add the shortcut!
Under the field Add a new search engine
, input something like “Focus on webpage” or something.
Then for the keyword, add the preferred shortcut for your choice to trigger it to make your computer focus on the page.
My preference is
f
Then in the URL with %s in place
field, add:
javascript:
It should look something like the image below.
Then hit the Return
key.
So after adding, the settings panel will look like this.
Then hit the done
button! 🙂
How to use it?
So there comes to a scenario, where the focus is not on the page!
So most likely I’ll have to hit the tab
key a few times before I get my focus on the webpage and be able to use my vimium shortcuts.
Now, time to demostrate the workaround! 🙂
Hit CMD + L
for mac users or CTRL+L
for windows user.
Then hit the shortcut u added for the second field, mine was f
Then hit the Return
key!
There! Focused back on the page! Vimium FTW! 🙂
Regards,
Steve
SiriProxy + Raspberry Pi + my little lamp = awesome sense of achievement
Not trying to say that I’ve created/invented something very awesome. But the sense of being able to DIY and learning lots of things from it. The sense of achievement is really there. =)
Also, there might already be blogs teaching how to do it, but I am still gonna write about how it works and the problems I’ve faced while doing it and hopefully there would be still some of you guys that will benefit from it.
This is what you’ll get at the end of this tutorial.
Warning! Do proceed with this project with care as you are dealing with AC electricity which could potentially kill you.
Cut the crap! Now for the interesting part!
How did I do it?
What you will need:
- Some basic electronics and electrical skill
- 01 x Raspberry Pi with SiriProxy installed
- 01 x Relay control kit which I happened to have one lying around because I was tinkering with Arduino last time in school.
- 01 x switch lying around
- 01 x Raspberry Pi cobbler kit
- 01 x Multimeter (Optional but will be good for troubleshooting)
- Some jumper wires
Get SiriProxy running
If you have not installed SiriProxy on your Raspberry Pi, please do so. You can the guide here.
Check if your SiriProxy’s plugin file are working:
Note:
For this example, I am going to edit SiriProxy example instead of creating a new one but if you would like to use this project for many many of your switches at home, it’s generally a good idea to create your own plugin, but for simplicity sake, I shall stick with this.
First in your Raspberry Pi’s terminal,
type :
vim ~/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb
Inside siriproxy-example.rb
edit:
listen_for /test siri proxy/i do
to
listen_for /hello siri proxy/i do
I had a hard time troubleshooting if it works because I missed the following step.
In which I’ve found the answer from the SiriProxy’s Wiki page.
After editing of plugin file, type:
siriproxy update .
Then start Siriproxy server on your Raspberry Pi again:
siriproxy server
Now, test from your iPhone that it’s working by launching Siri and saying:
“hello siri proxy”
And if Siri replies you with
siri proxy is up and running
congrats, you have just successfully edited the siriproxy example plugin.
Now install WiringPi!
Installation of WiringPi is pretty, I’ve followed the instructions of @drogon’s and didn’t encounter any problems.
Type your code to make it work! 🙂
Edit your plugin to make it work! Type the following into your terminal :
vim ~/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb
Then in your file just under the
listen_for /hello siri proxy/i do
...
...
...
end
Add the following code:
listen_for /turn on the lights/i do
say "turning on the lights"
request_completed
system("gpio mode 1 out")
system("gpio write 1 1")
end
listen_for /turn on the lights/i do
say "turning on the lights"
request_completed
system("gpio mode 1 out")
system("gpio write 1 1")
end
The code is pretty much self-explainatory for listen_for /turn on the lights/i do
and say "turning on the lights"
request_completed
tells Siri that the request is completed and stop Siri from the endless spinning awaiting for another command from the server.
system("gpio mode 1 out")
makes the Raspberry Pi’s GPIO Pin 01 be an output.
system("gpio write 1 1")
makes the Raspberry Pi’s GPIO Pin 01 goes HIGH.
system("gpio write 1 0")
makes the Raspberry Pi’s GPIO Pin 01 goes LOW.
After editing, update siriproxy to read the local folder by typing :
siriproxy update .
Then start Siriproxy server on your Raspberry Pi again:
siriproxy server
Testing it (Small scale)
That’s when the Raspberry Pi cobbler kit comes into place.
Make sure your Raspberry Pi is powered down.
Connect the anode(positive) end of an LED to GPIO Pin 01, then connect the cathode(negative) end to GND pin of your Raspberry Pi.
Now turn your Raspberry Pi and start Siriproxy!
siriproxy server
Here’s a video of me testing it in a small scale.
Note that I am not using the Raspberry Pi cobble kit, as during that point of time I was too excited to see if it works. Totally not recommended as if any wires were to stray away, it would have made my RPi short circuit.
For those that is new to electronics, you might wanna read this article on instructables on LEDs for begineers.
Now lets do it large scale
Please please do note that we are dealing with AC voltages that could potentially kill you. Please proceed with caution.
-
Connect GPIO Pin 01 to the CTRL of the relay.
-
Connect the 5v Pin to the 5v of the Relay circuit board.
-
Connect the Gnd Pin to the Gnd of the Relay circuit board.
Please pardon my ugly drawing XD
Connect the ground wire of your appliances to the load of your Relay circuit board.
More information about the Arduino Relay shield on getting it to work, it’s somewhat the same except that the control pin is switch with the Raspberry Pi.
So what did I gained from this project:
- Refreshed my memory on the electronics stuff that I’ve tinkered with 1 year ago
- Learnt about WiringPi
- Awesome sense of achievement
Hope you guys like this article. 🙂
Regards,
Steve 🙂
Raspberry Pi’s “No space left on device” error message
Error message :
No space left on device
Possible solutions :
Expand rootfs
In the terminal type
sudo raspi-config
then select “expand_rootfs”
Found this solution from here.
Another method is to
Update your firmware
An easy way to do it is via :Â rpi-update