droid15
Posts: 2
Joined: Mon Jul 01, 2019 3:12 pm

some tweaks for raspbian stretch

Mon Jul 01, 2019 3:57 pm

I just started playing around with my raspberry (actually it's from my job, but i'm allowed to play with it), and managed to tweak and add some features (not created by me) that one could find useful or more convenient than the defaults.

1 - raspbian doesn't come with a paint (like the one pre-installed in every version of windows), and i find gimp too complex to navigate if you just want to apply basic operations to an image, pinta is a good option for a raspberry (kolourpaint is too heavy for a raspberry and every other painting program for linux is too complex for a paint replacement or too basic or even incomplete for the same purpose).

install pinta (paint for linux)

2 - the default file manager throws the files three at you as if you are using a terminal, thunar is more graphical, it shows devices and network, thats more friendly to users.

install thunar (file manager)
post install:
go to application launchbar settings (right click on the launch bar) replace default

3 - in order to take screenshoots you are supposed to hit the print screen key and search for the screenshot inside the images folder, why not to do what windows do? or even better with xfce4-screenshooter you hit the print screen key and you are shown a menu that lets you decide what and how you want to screenshoot.

install xfce4-screenshooter (screenshot tool)
post install:
edit: /etc/xdg/openbox/lxde-pi-rc.xml
replace print option

4 - if you are using copy paste often, you would want to have the option to search from a history of copies.

install xfce4-clipman (clipboard tool)
post install:
edit: /etc/xdg/autostart/xfce4-clipman-plugin-autostart.desktop
comment these lines: OnlyShowIn=XFCE and Hidden=true

5 - we need to be able to read a wide range of drivers, specially those well known formats used by well known operating systems.

upgrade ntfs-3g (support for external hard drives)

6 - there are some keyboards with a special key called altGr, which helps you to insert these characters "áÁéÉíÍóÓúÚñÑ" and many others, by pressing altGr combined with other keys, but if the keyboard doesn't have that key it can be emulated using an extra or unused key as a replacement for altGr.

configure altGr and compose keys (so you can type áÁéÉíÍóÓúÚñÑ):
type: raspi-config
go to: localization->keyboard->defaults
->(configure altGr,compose)
->default->finish

7 - there are scenarios where synchronizing the time using the internet is challenging or even impossible, with rdate the time can be synchronized using a windows machine from the same network as time server.

install rdate (get time from a network)
prepare windows service:
go to http://www.unixwiz.net/tools/rfc868time.html
download rfc868time to C:\
install with: rfc868time -install (as admin)
start with: net start rfc868time (as admin)
post install:
create script with: sudo nano synch.sh
point to the windows machine where the service is running:
add this line: sudo rdate -s xxx.xxx.xxx.xxx > /dev/null
add this line: hwclock --systohc > /dev/null
save the file
give execute permission with: sudo chmod +x synch.sh
setup cron job to synchronize every minute with:
crontab -e
then, add: * * * * * . /path/to/script/synch.sh

8 - other tweaks:

go to: https://www.makeuseof.com/tag/raspberry ... ance-tips/

droid15
Posts: 2
Joined: Mon Jul 01, 2019 3:12 pm

Re: some tweaks for raspbian stretch

Thu Jul 04, 2019 5:21 am

A little program to type any character from a simple matrix

I wasn't satisfied with the point #6, it's just not enough, the success of the configuration and use of composed keys depends partially on the physical keyboard, i didn't manage to configure it correctly using a spanish keyboard, any configuration should be possible, but at the end i prefer to have an assortment of special characters displayed on a matrix, just like the format used by Microsoft office, so i started researching how to create a virtual keyboard, or more appropriatelly, a special character writer.
For that matter i created a python program using tkinter as GUI and a library called pynput for keyboard manipulation. In order to set up the application for easy invoke using alt+f2 (a desktop icon can also be created, but i didn't put the time for that), the following steps are required:

Create a folder called special-characters with:
mkdir special-characters

Inside the folder, create a python script called special-characters.py with this code:

Code: Select all

from pynput.keyboard import Key, Controller
import tkinter as tk
import time

keyboard = Controller()

########################################################################
class MyApp(object):
    """"""
 
    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        self.root = parent
        self.root.title("Special Characters")
        self.frame = tk.Frame(parent)
        self.frame.bind("<Enter>", self.onHover)
        self.frame.pack()
 
        btn01 = tk.Button(self.frame, text="á", command=lambda: self.printChar('á')).grid(row=0,column=0)
        btn02 = tk.Button(self.frame, text="é", command=lambda: self.printChar('é')).grid(row=0,column=1)
        btn03 = tk.Button(self.frame, text="í", command=lambda: self.printChar('í')).grid(row=0,column=2)
        btn04 = tk.Button(self.frame, text="ó", command=lambda: self.printChar('ó')).grid(row=1,column=0)
        btn05 = tk.Button(self.frame, text="ú", command=lambda: self.printChar('ú')).grid(row=1,column=1)
        btn06 = tk.Button(self.frame, text="ñ", command=lambda: self.printChar('ñ')).grid(row=1,column=2)
        btn07 = tk.Button(self.frame, text="Á", command=lambda: self.printChar('Á')).grid(row=2,column=0)
        btn08 = tk.Button(self.frame, text="É", command=lambda: self.printChar('É')).grid(row=2,column=1)
        btn09 = tk.Button(self.frame, text="Í", command=lambda: self.printChar('Í')).grid(row=2,column=2)
        btn10 = tk.Button(self.frame, text="Ó", command=lambda: self.printChar('Ó')).grid(row=3,column=0)
        btn11 = tk.Button(self.frame, text="Ú", command=lambda: self.printChar('Ú')).grid(row=3,column=1)
        btn12 = tk.Button(self.frame, text="Ñ", command=lambda: self.printChar('Ñ')).grid(row=3,column=2)
        
        btnClose = tk.Button(self.frame, text="Close", command=self.closeWindow).grid(row=4,column=0,columnspan=3,rowspan=1)
 
    #----------------------------------------------------------------------
    
    def onHover(self, event):
        self.root.focus_force()
    
    def printChar(self, character):
        """"""
        self.root.withdraw()
		
        time.sleep(0.1)
        keyboard.press(character)
        keyboard.release(character)
        time.sleep(0.1)
		
        self.root.deiconify()

    def closeWindow(self):
        self.root.destroy()
 
#----------------------------------------------------------------------
if __name__ == "__main__":
    root = tk.Tk()
    root.geometry("300x200")
    root.call('wm', 'attributes', '.', '-topmost', '1')
    app = MyApp(root)
    root.mainloop()
This application shows a matrix of buttons to emulate the typing of special characters. In order to type a character on a previously focused application, this program hides itself, while hidden the character is typed, after typing the character the program shows again, it works like that in order to not have the special character typed while the python program was focused (the other application wouldn't receive the character).

In the same folder, create a shell script called special-characters.sh (i like consistency) with this code:

Code: Select all

#!/bin/sh

cd /opt/special-characters
python3 special-characters.py
Give the shell script execution permissions with:
chmod +x special-characters.sh

move the folder to the /opt directory using root privileges:
sudo cp special-characters /opt/ -r

finally, create a symbolic link to the shell script with this command:
sudo ln -s /opt/special-characters/special-characters.sh /usr/bin/special-characters

if everything worked correctly, the application should start by typing alt+f2, oh, i almost forget that the library pynput must be installed using:
pithon3 -m pip install pynput

to add more characters one can open the python script inside /opt/special-characters.py and add more characters to the matrix of characters, the program can be modified to load the selection of special keys from user files, but that's out of the scope of this thread

wildfire
Posts: 525
Joined: Sat Sep 03, 2016 10:39 am
Location: Dundee, Scotland

Re: some tweaks for raspbian stretch

Thu Jul 04, 2019 11:48 pm

droid15 wrote:
Thu Jul 04, 2019 5:21 am
I wasn't satisfied with the point #6,
TBH, I wasn't satisfied with any of the points, perhaps you should go back to a windows system (and even then many users would know how to do/google what you describe).

The point of your post is (considering we're using buster now)?
E8 85 A2 64 C9 64 81 94 64 81 95 64 89 84 89 96 A3
Still NF Shirls

Return to “Beginners”