Skip to content

Instantly share code, notes, and snippets.

@ingramchen
Last active March 23, 2024 12:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ingramchen/7ea16b254ecb0ae1656f9b1d60131307 to your computer and use it in GitHub Desktop.
Save ingramchen/7ea16b254ecb0ae1656f9b1d60131307 to your computer and use it in GitHub Desktop.
Linux tweak memo

Environment

  • Nobara (Fedora 39~)

Chrome

  • download rpm to install
  • force to sRGB profile (particulary in wayland)
    • chrome://flags/#force-color-profile and set to sRGB
  • disable media key controls, this hijack media key in keyboards
    • chrome://flags/#hardware-media-key-handling
  • fix chrome cursor not sync to kde:
mkdir -p ~/.icons/default && \
cat > ~/.icons/default/index.theme << EOF
[icon theme]
Inherits=breeze_cursors
EOF

Chrome wayland

Chrome non-wayland

  • workaround context menu bugs:
    • disable KDE desktop effects -> ShapeCorners and Background Contract

Chrome vulkan

  • chrome://flags/#enable-vulkan enable vulkan if you need.
  • but it may cause screen flickering
  • and cap FPS to 60 in newer chrome version

KDE Tweaks

  • disable middle mouse paste
    • settings -> workspace behavior -> general behavior -> Middle Click: > uncheck
  • change time format
  • turn off some buggy (settings > Workspace behavior > Desktop Effects) which cause random crash on various Apps:
    • turn off Background Contract, Blur, Screen Edge, ShapeCorners
    • minor tweak:
    • turn off morphing popups
    • window open/close animation > fade
    • turn off Fading popups

KDE force window open in primary monitor

* kwin script: https://store.kde.org/p/1617641/
* window rule to skip initial geometry request:
  * https://www.reddit.com/r/kde/comments/gx8dch/comment/ivdhcxr/?utm_source=reddit&utm_medium=web2x&context=3
  * new Window Rules > Substring Math 'steam_app_' > add Ignore requested geometry

KDE6

  • AVIF: sudo dnf install kf6-kimageformats

IDEA shortcut conflicts

  • KDE Show Desktop, Ctrl+F12 should turn off
  • Konsole Ctrl+Alt+T should turn off

Mouse

App

  • Authenticator (flatpak, import txt in secret git)
  • Metronome (flatpak)
  • Fedora media writer - burn iso to usb
  • Timeshift - backup
  • qBittorrent (flatpak)
  • YACReader (flatpak)
  • Flatseal
    • QT font scale ENV in global: QT_SCALE_FACTOR=1.7
  • sudo dnf install s3cmd git wget jq rclone
  • official docker: https://docs.docker.com/engine/security/rootless/

fcitx 5

sudo dnf install fcitx5 fcitx5-chinese-addons fcitx5-chewing fcitx5-table-extra fcitx5-qt-qt5gui fcitx5-configtool
echo "export XMODIFIERS=@im=fcitx" > `.config/plasma-workspace/env/fcitx5.sh`
  • Settings >> virtual keyboard >> select fcitx5
  • open fcitx5 setting and add boshamy and chewing
  • change hot key to super_L + space

Fonts

  • jetbrains-mono-fonts for terminal
sudo dnf install jetbrains-mono-fonts
  • Remove google-droid-sans CJK fonts to prefer noto fonts (because we use locale english, noto cjk won't be first)
sudo rm 69-google-droid-sans-fallback-fonts.conf
sudo rm 69-google-droid-sans-japanese-fonts.conf
sudo fc-cache -f -v  ## app need to reopen

ptt chrome

  • install font first.
  • font config: SymMingLiu,'Noto Serif CJK TC',MingLiu,monospace

configuration restore

  • .local/share/
    • rhythmbox, qBittorrent...etc
  • .config/
    • input-remapper

locale

  • change time locale in shell prompt to english
 localectl set-locale LC_TIME=en_US.UTF-8

pipewire hires

## add config

mkdir -p ~/.config/pipewire/pipewire.conf.d && \
cat > ~/.config/pipewire/pipewire.conf.d/hires.conf << EOF
context.properties = {
  default.clock.rate          = 96000
  default.clock.allowed-rates = [ 44100 48000 96000 192000 ] 
}
EOF

## restart (no sudo!)
systemctl --user restart wireplumber pipewire pipewire-pulse

virt-manager

  • install
sudo dnf install virt-manager

## logout and login to make group work
  • import /mnt/2t/libvirt-pool/*.qcow2 file as exist image

    • maly require setup file system host-develop to /home/ingram/develop, otherwise it won't boot
  • autostart vm

~/bin/vmctl list          # get domain name from vm
sudo virsh autostart maly # set id to autostart

Color

  • DisplayCal 3
flatpak remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak install net.displaycal.DisplayCAL

Environment

  • Nobara (Fedora 37~)

Gnome Tweaks

  • disable middle mouse paste
  • change time format

Gnome shell extensions

  • Dash to Panel
  • Gsconnect - for android control for gnome

IBus Boshiamy

  • sudo dnf install ibus-table
  • https://github.com/jdh8/ibus-boshiamy
  • make; sudo make install
  • reboot, Settings -> Region & Language -> Input Sources -> + -> Chinese -> add Chinese(Boshiamy)

IBus 新酷音

sudo dns install ibus-chewing
  • reboot, Settings -> Region & Language -> Input Sources -> + -> Chinese -> add Chinese(chewing)

Fonts

  • noto cjk fonts
sudo dnf install google-noto-serif-cjk-vf-fonts
sudo dnf install google-noto-sans-mono-vf-fonts

## for sans family, do not install `-vf-` fonts (variable fonts)
## it does not support Steam
sudo dnf install google-noto-sans-cjk-fonts

Environment

  • Ubuntu 20.04
  • AMD CPU/GPU

Gnome shell extensions

  • sudo apt install gnome-shell-extensions

  • TODO install more extension and chrome extension

    • Dash to Panel
    • Compiz alike windows effect - for wobbly window
    • Gsconnect - for android control for gnome
    • Panel date format - for week display in panel
      • dconf write /org/gnome/shell/extensions/panel-date-format/format "'%Y-%m-%d'"
  • Gnome Shell dark mode

IBus Boshiamy

Mouse tweak

Toggle gnome overview (expose) by mouse middle click

  • gnome-tweaks -> Keyboard & Mouse -> Mouse -> Middle Click Pasted -> turn off
  • cli to toogle gnome shell overview:
dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'

Mouse Driver

  • bluetooth mouse just trash, lag like hell
  • Logitech Unifying Receiver for rescure
    • install solaar from ppa for version >= 1.0.3 for support MX Anywhere 3

Hotkeys tweak

  • replace <Super> with <Alt>-f

    • gnome-tweaks -> Windows -> Titlebar Actions -> Window Action Key -> select Disabled
    • Settings -> Keyboard Shortcuts -> Search -> set to Alt+F

Command line 2 step authorization

if ! [ -x "$(command -v pbcopy)" ]; then
  alias pbcopy='xsel --clipboard --input'
  alias pbpaste='xsel --clipboard --output'
fi

Time machine

  • cronopete

Development

  • Vagrant should directly download from HashiCorp .deb, not from apt

Color Emoji

Corsair H100i Platinum AIO

AMD X570 motherboard fan/temperature

  • install lm-sensors
sudo apt install lm-sensors
sudo sensors-detect
## at last step, confirm YES to add nct6775 to /etc/modules
  • configure grub for kernel parameters
    • at /etc/default/grub, add acpi_enforce_resources=lax
    • then sudo update-grub
GRUB_CMDLINE_LINUX_DEFAULT="splash quiet acpi_enforce_resources=lax"

fancontrol

  • make case bottom fan correlated to GPU temporature
sudo apt install fancontrol
  • use sudo pwmcontrol to fine tine pwm fan and temporature, below is setup bottom fan to GPU

  • file /etc/fancontrol

# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon2=devices/pci0000:00/0000:00:03.1/0000:0a:00.0/0000:0b:00.0/0000:0c:00.0 hwmon3=devices/platform/nct6775.656
DEVNAME=hwmon2=amdgpu hwmon3=nct6798
FCTEMPS=hwmon3/pwm1=hwmon2/temp2_input
FCFANS= hwmon3/pwm1=hwmon3/fan1_input
MINTEMP=hwmon3/pwm1=50
MAXTEMP=hwmon3/pwm1=80
MINSTART=hwmon3/pwm1=150
MINSTOP=hwmon3/pwm1=100
  • after update you need to run sudo service fancontrol restart

Steam

  • if steam HiDPI have some bug, try edit
# sudo vim /usr/share/applications/steam.desktop
# then add env before steam command
Exec=env GDK_SCALE=2 /usr/games/steam %U

Install latest kernel

related tweak

Environment

  • Ubuntu 22.04

Menu editor

  • sudo apt-get install menulibre
  • steam 3x UI command: /usr/games/steam -forcedesktopscaling=3 %U

Mouse tweak

  • gnome-tweaks -> Windows Titlebars -> Titlebar Actions -> Middle-Click -> select None

Toggle gnome overview (expose) by mouse middle click

sudo apt install xautomation xbindkeys
  • generate rc file:
xbindkeys --defaults > ~/.xbindkeysrc
  • append following to .xbindkeysrc then relogin
#Activities Overview on extra mouse button
"xte 'key Super_L'"
b:2 + release

Thinkpad T14 touch screen

  • to turn off, use command:
xinput disable 10  #10 is touchpad device id
  • you can add command to startup application

  • to find touch screen device id:

xinput list
  • ELAN901C:00 04F3:2EB2 is touch screen
  • note that after OS update, device id may change, so it may disable wrong device, such as touchpad. you have to update startup application's command

Keyboard

  • ibus control+shift+u conflict to IDEA, check answer to disable
  • launch termial control+alt+t conflict to IDEA, go to settings to disable it
Intellij keyboard shortcuts
  • Select Next/Previous Tab: ctrl + up/down # this will override exist shortcuts
  • VCS Operation: alt + v
  • close tab: alt + w # ctrl+f4 too far
  • Generate/New alt + n # alt+insert too far
    • customize: Code > Generate... and Java IDE Customization > New
software remapping caps_lock and return to ctrl
# -*- coding: utf-8 -*-

import re
from xkeysnail.transform import *

define_multipurpose_modmap(
    # Enter is enter when pressed and released. Control when held down.
    # Capslock is capslock when pressed and released. Control when held down.
    {
       Key.ENTER: [Key.ENTER, Key.RIGHT_CTRL],
       Key.CAPSLOCK: [Key.CAPSLOCK, Key.LEFT_CTRL]
    }
)
  • command: sudo xkeysnail config.py --devices 'AT Translated Set 2 keyboard'
  • follow the answer to enable systemd run on startup

Mouse Driver

  • bluetooth mouse just trash, lag like hell
  • Logitech Unifying Receiver for rescure
    • install solaar from ppa for version >= 1.0.3 for support MX Anywhere 3
    • swap smartshift and middle mouse button in solaar

PulseAudio

  • sudo apt install pavucontrol
  • restart pa systemctl --user restart pulseaudio
  • configure sampling rate:
# edit /etc/pulse/daemon.conf


avoid-resampling = true

## default-sample-format = s24le
default-sample-format = float32le

## default-sample-rate = 96000
default-sample-rate = 48000
## alternate-sample-rate = 44100

## resample-method = soxr-vhq
## resample-method = speex-float-3
resample-method = speex-float-5


# then restart pa
  • speex-float-5 is for 96KHz, speex-float-3 is ok for 48KHz

  • debug current pulseaudio stream:

pacmd list-sink-inputs
  • for youtube music (chrome), sample spec is: float32le 2ch 48000Hz, no resample occurred
  • fro steam game, sample spec same as above, but it still do resample
  • for Rhythmbox, sample spec for normal CD: s16le 2ch 44100Hz, which will apply resample to 48000Hz with speex-float-5
    • hi-res CD: s24le 2ch 96000Hz playback will be down sample, although DAC support higher.
  • if you want to hi-res, set default-sample-rate = 96000, but this will cause steam/chrome always up-sample

GPU

  • video hardware decode in Chrome with nvidia
/usr/bin/google-chrome-stable --ignore-gpu-blocklist --disable-features=UseChromeOSDirectVideoDecoder --use-gl=desktop --enable-features=VaapiVideoDecoder %U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment