Posts Tagged ‘linux’

No Comments

Using an external AOC touchscreen on Ubuntu

Wednesday, March 1st, 2023

TL;DR

Using an external portable AOC 16T2 monitor as a secondary screen works well on a Ubuntu laptop, but it needs a bit of tweaking.

xinput map-to-output 14 HDMI-A-0

Connecting a touchscreen to an Ubuntu Laptop

One of the first things you’ll do when connecting an USB device, getting info about the device. Is it recognized? Issue an lsusb before and after connecting the device and watch the difference. In this case:

Check connected USB-devices in Linux

lsusb
Bus 001 Device 011: ID 1fd2:9004 Melfas LGDisplay Incell Touch

So Ubuntu does recognize the AOC 16T2 monitor as a touch-device.

For that of course an USB-C (3.0) display cable is necessary, touch information is not transferred over an HDMI cable, in that case you’ll need another USB-C cable, a USB-C 2.0 version is sufficiant.

Another check if the screen is recognized as a touchscreen, issue the xinput command, before and after

Check input devices in Linux

xinput
Melfas LGDisplay Incell Touch id=14 [slave pointer (2)]

Check connected screens in Linux

To check screen use xrandr.

xrandr
HDMI-A-0 connected

Using a touchscreen on Ubuntu, and using a touchpad at the same time causes some confusion. At the moment you use the touchscreen your mouse disappears. That does make some sense, otherwise you feel urged to move the mouse, which is of course not needed on a touchscreen.

Tip: enable locate pointer when using touchscreen

Enable the locate pointer settting in the accessibilty settings, helps you to find you’re invisible mouse. Press CTRL and you can find your mouse-position again.

Once you’re used to that, an external touchscreen works rather strange out of the box, when you’re using join display, extended desktop as a default for attaching an external monitor, which is wanted in most cases.

Strange default in Ubuntu using secondary touchscreen.

Visual the desktop is extended, but for touch-input it is not. SO the visual-desktop is different than the (touch) input-desktop. That means when you click on the second monitor, the gesture is interpreted like you touch on the first monitor.

 

 

And I tried but this cannot be solved by changing the order of screens in the display-setting, moving the external monitor to the left.

To get it working you’ll need to issue a command in the terminal.

Making a external touchscreen working in Ubuntu

To map the touch.input-desktop to the visual-desktop:

xinput map-to-output 14 HDMI-A-0

This will map the touch-desktop to the secondary AOC touchscreen.

You do wonder why this is not the default in Ubuntu. I’m not sure, maybe it was in earlier days.

But this is not working in Wayland

And there is a bigger problem. This solution works only in X11 window server, not in the new Wayland environment, which is the default nowadays in nearly all modern Linux desktop, including Ubuntu 22.04 LTS.

As it seems xinput does not find your touchscreen annymore, so no mapping can be done.

Wayland does recognize the touchscreen, there is no option yet to map  it to the right screen.

That is plain stupid a pity.

So that means you have to logout/login and switch to X11 to use your external touchscreen.

Hopefully this will fixed soon.

No Comments

Trouble updating some packages in Ubuntu 22.04, because they are kept back

Tuesday, January 17th, 2023

Maybe you have seen this message more often then before, while updating your computer manually through the terminal:

The following packages have been kept back:
<package-name>
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Historically that could be the case with the classic commands

sudo apt update && sudo apt upgrade

Because that command is careful (doesn’t update) about packages that can introduce dependency conflicts

But that update command has been superseded by

sudo apt update && sudo apt full-upgrade -y

The latter commands also remove packages to resolve dependency conflicts, and in most cases that is everything you want.

But now upgraded to Ubuntu 22.04 I see the kept back message more and more, even when I did a sudo apt update && sudo apt full-upgrade -y

And as it seems, that is absolutely OK, it’s part of the new phased roll-out mechanism. Packages that can break things are introduced in batches. First only a small percentage of users are getting the new version, so if there are bugs, only a small number of people are hit, and the bugs can be fixed before it is introduced on a bigger scale.

How to check if packages are `phased`

apt-cache policy <package-name>

e.g. gnome-remote-desktop

apt-cache policy gnome-remote-desktop 
gnome-remote-desktop:
Installed: 42.4-0ubuntu1
Candidate: 42.7-0ubuntu1
Version table:
42.7-0ubuntu1 500 (phased 0%)
500 http://nl.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
*** 42.4-0ubuntu1 100
100 /var/lib/dpkg/status
42.0-4ubuntu1 500
500 http://nl.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Just be a little patient. The update will normally come in a few days.

1 Comment

Find the total size of certain files within a directory tree before deleting them

Friday, January 13th, 2023

Normally I use find, as it is installed by default on any Linux computer or server or terminal I worked with, but lately on my desktop I start using `fdfind` more and more.

Why? Its faster and easier to work with than find.

I really like the user-friendly syntax of `fd` AKA `fd-find` or `fdfind` compared to the classic `find` command.

In Ubuntu the program is installed with `sudo apt install fd-find` and executed as `fdfind`

`fd` uses a regex as the standard search pattern.

Time for some examples.

To find all files in a directory tree that have jpg in their name

Very intuitive and concise.

fdfind jpg

To find all jpg files (extension jpg) in a directory tree

Think I need all files with [e]xtension jpg, the command is again very intuitive:

fdfind -e jpg

To delete all jpg files in a directory tree

Think I need all files with [e]xtension jpg then e[x]ecute a command to delete them [rm], the command is very intuitive:

As the normal delete command in bash is `rm`

fdfind -e jpg -x rm

That’s all.

Another interesting thing to know, what disk-space I’m gonna win by deleting all jpg files.

Find the total size of jpg files within a directory tree (wrongly)

Think: I need all files, and then calculate the filespace of all files.

The normal command of getting a total size of several files is use `du -ch *.jpg` This will list of files and Count a total on the last line. To get just the last line. pipe it to tail, to gets just the last line.

du -ch *.jpg |  tail -1

But du doesn’t work recursive in subdirectory. You can use a trick with globstar, but much easier is it to combine with fd, so you would come to something like this.

fdfind -e jpg -x du -ch | tail -1

But that doesn’t work right, it seems to computes totals for every file, and just show to size of the last result.

Find the total size of jpg files within a directory tree (correctly)

We need the `-X` option here the `execute-batch` command, that runs the command only once on all search results as arguments

fdfind -e jpg -X du -ch | tail -1

Find correctly find the total size of jpg files in a directory and the first level of subdirectories

And with `fdfind` command it’s easy to control Depth, just add a -d option. This will only search in the main and the first subdirectory level.

fdfind -d 2 -e jpg -X du -ch | tail -1

And now you ask yourself. Can I find the size of all jpg files in the third level of subdirectories.

Of course! And easier than you think

Find the total size of jpg files in the third level of subdirectories depth

fdfind --min-depth 4 --max-depth 4 -e jpg -X du -ch | tail -1

See more:

https://github.com/sharkdp/fd

No Comments

Firefox and Wayland support on Ubuntu snaps and the user-agent

Friday, January 6th, 2023

Ubuntu 22.04 is shipping with Wayland as the default communication protocol for the display server, replacing the old and X11 (X Window System).

Interestingly although Firefox is supporting Wayland natively, the default stable Firefox snap package doesn’t use it. I is still using XWayland as compatibility layer.

How to check if Firefox is using Wayland or X11?

Open:

about:support

and search for `Window protocol`

Window Protocol xwayland

That is intentional, see

https://bugzilla.mozilla.org/show_bug.cgi?id=1631462#c21

So what about Firefox Beta? To install Firefox Beta snap next to Firefox stable, see the earlier blog-post Install seperate Fiefox Beta snap.

Open

about:support

And search for `Window protocol`

Window Protocol wayland

Note the missing X, that means Wayland is used as the communication protocol.

Why doesn’t show Wayland in the User-Agent header of Linux browsers?

To check the the User-Agent in Firefox Beta, navigate to something like a ip-address checker:

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0

Although X11 is not used, it still shows X11. I wonder if that is intentional? Probably that is. User-Agent strings are hampered by historical mistakes, like browser-sniffing.

And setting a detailed User-Agent is also a privacy and security risk. Giving to much and unnecessary information about your system. So it is about limiting exposure to browser-fingerprinting.

Be aware this sucks, once you’re aware there is market-power in user-agents. The major players make the rules of the game.

5 Comments

Connecting to a Raspberry Pi Zero with just an USB cable (I)

Monday, October 2nd, 2017

The goal of this post is to explain how you can power, connect  and share internet with your Raspberry Pi Zero from your laptop with just one USB cable. After you’ve set it up correctly, connect the cable, let the Pi boot,  ssh to your Pi with this simple command ssh pi0 or update your pi with this oneliner ssh pi0 "sudo apt update && sudo apt dist-upgrade -y".Your Raspberry Pi Zero will have internet access over USB with higher speeds than most WIFI connections. (more…)

1 Comment

Installing Gimp 2.8 on Ubuntu 12.04

Thursday, May 31st, 2012

Gimp 2.8 has been released a few weeks after the major major Ubuntu 12.04 LTS update. Unfortunately, because Gimp 2.8 has some nice improvements. Luckily it’s quite easy to install Gimp 2.8 manually with adding a PPA and do an update. There is no need to compile it manually.

The latest update of this PPA also offer new newly compiled plug-ins for Gimp 2.8, which is quite an improvement, because I could install Gimp 2.8 today to over 2.6 without a hassle. Some sites tell you that you need to uninstall anything before or that you will running into problem, An that was true, until a few days.

Just paste this in a terminal:


sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp gimp-plugin-registry

It worked for me with no problem for with Gimp 2.6 install.

What’s new in Gimp 2.8

A fine list is you can find on the Gimp website:

But what I like is a nice and quick feature to create a screenshot from any webpage:

file -> create for webpage -> url

Well, it’s more then a screenshot because it renders the whole page not only what’s visible in the viewport of your browser. Something like the Shutter can do as well.

It did hang though on some sites with flash content.

Other changes include that saving is now only impossible as xcf file, the native Gimp file format. Other formats, like jpeg, or pgn is now called exporting, This isn’t a regression only you need different menu item, and there is a shortcut `export to` for fast exporting.

How to add `save as compressed xcf file`

XCF files are big uncompressed files, saving it as a xcfbz or xcfgz cab save a lot of MB’s but somehow that option is missing from the new 2.8 install. Luckily it’s not so difficult to get it back, just install the file-compressor plug-in manually., by taking it from an older gimp build.

UPDATE: with the latest ppa update the file-compressor is installed automatically.

How to get the menu back in Gimp under Unity

Gimp does support the global menu for Gnome 3 or Unity, in short this saves worthy space on your screen, but because Gimp uses several floating windows for layers, and the toolbox this isn’t working well, because the toolbox doesn’t have a menu, and the main menu doesn’t show when the toolbox window is selected. Also that can be cured easily, just enable the window menu again in the picture window.

That can be done by adding this environment variable to the command to run Gimp:

APPMENU_DISPLAY_BOTH=1

The best way to do that:

Copy the gimp.desktop  file from /usr/share/applications/gimp.desktop to ~/home/.local/share /applications and change the line with

Exec=gimp-2.8 %U

to

Exec=env APPMENU_DISPLAY_BOTH=1 gimp-2.8 %U

and drag the gimp.desktop file from the ~/home/.local/share/applications folder to your launcher.

That will create a new launcher that will start Gimp with a menu in the image window. So you can use that menu, and the global menu.

To be honest, I had to get used to Unity/ the dash / global menu / Hud, but now I’m used to it and and start missing it on other Ubuntu machines

No Gimp image showing in the launcher

The gimp.svg icon is missing in /usr/share/icons/hicolor/scalable/apps .

Just download it from here by:

wget http://upload.wikimedia.org/wikipedia/commons/0/05/GIMP_Icon.svg

and rename and  copy it to the usr/share/icons/hicolor/scalable/apps folder. You need root access for that.

Then change the line that start with Icon in the desktop file to this:

Icon=/usr/share/icons/hicolor/scalable/apps/gimp.svg

Gimp not showing in the dash

Somehow the dash is not showing Gimp, anymore but it’s offering it for download. CLicking it will open Ubuntu Store, and that will tell you Gimp is already installed. Well, that’s because Gimp is not called Gimp but the GNU Image Manipulation Program in the desktop file. Now you know why Gimp is called Gimp.

So change the line that start with name in the gimp.desktop file to this:


Name=Gimp

Then log out, or reboot.