Fix vlc ui scaling problems

Vlc disable hidpi scaling

tl;dr

Set the environment variables:

export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCREEN_SCALE_FACTORS=1

The story

I am testing Fluxbox on Devuan on a physical system (instead of just a VM) with two monitors. I discovered that on one monitor, the ui for vlc is scaled way wrong.
For my left monitor, the buttons are way larger than they should be.
VLC with large buttons and normal menus
And on the other monitor, the buttons were normal-sized, but the menus and other text widgets were way too small.
VLC with normal buttons and tiny menus
When I set the environment variables as described above, vlc appears in the correct scaling. At one point, I had some OS or DE installed that showed that my system viewed the left monitor (HDMI-connected) as a 7″ screen with 1920×1080 resolution, which is why the scaling on the left side was messed up.
VLC with normal buttons and menus
Not only did I add those variable exports to my ~/.fluxbox/startup file, I also wrote a wrapper for vlc as /usr/local/bin/vlc

#!/bin/sh
QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCREEN_SCALE_FACTORS=1 /usr/bin/vlc

I was not aware that VLC was a QT program. But, after setting some environment variables,

References

Weblinks

  1. How to Enable hiDPI Scaling? – The VideoLAN Forums

Internet searches

  1. vlc disable hidpi scaling
Advertisements

Read Chrome and Firefox history from command line

Chrome

Shamelessly ripped from How do I access Chrome’s history (saved browsing history) file as a readable format without using third-party applications or extensions? – Quora

You will need a sqlite3 binary, probably from the package sqlite, to read the Chrome history file.

Chrome history in Linux is normally stored as file ~/.config/google-chrome/Default/History.

sqlite3 ~/.config/google-chrome/Default/History "select datetime(last_visit_time/1000000-11644473600,'unixepoch'),url from  urls order by last_visit_time asc" > output.txt

Firefox, Palemoon, Waterfox

This one’s in UTC.
Find the relevant history sqlite file.
For palemoon, it is similar to:

~/".moonchild productions/pale moon/1234abdf.default/places.sqlite"
sqlite3 ~/".moonchild productions/pale moon/1234abdf.default/places.sqlite" "select datetime(h.visit_date/1000000,'unixepoch'),p.url from moz_historyvisits as h, moz_places as p where p.id == h.place_id order by h.visit_date asc;"

Ssh use 7z with password and suppress password echo

If you want to use 7z with a password, over ssh, by default the password will be displayed!

Suppress it with ssh -t. I don’t know why. Here’s the relevant section of the man page for ssh.

     -t      Force pseudo-terminal allocation.  This can be used to execute arbitrary screen-based programs on a remote machine, which
             can be very useful, e.g. when implementing menu services.  Multiple -t options force tty allocation, even if ssh has no
             local tty.

Fix Palemoon browser mouse scroll wheel goes through history when using Fluxbox

The solution

In my ~/.fluxbox/startup:

xinput set-button-map "$( xinput | awk -F'[=]' '/ouse/{print $2}' | awk '{print $1}' | head -n1 )" 1 2 3 4 5 6 7 0 0 &

The story

I installed Devuan ceres on a desktop workstation as part of my research into lightweight window managers. I installed my self-rolled dpkg of Palemoon (source on gitlab) because I have been actively reducing my use of upstream Firefox. When I scrolled up with the mouse wheel, the browser jumped back and forth in history. If the current tab in the browser has no previous pages, then the scrolling operates just fine.

Apparently I’m a unicorn. Nobody has had this exact problem in this environment before (Windows users of Firefox changing the about:config don’t count). Relevant xkcds include a tiny bit of xkcd#979 and a healthy dose of xkcd#1495.

I investigated many different methods to try to solve my problem. I tried changing the about:config settings in the browser (specifically mousewheel.default.action and similar) which did not solve my problem.

My next attempt involved file ~/.fluxbox/keys to assign commands to mouse button actions to reduce the effect they have in the window, which failed to suppress the undesirable actions.

I investigated using xbindkeys to control what is sent to the X server when it receives certain inputs. I even tried complicated guile logic, which actually seems quite nifty, but it just didn’t accomplish what I wanted in this case. I found an interesting example (secondary reference 3) where some toggling logic was shared, and I spent a lot of time trying to tinker with that.

I finally found what I was looking for on the Arch Wiki (primary reference 1), go figure. Those Arch folks know how to help a guy no matter the distro! You can use xinput to change what signals are sent to X from the device by remapping the buttons. You can suppress a button with 0.
The wiki helpfully explains how to find which device to modify. And then the series of numbers after that are the button mappings. So the first button, is mapped to the first number, and so on. If a button is mapped to 0, it is effectively ignored.

xinput set-button-map "$( xinput | awk -F'[=]' '/ouse/{print $2}' | awk '{print $1}' | head -n1 )" 1 2 3 4 5 6 7 0 0 &

In my example, I mask buttons 8 and 9. Using xev and xbindkeys -mk I learned that my mouse (a generic HP mouse since I’ve never cared about fancy peripherals) sends button 4 on scrolling up, and then button 8 and button 9 when stopping the scrolling up action. It was the button 8 (and 9) that were causing weird issues with the browser. When I mask the input with xinput as seen here, the scrolling operates completely normally and as expected.

The probable causes

I have been using this mouse with Xfce on Fedora for years, and the scrolling has never been a problem. I suspect my choice of installing all the packages myself on a Devuan netinst contributed to the problem. I had an issue with fonts on xscreensaver which was probably due to my minimal install. Perhaps Fluxbox does not perform some perfunctory task that desktop environments (DEs) do with sanitizing input. I don’t care, because Fluxbox has been quite satisfactory.

And as a side node, I haven’t found a debian-family “minimal” disc that can be used independently of a network, like the CentOS minimal disc image, only a netinst.

References

Primary

  1. Mouse buttons – ArchWiki [wiki.archlinux.org]

Secondary

  1. XBindKeys [nongnu.org]
  2. xbindkeysrc.scm [nongnu.org]
  3. [SOLVED] [xbindkeys] Advanced mouse binds? [linuxquestions.org]
  4. fluxbox-keys(5) Manual Page [fluxbox.org]

Commands/programs

xev – uesful to display info about keys are being pressed

xbindkeys -mk – same

xinput – manipulate mouse button mapping

Files

~/.fluxbox/keys

~/.xbindkeysrc

~/.xbindkeysrc.scm

Firefox disable recommended extensions

Firefox apparently is trying to jump the shark with even more pocket-esque behavior. This is why I install Pale Moon (and its Linux page) on my new builds instead of Firefox.

I normally schedule my posts, in case you couldn’t tell, for the morning of every fourth day. But this post is going out immediately.

Disable Firefox’s “Contextual Feature Recommender” with this entry in prefs.js:

user_pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr", false);

You can extrapolate the about:config option.

Other places on the Internet show you how to do it through the gui if you prefer.

References

My own research (diff prefs.js prefs.js.old)

Fedora and scanners

If you are running Fedora and you want to use a scanner, you probably already have sane (backends at least) and simple-scan installed.

What is incredibly frustrating is when scanimage -L shows you the scanner, but simple-scan does not list it.

What you are missing is

sudo dnf install libnsl

This package is different from libnsl2, which is probably already installed. But some applications must depend on libnsl, including simple-scan. Thanks to suspiciousmilk of Ask Fedora.

References

Weblinks

  1. Brother scanner driver don’t work [ask.fedoraproject.org]