SIDEBAR
»
S
I
D
E
B
A
R
«
GNOME Shell: convenient audio output chooser
Aug 28th, 2023 by miki

GNOME has a long standing UX issue regarding choosing the audio output device when multiple audio devices (usually PulseAudio ALSA sinks) are available. In the default GNOME desktop (until v43) the user needs to navigate all the way to Settings->Sound and fiddle with drop-down dialogues to make this choice.

Some options to make this more convenient are available.

1) On GNOME 43+: Use Quick Settings

GNOME 43 adds a new Quick Settings feature which allows, amongst others, the audio device to be chosen directly from the “top bar”‘s “system menu” UI in the upper right corner.

The exact appearance and features exposed in the Quick Settings can be modified by installing the “Quick Setting Tweaker” GNOME Shell extension (GPL-3.0/MIT license).

GNOME 43 is present in Debian based distributions since Debian 12 (bookwoorm, 2023-07) & Ubuntu 23.04 (lunar). Note that after v3.38 a new GNOME versioning scheme was introduced meaning that the following release became v40.

2) Pre GNOME 43: Use GNOME Shell extensions

Option #1: Volume Mixer (I prefer UI of this)

The Volume Mixer GNOME Shell extension (GPL-2.0 license) makes the sound output selection available from the top bar’s system menu in a nice an uncluttered way, hiding unnecessary distractions (fx. no input selection when no application is recording).

Volume Mixer when choosing output device

Option #2: Sound Input & Output Device Chooser

Similarly the Sound Input & Output Device Chooser GNOME Shell extension (GPL-3.0 license) also makes the selection available in the system menu. However, the UI is slightly more convoluted with the width of the dialogue expanding dynamically making the UX a bit unintuitive and jumpy.

Sound Input & Output Device Chooser when choosing output device (input device selection visible below)

3) Non-GNOME: Use Ubuntu AppIndicator

If you use multiple desktops or just prefer a non-GNOME specific solution another way is to install the Ubuntu AppIndicator compatible “Sound Switcher Indicator” (GPL-3.0 license) in combination with the GNOME Shell extension “AppIndicator and KStatusNotifierItem Support” (GPL-2.0 license), which will make Ubuntu AppIndicators appear as tray icons in the GNOME top bar.

The support and non-support of tray icons, requiring the use of extensions like the above, has been a long standing discussion in the GNOME community since the GNOME3 redesign work decided that no existing systray/indicator/status icon protocol was adequate for the GNOME UI requirement.

Curiously the Ubuntu AppIndicator standard is a remnant of Canonical’s attempted desktop/mobile convergence environment Ubuntu Unity (distributed in parallel on mobile OS Ubuntu Touch and standard Ubuntu desksop). This has now been abandoned by Canonical/Ubuntu but still lives somewhat on in the community; see ubuntu-touch.io & ubuntuunity.org.

EDIT 2023-09-20: add screenshots minor text corrections

GitHub to be trusted their own SSH host key?
Jun 11th, 2023 by miki

A May 24th 2023 change of GitHub’s RSA SSH host key just hit me on an older, less used, system doing a git clone. The change was prompted by an unintended exposure of the private part of the host key by GitHub itself.

GitHub.com’s RSA SSH private key was briefly exposed in a public GitHub repository

Github blog-post, “We updated our RSA SSH host key”, 2023-03-23

I’m getting even more reluctant to trust a large organization where such a thing can happen. Additionally they didn’t communicate about this in a way that caught my attention. And now that it has my attention, they do not want to share the specifics about the incident to enable assessment of impact (like exposure duration, popularity of repository etc).

Below is the manual recovery with explanations of what happens and why. I don’t like the way the official blog-post instructs users to retrieving the validated host key in a non-visible way, without human eye balls doing the validation. This is the only chance in the process for injecting human trust into the validation of the host key, don’t skip it!

Consequence #1: fatal MitM warning
When an SSH server’s host key is different to a connecting client (system) compared to what the system has previously seen and acknowledged by the user to be a valid key from the intended counterpart (you do check those host key fingerprint strings, right? If not; PHComp help, WinSCP help), it obviously should and do warn the user about this. Whether the change is of malicious origin or not, is up to the user to investigate. So with OpenSSH this happens;

$ git clone git@github.com:mikini/name-suggestion-index
Cloning into 'name-suggestion-index'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in <~>/.ssh/known_hosts to get rid of this message.
Offending RSA key in <~>/.ssh/known_hosts:17
  remove with:
  ssh-keygen -f "<~>/.ssh/known_hosts" -R "github.com"
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ 

Remedy #1: remove known host keys for domain (pr. OpenSSH instruction)
Remove host keys associated with github.com domain using -R option to ssh-keygen (default for -f is the UserKnownHostsFile config keyword with default ~/.ssh/known_hosts, so no need to specify that):

$ ssh-keygen -R github.com
# Host github.com found: line 17
# Host github.com found: line 18
# Host github.com found: line 19
<~>/.ssh/known_hosts updated.
Original contents retained as <~>/.ssh/known_hosts.old
$

Consequence #2: non-fatal domain and IP mismatch
Now, because host key references are cached for both the domain and IP there are still mismatches caused by the key exchange choosing ECDSA host key and the key associated with the IP address is the old RSA key. This is prompted during each connection attempt:

$ git clone git@github.com:mikini/name-suggestion-index
Cloning into 'name-suggestion-index'...
Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '140.82.121.3'
Offending key for IP in <~>/.ssh/known_hosts:63
Matching host key in <~>/.ssh/known_hosts:72
Are you sure you want to continue connecting (yes/no)? yes
remote: Enumerating objects: 153255, done.
remote: Counting objects: 100% (177/177), done.
remote: Compressing objects: 100% (103/103), done.
remote: Total 153255 (delta 103), reused 121 (delta 74), pack-reused 153078
Receiving objects: 100% (153255/153255), 550.17 MiB | 2.39 MiB/s, done.
Resolving deltas: 100% (111423/111423), done.
$

Remedy #2: remove known host keys for IPs
To get rid of the mismatch warning, the known host keys associated with IP addresses needs to be removed also. Potentially any of the listed endpoint IP addresses used with an RSA host key on the system earlier will now conflict with the ECDSA from server, requiring removal:

$ ssh-keygen -R 140.82.121.3
# Host 140.82.121.3 found: line 63
<~>/.ssh/known_hosts updated.
Original contents retained as <~>/.ssh/known_hosts.old
$

$ ssh-keygen -R 140.82.121.4
# Host 140.82.121.4 found: line 161
<~>/.ssh/known_hosts updated.
Original contents retained as <~>/.ssh/known_hosts.old
$

After remedy
Now, the SSH client will see an unknown host key and prompt for validation. Be sure to verify the presented host key with the officially communicated one (from doc. article or API):
$ git clone git@github.com:mikini/name-suggestion-index
Cloning into 'name-suggestion-index'...
The authenticity of host 'github.com (140.82.121.4)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,140.82.121.4' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 153152, done.
remote: Counting objects: 100% (183/183), done.
remote: Compressing objects: 100% (83/83), done.
Receiving objects: 100% (153152/153152), 550.22 MiB | 1.42 MiB/s, done.
remote: Total 153152 (delta 109), reused 158 (delta 100), pack-reused 152969
Resolving deltas: 100% (111352/111352), done.
$ 
Old WordPress on PHP 8+: Faking get_magic_quotes_gpc() and fixing arrays
Apr 13th, 2023 by miki

If you end up in a situation where your PHP installation gets ahead of your application (like fx. if your hosting provider deprecates PHP 7.4 without you having had the opportunity to update your WordPress 4.9.22 blog), here is a small tip if this results in errors related to the, in PHP 8 removed, function get_magic_quotes_gpc() (see PHP RFC from 2018 about this decision).

As this function has been a dummy function returning false since PHP 5.4 (see php-src commit removing the functionality) and emitting a deprecation warning since PHP 7.4 (see php-src commit deprecating function) in almost any case perceivable you would be able to fake this function and satisfy your application’s need for it to exist.

To fix this for WordPress add the following line to the wp-includes/load.php file (fx. at line 7 for v4.9.22);

function get_magic_quotes_gpc() {return false;}

And voila! WordPress will be functional again (please consider using the chance to upgrade).

Unless, of course, there are other problems related to the PHP upgrade…

This could fx. be ancient themes (like Ahimsa) that use deprecated associative array notation (unquoted string literal indexes). These needs fixing first by adding quotes to all of the indexing strings in sub-arrays of the $skin_fields array, like below;

$skin_fields =
array
(
    array
    (
        "name"    => "skinpagebgtopbg",
        "desc"    => "Page Background Top",
        "csssel"  => "#bgtop",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinpagediv",
        "desc"    => "Page Background Divider Colour",
        "csssel"  => "#bgtop",
        "attr"    => "border-bottom-color"
    ),
    array
    (
        "name"    => "skinpagebgbotbg",
        "desc"    => "Page Background Bottom",
        "csssel"  => "BODY",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinhyperlinks",
        "desc"    => "Hyperlinks",
        "csssel"  => "A",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincapsulebg",
        "desc"    => "Default Bubble Background",
        "csssel"  => ".capsule",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincapsulefg",
        "desc"    => "Default Bubble Text Colour",
        "csssel"  => ".capsule",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinheaderbg",
        "desc"    => "Header Background",
        "csssel"  => "#header",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinheaderfg",
        "desc"    => "Header Text Colour",
        "csssel"  => "#header, #header table, #header a",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinheadersepcolour",
        "desc"    => "Colour of Separator Bar in Header",
        "csssel"  => "#title",
        "attr"    => "border-right-color"
    ),
    array
    (
        "name"    => "skinsidebarbg",
        "desc"    => "Sidebar Background",
        "csssel"  => ".sidebar, .tdsidebar",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinsbwidgetbg",
        "desc"    => "Sidebar Widgets Background",
        "csssel"  => ".sidebarlist",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinsbwidgetfg",
        "desc"    => "Sidebar Widgets Text Colour",
        "csssel"  => ".sidebarlist",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinsblegendbg",
        "desc"    => "Sidebar Widget Title Background",
        "csssel"  => ".sidebarlist > legend",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinsblegendfg",
        "desc"    => "Sidebar Widget Title Text Colour",
        "csssel"  => ".sidebarlist > legend",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinsblistdiv",
        "desc"    => "Sidebar/Action Lists Divider Colour",
        "csssel"  => ".sidebarlist li, #postaction li",
        "attr"    => "border-top-color"
    ),
    array
    (
        "name"    => "skinsblink",
        "desc"    => "Sidebar Widget Hyperlinks",
        "csssel"  => ".sidebarlist a",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincalcaption",
        "desc"    => "Sidebar Calendar Caption Colour",
        "csssel"  => "#wp-calendar caption",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincalheaderbg",
        "desc"    => "Sidebar Calendar Column Header Background",
        "csssel"  => "#wp-calendar thead th, #wp-calendar tfoot td.pad",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincalheaderfg",
        "desc"    => "Sidebar Calendar Column Header Text Colour",
        "csssel"  => "#wp-calendar thead th",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincalcellfg",
        "desc"    => "Sidebar Calendar Entries Text Colour",
        "csssel"  => "#wp-calendar tbody td",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincalnpbg",
        "desc"    => "Sidebar Calendar Next/Prev Links Background",
        "csssel"  => "#wp-calendar #next, #wp-calendar #prev",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincalnpfg",
        "desc"    => "Sidebar Calendar Next/Prev Links Text Colour",
        "csssel"  => "#wp-calendar #next, #wp-calendar #prev, #wp-calendar tfoot a",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skintextwdgtfg",
        "desc"    => "Sidebar Text Widget Text Colour",
        "csssel"  => ".textwidget",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincontentbg",
        "desc"    => "Main Content Background",
        "csssel"  => "#content",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinpostpagebg",
        "desc"    => "Post or Page Entry Background",
        "csssel"  => ".post > fieldset",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinpostpagefg",
        "desc"    => "Post or Page Entry Text Colour",
        "csssel"  => ".entry",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinpptitlebg",
        "desc"    => "Post, Page, Comments Title Background",
        "csssel"  => ".post .title, #comments > legend, .comment > legend, #responsebox > legend",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinpptitlefg",
        "desc"    => "Post, Page, Comments Title Text Colour",
        "csssel"  => ".post .title, .post .title a, " .
                    "#comments > legend, .comment > legend, #responsebox > legend",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinmetabarbg",
        "desc"    => "Post/Page/Comment Bottom Bar Background",
        "csssel"  => ".postmetadata",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincattagbg",
        "desc"    => "Category/Tag Lists Background",
        "csssel"  => ".postcattags",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincattagfg",
        "desc"    => "Category/Tag Lists Text/Link Colour",
        "csssel"  => ".postcattags, .postcattags a",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skin1cattagbubblebg",
        "desc"    => "Single Post Cat/Tag Bubble Background",
        "csssel"  => "#single .postcattags .capsule",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skin1cattagbubblefg",
        "desc"    => "Single Post Cat/Tag Bubble Text/Link Colour",
        "csssel"  => "#single .postcattags .capsule, #single .postcattags .capsule a",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinbqbg",
        "desc"    => "Blockquote Background",
        "csssel"  => "blockquote",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinbqfg",
        "desc"    => "Blockquote Text Colour",
        "csssel"  => "blockquote",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinlistbg",
        "desc"    => "Page/Post Ordered/Unordered List Background",
        "csssel"  => ".entry UL, .entry OL",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinlistfg",
        "desc"    => "Page/Post Ordered/Unordered Text Colour",
        "csssel"  => ".entry UL, .entry OL",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinpost1stletterfg",
        "desc"    => "Post First Letter Colour",
        "csssel"  => ".entry > P:first-child:first-letter",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinactionbg",
        "desc"    => "Action Bubbles (Edit, Reply, etc) Background",
        "csssel"  => ".actbubble",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skinactionfg",
        "desc"    => "Action Bubbles (Edit, Reply, etc) Text Colour",
        "csssel"  => ".actbubble, .actbubble a",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skincommentsbg",
        "desc"    => "Comments Block Background",
        "csssel"  => "#comments",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincommentbg",
        "desc"    => "Comment Background",
        "csssel"  => "fieldset.comment, fieldset.comment .commenttext",
        "attr"    => "background-color"
    ),
    array
    (
        "name"    => "skincommentfg",
        "desc"    => "Comment Text Colour",
        "csssel"  => "fieldset.comment .commenttext",
        "attr"    => "color"
    ),
    array
    (
        "name"    => "skinresponsebg",
        "desc"    => "Response Box Background",
        "csssel"  => "#responsebox",
        "attr"    => "background-color"
    )
);
Ubuntu 18.04 Tweaks for a 16.04 User
Jun 24th, 2019 by miki

This post will detail some stuff I’ve done to a plain Ubuntu 18.04 Desktop (bionic) to make me feel a little more at home in the transition from my daily driver for years the 16.04 release using Canoncial’s Unity as the primary desktop interface to the GNOME Shell of 18.04. Canonical abandoned the former after shifting focus from the convergence and personal device market to cloud and IoT in 2017 leaving development of its mobile OS, Ubuntu Touch which Unity is a part of, to the community formed UBports project (Unity8 is now known as Lomiri). I’ve been putting off this transition exactly because I knew it would require me to make some tweaks to my daily routines, but this system is not one I use on a daily basis so it will make the transition a gentle ride.

The intention is to update this as the experience progresses.

EDIT 2021-08-25: clean up and publish dormant draft post

Browsing GNOME Extensions

To be able to install GNOME Extensions directly from a browser while perusing the directory at extensions.gnome.org, add the GNOME Shell Integration extension/add-on to your browser (Firefox add-on, Chrome Web Store), then install the Integration extension in GNOME to communicate with the browser extension:

sudo apt install chrome-gnome-shell

After this you can go to extensions.gnome.org/local/ to see, configure and update installed extensions.

Useful GNOME Extensions

Time Keeping

World/Alarm/Stopwatch/Timer application

GNOME includes a nice Clock application which is available in the package repository but not installed by default;

sudo apt install gnome-clocks

Installing the Alarm Clock extension described above, will also show the application’s alarms in the notification area.

Notification bar

I like both the date and seconds to be displayed in the head of the desktop, so to format the text a couple of extensions are available;

»  Substance:WordPress   »  Style:Ahren Ahimsa
© 2023 Mikkel Kirkgaard Nielsen, contents CC BY-SA 4.0