Skip to content

Instantly share code, notes, and snippets.

View gajaza's full-sized avatar
🎯
Focusing

G.A. Jazali 黄志愿 gajaza

🎯
Focusing
  • 12:32 (UTC +07:00)
View GitHub Profile
@gajaza
gajaza / non-booting-grub.md
Last active July 14, 2024 17:54
Fixing a non-booting GRUB on a dual boot machine

Fixing a Non-Booting GRUB on a Dual Boot Machine

This document shows the fixing steps if booting up the machine skips GRUB and directly boots up Windows instead.

After altering some settings in Windows, or just as often, after updating Windows, you may find yourself in the following situation:

  1. When booting up the computer normally, the GRUB screen that lets you choose which OS you want to use does not appear, and instead, the computer directly boots into Windows.
  2. When booting up the computer while holding the Esc key, the option for multiple operating systems are present, but pressing Enter after selecting your desired Linux distribution does not work (but selecting Windows works).
  3. Tools like DiskInternals Linux Reader (certain tools are needed to read ext4 partitions that some Linux systems use) shows that the Linux partitions, including its corresponding EFI partition is still intact.

The following steps summarizes what nee

@gajaza
gajaza / input-methods.md
Last active May 26, 2024 10:07
Getting Non-Latin Input Methods to Work

Getting Non-Latin Input Methods to Work on Arch-based Systems

To input non-Latin languages such as Mandarin Chinese and Japanese, one would need to install an Input Method Framework (IMF) and an Input Method Editors (IME). For me, the IMF that works best is Fcitx5, which is designed to be lightweight. In Arch-based systems, installing it is straightforward:

sudo pacman -S fcitx5

To use a GUI for configuring Fcitx5, install fcitx5-qt:

sudo pacman -S fcitx5-qt
/* Change color scheme to match EndeavourOS */
/* Make sure to set the theme as `Photon` in the settings */
@media (prefers-color-scheme: dark) {
:root {
--tab-border: #2f343f;
--tabbar-bg: #2f343f;
--tab-surface-regular: #565965;
--tab-surface-hover: #496c9a;
--tab-surface-active: #5294e2;
--tab-surface-active-hover: #75a9e8;

Change the Default File Manager to Krusader

Run the following in the command line:

xdg-mime default org.kde.krusader.desktop inode/directory

Change the Default Terminal when Opening htop Through dmenu

Change the following lines in htop.desktop (find this file through locate htop.desktop):

- Exec=htop
+ Exec=kitty -e htop
- Terminal=true

Change the Default Terminal in i3wm

To change the default terminal, you can modify the order in the /usr/bin/i3-sensible-terminal file:

- for terminal in "$TERMINAL" x-terminal-emulator mate-terminal gnome-terminal terminator xfce4-terminal urxvt rxvt termit Eterm aterm uxterm xterm roxterm termite lxterminal terminology st qterminal lilyterm tilix terminix konsole kitty guake tilda alacritty hyper wezterm; do
+ for terminal in "$TERMINAL" kitty alacritty x-terminal-emulator mate-terminal gnome-terminal terminator xfce4-terminal urxvt rxvt termit Eterm aterm uxterm xterm roxterm termite lxterminal terminology st qterminal lilyterm tilix terminix konsole kitty guake tilda alacritty hyper wezterm; do

    if command -v "$terminal" > /dev/null 2>&1; then
 exec "$terminal" "$@"
@gajaza
gajaza / switch-dm.md
Last active March 14, 2024 17:25
Switching Display Manager in Arch Linux

Switching Display Manager in Arch Linux

You might have more than one display manager installed in your machine. To switch from lightdm (the default DM in EndeavourOS) to, say, sddm because you want to swap i3wm with swaywm, you can use the following commands:

First of all, determine the name of your display manager running the following:

systemctl status display-manager

It will return something like this:

Install Neovim Plugins after Importing Dotfiles

Oftentimes, after importing your .dotfiles (including your Neovim configuration files) to a new machine, installing your Neovim plugins using :PlugInstall (if you're on vim-plug) isn't ideal. This is mainly because of all the error messages that you would have to skip through before you're even able to run the install command.

This can be circumvented by doing the following:

nvim -u .dotfiles/.config/nvim/plugins.vim --headless +"PlugInstall" +"qall"

Adjusting the Grub Bootloader for a HiDPI Screen

The text size on Grub, when running on a computer with a HiDPI screen (e.g., 2880x1800 at 13 inch), will often appear too small. Lowering Grub's resolution is one solution. However, it will make Grub's interface pixelated. A better way is to enlarge the font size itself and not mess with the resolution.

We can start by deciding what font we want to use for Grub's interface. I recommend using a typeface that is specifically built for the absence of anti-aliasing, such as Unifont.

Changing the font size of Grub means replacing the binary .pf2 font file that is compatible with Grub (regular .ttf files can't be read by Grub). This is because the font size is hardcoded to the binary. To create that .pf2 file out of the Unifont typeface, we can run the following in the command line:

sudo grub-mkfont --no-hinting -s 32 -o /boot/grub/fonts/unifont.pf2 /usr/share/fonts/Unifont/Unifont.ttf
@gajaza
gajaza / prompt
Last active March 2, 2024 18:19
Zsh Prompt with Git Status
# Allow the use of functions in prompt
setopt PROMPT_SUBST
# Colours
autoload -U colors && colors
# Exit code
local exit_code="%(?,,\$?: %{$fg[red]%}%?%{$reset_color%})"
# Version control system