Skip to content

Instantly share code, notes, and snippets.

@alvaro893
Last active February 24, 2024 14:31
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 alvaro893/9b1a8c889ab44d95ddd44bd09d1a182a to your computer and use it in GitHub Desktop.
Save alvaro893/9b1a8c889ab44d95ddd44bd09d1a182a to your computer and use it in GitHub Desktop.
Tips for Ubuntu / Manjaro

Wayland

software that works well in wayland see https://arewewaylandyet.com/

Fix resolution scaling of (some) GTK applications

on KDE select "Scalling themselves" under "X11 legacy applications" on display settings will fix blurring scaling on most of application but some will look strange (small icons and so on), you can fix it by adding

GDK_SCALE=2 GDK_DPI_SCALE=0.5

as envinroment variables to applications that won't scale correctly. orca-scaling Unfortunately it doesn't always work.

Recovering files

  • install testdisk
  • run testdisk in the terminal
  • Select your disk, select Advanced, select undelete
  • follow the instructions on the terminal to select files to undelet them

Tip to filter files

While using TestDisk, Advanced, you can use 'f' to add a filter to the list of files (ie .jpg or .docx). It's possible to use several filters. Use 'r' to reset the filters.

fix zsh issues

add this line to /etc/zsh/zprofile

emulate sh -c 'source /etc/profile'

If there are issues on zsh such as the cursor is misplaced go to Settings->regional settings->formats->Region and set it to 'no change' and also disable 'Detailed Settings' checkbox

fix issues with some apps in KDE

Install an gtk app like gimp so the gtk libraries are installed. This fixes the issue with teensy loader

Make serial ports accessible to current user

sudo usermod -a -G dialout $USER

On Manjaro/Arch

sudo gpasswd -a $USER uucp && sudo gpasswd -a $USER lock

then, log off, an log back on.

Fixing file search on dolphin (KDE file explorer)

See the below note first. Even if seems counterintuitive the best way I find to fix this is to go to settings->Search->File Search and disable File Search altogother. After that search on Dolphin works, but it does not handle wildcards for example '*.png' More info: https://www.reddit.com/r/kde/comments/eyd8cl/why_is_search_in_dolphin_still_useless/

NOTE: it may be better to disable settings->Search->File Search->Also index content. Also it could be good to delete the baloo index on ~/.local/share/baloo/index and restart. Doing this fixes performance issues as well, since baloo is not extracting the content of each file for indexing anymore

Install Radeon drivers (don't, it is better to use the kernel ones)

Steam

  • Activate Proton on steam settings
  • Some games need this launcher flags DXVK_HUD=fps,devinfo PROTON_USE_D9VK=1 %command%;. Note DXVK_HUD=fps,devinfo is just for info. you can remove it.
  • Note that when using proton the game must be installed in ext4 filesystem not ntfs. Not sure why

Installing AUR packages

Using Yay for package management

The yay follows similar (but not identical) command structure as pacman. So it should not be difficult for you to manage AUR packages with Yay.

Search for packages with:

yay search_term

Install the packages with:

yay -S package_name

Remove packages with:

yay -R package_name

To delete a package with its dependencies:

yay -Rns package_name

Upgrading (only) the AUR packages:

yay -Sua

Yay is also capable of upgrading non-AUR packages. The a flag above restricts it to AUR.

Install from AUR manually

Sometimes install from Pamac (GUI to install packages in Manjaro) won't build AUR packages. then you (probably) can still do it with these steps

This is from manjaro forum

Using the gcsf package you tried to install, the steps which Pamac abstracts from you is outlined below

  1. Installing the packages for pulling git repos, compiling binaries, package the application and install it. (one time)

    sudo pacman -Syu git base-devel --needed

  2. Cloning the package build files including the PKGBUILD

    git clone https://aur.archlinux.org/gcsf.git

  3. Building the package installing needed dependencies

    cd gcsf makepkg -s

  4. Installing the package

    sudo pacman -U gcsf-version-pkgrel.pkg.tar.xz

Step 3 and 4 can be combined into one makepkg command but is split to give the an idea of the steps. If you are creating packages by yourself you don't want to install every time you build the package especially if you want to examine the final package to see if files are where they are supposed to be etc.

makepkg -si

Logs

On arch/manjaro

journalctl --since=today

Firefox

Fix FPS in Firefox.

See this link https://wiki.archlinux.org/index.php/Firefox#Configuration go to 'Frame rate' section

Fix 3D rendering

see this link https://wiki.archlinux.org/index.php/Firefox/Tweaks#Enable_OpenGL_compositor Alternatively just use chromium, 3D rendering is way better.

Fix 4K with Wayland

add

export MOZ_ENABLE_WAYLAND=1

to /etc/profile or /etc/zsh/zprofile

Allow 144 Hz in Kde (only X server)

  • Go to display settings, choose Compositor.

  • Set vsync to Never and apply.

  • Open up a terminal or text editor.

  • In both Manjaro and Kubuntu, I placed the following in /etc/X11/xorg.conf.d/20-amdgpu.conf

  • Section "Device" Identifier "AMD" Driver "amdgpu" Option "TearFree" "true" EndSection

  • And again in both, I added these lines under the [Compositing] line in the file ~/.config/kwinrc (Note: They get automatically arranged later)

MaxFPS=144

RefreshRate=144
  • I recommend rebooting, but a logout/login should suffice.

Install Wayland on KDE

With Wayland animations run at 144Hz. Middle button clipboard doesn't work on most applications

  • install plasma-wayland-session
  • reboot and select plasma (wayland) before logging in

fix some applications that need to use X11 features (xwayland)

Apps cannot control mouse position nor share the desktop under pure Wayland. This can be solved using some enviroment variables
run export QT_QPA_PLATFORM=xcb for QT apps or run export GDK_BACKEND=x11 for gnome or just GDK_BACKEND=x11 google-chrome

Security

Change the amount of time to wait after 3 unsuccessful logins

The default time is ridiculus long, it is 600 seconds (10 minutes). You can login as root and modify the number of attemps and the time to wait, use the /etc/security/faillock.conf file.

Fixing Code Oss

Extensions issue

add this to '/usr/lib/code/product.json'

"extensionsGallery": {
    "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
    "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
    "itemUrl": "https://marketplace.visualstudio.com/items"
}

Screenshots on Kde with Flameshost

Install flameshot, delete spectacle follow the tutorial to configure it here https://github.com/flameshot-org/flameshot#on-kde-plasma-desktop Note: the shorcuts wont work in wayland. create a new one with flameshot gui as action and Print key as trigger

Wayland fix

on Wayland last flameshot version v11 does not work properly.

First unistall repository version of flameshot

Then compile the last commit from source

git clone https://github.com/flameshot-org/flameshot
mkdir build && cd build
cmake -S .. -DCMAKE_INSTALL_PREFIX=/usr   -DUSE_WAYLAND_CLIPBOARD=1
make
sudo make install

Note: there is no unistall for this

Google integration on Kde

Google drive access from dolphin or nautilus

from this tutorial https://linuxconfig.org/how-to-use-google-drive-on-linux

  • install kio-package
sudo pacman -S kio-gdrive 
  • Open settings -> online accounts and login in your google account
  • Open dolphin -> remote -> Network -> Google Drive

GPU control on linux

CoreCtr

With this open source software we can control the gpu fan curves and more, it is easy to install in arch/manjaro see more https://gitlab.com/corectrl/corectrl

PDF in Linux

Assembly a PDF from images

To gather scanned images and combined them in one PDF install gscan2pdf graphical tool.

Compressing a PDF

From https://itsfoss.com/compress-pdf-linux/

To compress the PDF install Ghostscript. This is command line tool.

Now that you have made sure that Ghostscript is installed, you can use the following command to reduce the size of your PDF file:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf

In the above command, you should add the correct path of the input and out PDF file.

This is what determines the compression level and thus the quality of your compressed PDF file. dPDFSETTINGS Description /prepress (default) Higher quality output (300 dpi) but bigger size /ebook Medium quality output (150 dpi) with moderate output file size /screen Lower quality output (72 dpi) but smallest possible output file size

Do keep in mind that some PDF files may not be compressed a lot or at all. Applying compression on some PDF files may even produce a file bigger than the original. There is not much you can do in such cases.

Recover plasmashell (kde)

If necessary kill plasmashell, in case that plasma crashed, there is no need to do this.

killall plasmashell

Upon running the killall command, everything will go black. However, you should still have access to the terminal. From here, restart the “plasmashell” process from the terminal. Be sure to add the “&” at the end of the command to send it to the background.

plasmashell &

As soon as the plasmashell command above is run, a fresh KDE Plasma 5 panel will appear on the screen. However, this new panel is dependent on the terminal, since it’s running inside of it. From here, the process needs to be sent to the background. To do this, run the disown command.

disown

Activate superior ntfs3 driver

  1. if kernel < 5.15.2 install ntfs3-dkms
  2. create file /etc/udev/rules.d/90-ntfs.rules
  3. add line SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
  4. reload sudo udevadm control --reload-rules
  5. restart file explorer and remount your HDD

Maintenance

Check Manjaro System Maintenance guide: https://wiki.manjaro.org/index.php?title=System_Maintenance

Cleaning journal logs

Check size of stored journals

journalctl --disk-usage 

Remove all journal entries but the last 50MB

journalctl --vacuum-size=50M 

Cleaning pacman cache

Extracted from https://ostechnix.com/recommended-way-clean-package-cache-arch-linux/ Check the size of the pacman cache

du -sh /var/cache/pacman/pkg/

Keep only most recent packet version in the cache

sudo paccache -rk 1

Delete cached packets that are uninstalled

sudo paccache -ruk0

Cloning drive with DD

Note this command dd is really dangerous if you don't know what you are doing, mistakes can result in loss of data and you could cripple your system.

For example to clone drive /dev/sdb (input) into /dev/sda (output) you can do this. Make sure the output device is equal or bigger in size

dd if=/dev/sdb of=/dev/sda bs=1M status=progress

The same command can be used to create an image of the disc to file or restoring it to a real disc

dd if=/dev/sdb of=~/image.img bs=1M status=progress

How to set udev rules (example)

Download udev rules file

wget https://openrgb.org/releases/release_0.9/60-openrgb.rules

Move udev rules file to udev rules directory

sudo mv 60-openrgb.rules /etc/udev/rules.d

Reload the rules

sudo udevadm control --reload-rules
sudo udevadm trigger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment