Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Installing Google Web Designer on Ubuntu 20.04

Untitled

`GLIBCXX_3.4.29` not found while installing Google Web Designer on Ubuntu 20.04

To fix this, execute the following:

TeaVM maven plugin 0.6.1 : Unexpected error occurred: Unsupported class file major version 62

Untitled

 [ERROR] Failed to execute goal org.teavm:teavm-maven-plugin:0.6.1:compile (web-client)
 on project github-browser: Unexpected error occurred: Unsupported class file major
 version 62 -> [Help 1]

This happens if Maven mistakenly points to java version greater than Java 11. This happens on most of the java versions which are greater than 11 Check java home:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/USERNAME/.maven-bin/apache-maven-3.6.3
Java version: 18.0.1, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-18.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “5.13.0-27-generic”, arch: “amd64”, family: “unix”

Lets downgrade /usr/lib/jvm/jdk-18.0.1 to jdk 11 using Jenv (Java Environment Manager) and still keep both of the jdk 18 and 11.


Managing multiple JVM versions with Jenv:

Jenv can manage multiple Java verions similar to NodeJS verions manager nvm except you have to download each JDK versions yourself and link them with Jenv like:

command. then linked Java verions can be displayed with jenv versions command:

should display:

Now jenv global command should set current Java versions like:

should select Oracle JDK as current Java verion:


Now, to address TeaVMs java verions issues we are going to have both JDK 11 and newer Java verion installed on the system and maintain via Jenv:

Restart terminal again and check installation:

Should display:

Now add JDK 11 into Jenv: To check jdk version run: should display:

Now select Java version to 11:

Check selected java version:

Should display:

Check JAVA_HOME,java and javac version:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/USERNAME/.maven-bin/apache-maven-3.6.3
Java version: 11.0.1, vendor: Oracle Corporation, runtime: /home/USERNAME/jdk-11.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “5.13.0-27-generic”, arch: “amd64”, family: “unix”

Cycling through all terminal windows without a popup on Ubuntu

Untitled

TL;DR    Download: [nexttermwin.sh] [prevtermwin.sh] script ,set custom global hotkey (e.g. F9,F10 )

Now, pressing F10 and F9 should cycle forward and backwards all terminals windows without popup.

Imagine you have many terminal windows open in fullscreen mode. wmctrl tool can navigate to any open window by typing title substring(incase-sensitive) like to focus Chrome window we can simply try:

But even then title substring cant help us and if we have multiple terminal windows open of same directory, we cannot navigate to specific window in it.

ALT+~ can help us here but requires specific application to be selected. Same goes for other applications with multiple windows open.

ALT+ESC does the job for this and cycles through next windows+instantly navigates to target window without a popup, but it draws a distracting rectangle arround the windows and requires holding these keys pressed until target window reached.

ALT+TAB lets you immediately switch to previous window and switch back which is useful feature. But yet it shows you a popup and requires you to browse through all window popup and select target window.

So, for a more faster and focused window switching we can use xdotool. It can focus any and every window of any desktop by window id provided by window manager of desktop environment. The key here in this script is xdotool gets current window id. wmctrl gets all window ids calculates next window id and activates window:

Cycling backwards:

prevtermwin.sh

Cycling through all Windows:

[nexwin.sh] [prevwin.sh]

For navigating through all windows winIds need to be:

Mapping custom global hotkeys to specific script from linux terminal:

Now, pressing F10 and F9 should call ~/nexttermwin.sh and ~/prevtermwin.sh and cycle window forward and backwards.

Adding new SSD and merging into existing logical volume in LVM without restarting Ubuntu 18.04/19.04

Untitled

So, getting newly added SSD simply merge into system and increase logical system storage space can be done configuring LVM on Ubuntu:

Following installing new SSD into laptop, run following command to list:

Should give:



Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Disk model: MTFDDAK128MAM-1J
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf272f09b

Disk /dev/mapper/ubuntu--vg-root: 119.2 GiB, 628344487936 bytes, 1227235328 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SanDisk SD6SB2M-
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcbfa1baf

So, I have one 128GB SSD (/dev/sda) and a newly added 512GB SSD(/dev/sdc) in my system.

Lets merge new SSD drive /dev/sdc into logical volume group ubuntu–vg-root which should merge new SSD and increase combined storage size in LVM by 512MB and should display one single logical drive increased volume size by new solid state drives size:

Following executing above should give one single increased merged logical volume. Verify by running:

which should now give:


...
Disk /dev/mapper/ubuntu--vg-root: 585.2 GiB, 628344487936 bytes, 1227235328 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
...

which indicates our overall system storage size of root volume group ubuntu–vg-root size has been increased by newly added SSDs size (512MB).

Configuring Keynav Tool for double click, right click and record-replay

TL;DR    Download & run this script.sh and setup following key binding for keynav:

I = double click, O = right click, RETURN = click

keynav is a tool that control's mouse with keyboard superfast. It lets immediate pointer navigation to specific portion of screen, it also lets store specific point on screen and load that pointer location later (similar to vims record/replay) which is handy in some cases when you are needed to click on same area of screen frequently.

Here is a quote from keynav's site (semicomplete.com/projects/keynav):

keynav - retire your mouse.
It lets you move the pointer quickly to most points on the screen with only a few key strokes.

It lets mouse pointer reach any and every corner of screen with few keystrokes. Each key stroke devides the screen into 1/4 and lets pick any of 4 portion of screen with HJKL which is similar to vim's key binding.

kenav screenshot

In this image, one of desktop item is selected with key sequence L L L K

Common Keys:

CTRL+; = bring up Keynav Navigator
ESC = exit
; = cause mousemove event at particular cursor position without clicking
qa = save mouse pointer location on screen for buffer 'a'
@a = go to previously saved pointer position on screen into 'a' buffer
h,j,k,l = basic navigation

Enabling double-click & right-click:

The default configuration do not come with some key actions like right click and double click. So you can enable them by adding following lines:

i warp,doubleclick 1,end
o warp,click 3,end

Add them into keynav config file ~/.keynavrc.

Give a read to this detailed documentaion for adding more actions like drag, drop, mousemove, middle click and more.

Whole config:

~/.keynavrc:

ctrl+semicolon start
Escape end
ctrl+bracketleft end
h cut-left
j cut-down
k cut-up
l cut-right
y cut-left,cut-up
u cut-right,cut-up
b cut-left,cut-down
n cut-right,cut-down
shift+h move-left
shift+j move-down
shift+k move-up
shift+l move-right
shift+y move-left,move-up
shift+u move-right,move-up
shift+b move-left,move-down
shift+n move-right,move-down
space warp,click 1,end
semicolon warp,end
1 click 1
2 click 2
3 click 3

# Zoom to the current window
w windowzoom

# Zoom to the cursor location with a given height and width
c cursorzoom 200 200

# Handy for holding ctrl while using keynav:
ctrl+h cut-left
ctrl+j cut-down
ctrl+k cut-up
ctrl+l cut-right
ctrl+y cut-left,cut-up
ctrl+u cut-right,cut-up
ctrl+b cut-left,cut-down
ctrl+n cut-right,cut-down

# Arrow keys can move the grid as welll
Left cut-left
Down cut-down
Up cut-up
Right cut-right
shift+Left move-left
shift+Down move-down
shift+Up move-up
shift+Right move-right
ctrl+Left cut-left
ctrl+Down cut-down
ctrl+Up cut-up
ctrl+Right cut-right
ctrl+shift+Left move-left
ctrl+shift+Down move-down
ctrl+shift+Up move-up
ctrl+shift+Right move-right

# Record keynav actions
q record
# e.g. start recording by pressing 'qa'. Following 
# move actions completed, press 'q'. It should save 
# these actions for key 'a' and pressing 'a' should replay them.  

shift+at playback

### Example using the 'sh' command.
# Make firefox the active window
f sh "xdotool windowactivate $(xdotool search -title -- '- Mozilla Firefox')", end
# Make a new tab in google chrome:
t sh "xdotool windowactivate $(xdotool search --title -- '- Google Chrome' | head -1); xdotool key ctrl+t",end
# Paste
v sh "xdotool key shift+Insert"

### Drag examples
# Start drag holding the left mouse button
#q drag 1
# Start drag holding middle mouse + control and shift
#w drag 2 ctrl+shift
# Dragging with modifiers
#q drag 1
#ctrl+q drag 1 ctrl
#shift+q drag 1 shift
#shift+ctrl+q drag 1 shift+ctrl

### History
a history-back

### Example of cut and move without the default values
#h cut-left .75
#j cut-down .75
#k cut-up .75
#l cut-right .75
#shift+h move-left .50
#shift+j move-down .50
#shift+k move-up .50
#shift+l move-right .50

### Example using a 2-row, 3-column grid, 
# mapped to Insert/Home/PageUp/etc...
#6 grid 2x3
#Insert cell-select 1x1
#Home cell-select 1x2
#Prior cell-select 1x3   # PageUp
#Delete cell-select 2x1
#End cell-select 2x2
#Next cell-select 2x3   # PageDown

### Example using a 3x3 grid with nethack-vi keys
#ctrl+semicolon start, grid 3x3
#h cell-select 1x2      # left
#j cell-select 2x3      # down
#k cell-select 2x1      # up
#l cell-select 3x2      # right
#y cell-select 1x1      # up-left
#u cell-select 3x1      # up-right
#b cell-select 1x3      # down-left
#n cell-select 3x3      # down-right
#period cell-select 2x2 # center

i warp,doubleclick 1,end
o warp,click 3,end

References:

http://manpages.ubuntu.com/manpages/artful/man1/keynav.1.html https://github.com/jordansissel/keynav/blob/master/keynav.pod