Ubuntu – remap keys on keyboard

I have apple keyboard and default layout is not good enough. The less and greater character appear on the wrong key, by default there are on the key above left tab key but I need them down on the second key in the second row, just before “y” character.

This change is from the Ubuntu 18.04 version.

Open keyboard definition for my country (si) from the /usr/share/X11/xkb/symbols folder.

sudo gedit /usr/share/X11/xkb/symbols/si

Change the “cedilla , diaeresis” to “less, greater” and re-login.

Original file content:

default  partial alphanumeric_keys
 xkb_symbols "basic" {
 include "rs(latin)" name[Group1]="Slovenian"; key <TLDE> { type[Group1]="TWO_LEVEL", [ cedilla, diaeresis ] };
 };
 partial alphanumeric_keys
 xkb_symbols "us" {
 include "rs(latinyz)" name[Group1]= "Slovenian (US, with Slovenian letters)"; key <TLDE> { type[Group1]="TWO_LEVEL", [ cedilla, diaeresis ] };
 };
 partial alphanumeric_keys
 xkb_symbols "alternatequotes" {
 include "rs(latinalternatequotes)" name[Group1]= "Slovenian (with guillemets)"; key <TLDE> { type[Group1]="TWO_LEVEL", [ cedilla, diaeresis ] };
 };

After the change :

default  partial alphanumeric_keys
 xkb_symbols "basic" {
 include "rs(latin)" name[Group1]="Slovenian"; key <TLDE> { type[Group1]="TWO_LEVEL", [ less, greater ] };
 };
 partial alphanumeric_keys
 xkb_symbols "us" {
 include "rs(latinyz)" name[Group1]= "Slovenian (US, with Slovenian letters)"; key <TLDE> { type[Group1]="TWO_LEVEL", [ less, greater ] };
 };
 partial alphanumeric_keys
 xkb_symbols "alternatequotes" {
 include "rs(latinalternatequotes)" name[Group1]= "Slovenian (with guillemets)"; key <TLDE> { type[Group1]="TWO_LEVEL", [ less, greater ] };
 };

Google Drive sync with Grive2 on Ubuntu

Install Grive2

Detailed instructions here.

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update 
sudo apt-get install grive

The first run to establish a connection and authenticate

mkdir GoogleDrive
cd GoogleDrive

grive -a 

Grive -a will give you url to enable access to google drive, returned private key must be copied back to the terminal.

To sync manually you execute “grive” command in the GoogleDrive folder:

 grive

Enable Grive2 auto syncbetter use without it

By default, this sync process take too much processor strength and make too much network traffic almost all the time or every 3 seconds, even when there are no changes on the google drive and the timer is set to 15 minutes.

Maybe default configuration just isn’t configured optimally or something. Take this into consideration before continue.

GoogleDrive in the systemctl commands is folder in your $HOME.

systemctl --user enable grive-timer@$(systemd-escape GoogleDrive).timer 
 systemctl --user start grive-timer@$(systemd-escape GoogleDrive).timer 
 systemctl --user enable grive-changes@$(systemd-escape GoogleDrive).service 
 systemctl --user start grive-changes@$(systemd-escape GoogleDrive).service

Systemctl commands results:

Created symlink /home/igorb/.config/systemd/user/timers.target.wants/grive-timer@GoogleDrive.timer → /usr/lib/systemd/user/grive-timer@.timer

Change timer to only fire once in 15 minutes:

First stop the timer & service:

systemctl --user stop grive-timer@$(systemd-escape GoogleDrive).timer

systemctl --user stop grive-changes@$(systemd-escape GoogleDrive).service

Edit the timer file:

sudo gedit ~/.config/systemd/user/timers.target.wants/grive-timer@GoogleDrive.timer 

Change the content of the timer setup:

[Unit]
 Description=Google drive sync (fixed intervals)
 [Timer]
 OnCalendar=*:0/15
 OnBootSec=3min
 OnUnitActiveSec=15min
 Unit=grive-timer@%i.service
 [Install]
 WantedBy=timers.target

Run the command to reload timers and then start the timer and service again.

systemctl --user daemon-reload

Set permission for GoogleDrive files

Ifyou have google drive folder on second drive, not exactly on “home” folder, then you need to change permissions for folders and files :

sudo chmod -R a+rwx ./Storage

Setup VSCode for C# development

Ubuntu 18.04 , 19.04

Dotnet Sdk 3.0 release installation

Install it directly from the software repository.

Mono

Remove all versions of mono completely from the system, vscode & omnisharp comes with the mono included, the incorrect version on the system will interfere with the embedded runtime and will not work correctly .

 igorb@desktop:~$ mono --version
 Command 'mono' not found, but can be installed with:
 sudo apt install mono-runtime 

VSCode installation

Download VSCode and install it.

Open downloaded deb file with “Open with software install” and install it.

Hide some folders from file explorer

As explained here just set files to exclude.

Search for “files:exclude” and add bin and obj folder to the list of excluded entities.

**/bin
**/obj

Add to favorites on Ubuntu

This is maybe some odd advice but, when you add Code to favorite applications (to the launcher) you do that from the Show Applications menu !

If you start code from the terminal and mark newly showed icon as “Add to favorites” , the Code somehow doesn’t compile and debug correctly. There is some strange errors after succesfully builded solution…

C# project build errors

In case of errors on build , make sure you have only one dotnet sdk installed on your system (ubuntu).

igorb@desktop:~$ dotnet --list-sdks
3.0.100 [/usr/share/dotnet/sdk]

Omnisharp project build errors

In case of any errors on the project load (OmniSharp log in the output terminal), like :

OmniSharp.MSBuild.ProjectManager        Failed to load project file '/mnt/development/GitHub/Bisaga/About.Application/About.Application.csproj'.

Add build path to the /etc/profile file, do not forget to re-login:

export MSBuildSDKsPath="/usr/share/dotnet/sdk/$(dotnet --version)/Sdks"

Change number of notifying instances

echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Visual Studio Code – Linux installation

Elementary OS – linux distribution

On one of my machines I use ElementaryOS linux. This flavor of linux does not support DEB or RPM packages directly so I will use tar.gz file as installation medium.

Download

Download code***.tar.gz file from https://code.visualstudio.com/Download address. Link to .tar.gz is under the “deb” square.

Install

Open terminal and go to /usr/local directory. Unpack tar.gz file into default folder and create soft-link to code application:

cd /usr/local
sudo tar xvfz ~/Download/code****.tar.gz 
ln -s /usr/local/VSCode-linux-x64/Code /usr/local/bin/code

Update

To update with a new version just download latest version of tar.gz package and unpack it to the same location. It is wise to delete (or rename) original folder first and then unpack new one.

sudo mv VSCode-linux-x64/ VSCode-linux-x64-OLD/
sudo tar xvfz ~/Download/code****.tar.gz 
sudo rm -rf VSCode-linux-x64-OLD/

Run and keep shortcut in the dock

We run code editor with “code” command. With the right click on the running program icon (in the dock), we change settings for “keep in Dock” and the program shortcut will stay in the dock.