Selected documentation and usage notes for my dotfiles

Revision No. 983, commit b158fed.

“comforts: Adding relative date utils”

Table of Contents

View changelog since the last revision as diff HEAD~1...HEAD

The verbosity factor of this document compared to comment lines of code in this repo is about 5:1.

If this document is 43.6KiB in size, and the approximate size of all comment lines of code is 74.3KiB then this document currently covers about 11.74% of all implemented features and behavior in this repository. This is just an automated guess though.

This document and repository is also mirrored at microsounds/atelier on GitHub.

Last updated 🌑 Sat, Apr 20th, 2024.

dotfiles—“atelier”shimeji

ico-freq ico-size ico-ci
ico-os ico-wm ico-editor ico-theme
shimeji miku © 2010 canary yellow

This is my primary computing setup, a self-contained graphical shell environment for Debian GNU/Linux.

Detailed installation instructions are provided, along with some documentation for the most essential components.

Pictured: Debian stable, a “graphical shell” environment consisting mostly of xorg, dwm, sxhkd and various urxvt clients.

Quick start

[OPTIONAL] Instructions for a Debian base install with debootstrap for BIOS/UEFI x86 systems.

Installing Debian using debootstrap

WARNING
This is a quick reference on using debootstrap to install Debian manually without using the official Debian installer. This is not a comprehensive tutorial on *NIX concepts, you should have some familiarity with administrating a GNU/Linux system before continuing.

  1. Boot into a Debian Live CD environment with any DE and partition your boot disk with gparted.

    You should always keep a Live CD install media around for use as a rescue disk, regardless of installation method. I only do it this way because I don’t feel like using fdisk.

    To install packages in the live environment, apt-get update first and then apt-get install gparted.

    Suggested boot disk layouts:

    • Legacy BIOS systems that support MBR/msdos partition tables
    # MBR disks support a maximum of 4 primary partitions
    [ primary part. (root) ] [ extended partition                            ]
                             [ logical part. (swap) ] [ logical part. (home) ]
    # example /etc/fstab
    /dev/sda1	/       ext4	defaults	0	1
    /dev/sda5	none    swap	defaults	0	0
    /dev/sda6	/home   ext4	defaults	0	2
    
    • Modern UEFI systems that support GPT/gpt partition tables
    # EFI partition must be FAT32 and at least 32MiB
    [ EFI partition ] [ root partition ] [ swap partition ] [ home partition ]
    
    # example /etc/fstab
    /dev/sda1	/boot/efi   vfat	defaults	0	2
    /dev/sda2	/           ext4	defaults	0	1
    /dev/sda3	none        swap	defaults	0	0
    /dev/sda3	/home       ext4	defaults	0	2
    

    NOTE
    If your machine uses a slow eMMC-based boot disk, I recommend f2fs for modestly improved performance instead of ext4. Support for booting from f2fs is not provided by default in Debian.
    See this tutorial on adding required f2fs modules to initramfs for more info.

  2. Mount your newly created filesystem in /mnt, including your home partition to /mnt/home if you made one.

  3. Install debootstrap and install the Debian base system into /mnt.

    • debootstrap --arch [eg. i386, amd64] stable /mnt https://deb.debian.org/debian
  4. Chroot into your new system, all actions from this point onward are within your chrooted system.

    $ sudo su -
    $ for f in proc sys dev run; do mount --make-rslave --rbind /$f /mnt/$f; done
    $ chroot /mnt /bin/bash
    
  5. Configure your /etc/fstab to taste.

    • Try lsblk -f >> /etc/fstab to identify disks by UUID=... instead of device name.
  6. Customize your locale by installing and dpkg-reconfigure’ng locales, and tzdata.

  7. Edit /etc/hostname and /etc/hosts with your preferred hostname.

  8. Install a suitable linux kernel.

    • Find a suitable kernel meta-package to install with apt-cache search ^linux-image | grep 'meta'.
  9. Install network-manager and the bootloader package grub2.

    grub2 does not install to your boot disk automatically, use the following:

    • Build initial grub configuration with /sbin/update-grub
    • For BIOS (installs to magic sector at start of disk)
      • /sbin/grub-install --root-directory=/ /dev/sda
    • For UEFI (installs to EFI partition mounted in /boot/efi)
      • /sbin/grub-install --root-directory=/ --efi-directory=/boot/efi /dev/sda
  10. Give your root user a password, create your normal user, and assign it a password also.

    • eg. useradd -m USERNAME -s /bin/bash; passwd USERNAME
  11. You should now have a working system, login as your user and skip to Step 2 in the Quick start below.

    • You can reboot from the Live CD environment at this point to check your work but it’s not required.
  1. Install Debian stable, perform a base install with no DE selected and no standard utilities when prompted.
    • Do not perform these steps on tty1, xinit will launch without dwm present and you will be kicked.
  2. Install git, wget, and sudo, then add yourself to the sudo group.
    • Log back in to apply changes to group membership.
  3. Bootstrap the system automatically with a hard git reset from this repo, this is done only once.
    $ git clone --bare https://github.com/microsounds/atelier ~/.config/meta
    $ git --git-dir=$HOME/.config/meta --work-tree=$HOME reset --hard
    # Invoke the login shell to apply changes made to the environment
    $ exec $SHELL -l
    
  4. Run post-install in the shell to run post-install scripts automatically. Do not run as root.
    • Sets up the package manager, installs essential packages, window manager, text editor, etc.
  5. Reboot to finish.
    • xinit starts automatically upon login to tty1.
mobile scrot

Quick start on Termux for Android

NOTE
Android-specific functionality depends on features provided by Termux:API and Termux:Widget add-on apps and must be installed along with Termux.
This is meant to be a lightweight port with modifications, do not initiate a full post-install.

  1. Install git, and bootstrap the system using git reset --hard as described above.
  2. Post-install: Run only ~/.once.d/a0-android-termux.sh
    • Applies android-specific hacks and termux specific dotfiles for theming and softkeys.
  3. When pulling from upstream, stash changes or git reset --hard to prevent merge conflicts.
    • Use patch -p1 < ~/.termux/diff.patch to restore changes if stash is lost.

See attached notes for overview of changes from a standard Linux environment.

List of supported platforms

Full graphical shell environment

Single-user minimal shell environment

On declarative OSes

While it might be easy to draw parallels to my setup and NixOS, my system completely avoids the horrors of “containerization” and the innumerable drawbacks to adopting declarative functional OSes like NixOS and GNU Guix.

They’re in my shortlist of timesink software ecosystems that I don’t want anything to do with, along with the Rust programming language, equally cult-like in their usage and online communities, all of of which require significant changes to your toolchain and computing lifestyle, requiring you to adapt to their limitations when it really should be the other way around.

Usage notes

Using git meta

For local-scope changes, files in $HOME are versioned and mangled in place using Git.

Using ~/.once.d post-install scripts

All system-wide changes are performed through automated scripts located in ~/.once.d, you can run them all at once with shell function post-install. Each script is self-contained, you can run them individually, anytime.

series function
0* System-wide changes performed through the package manager.
1* Changes to ~/.local file hierarchy, such as locally installed software and resources.
2* System-wide changes that bypass the package manager, such as changes to /etc.
These are hacks.
c* System-wide changes affecting chromebook hardware only.
a* Android-specific hacks only.
p* NTC PocketCHIP-specific hacks only.

Essential and *optional package groups

Essential and *persistent upstream utilities

Installation can be customized with user-provided executable install hacks scripts, named {pre,post}-run. These can be placed in ~/.config/upstream or at the root of a persistently installed utility’s install directory as described above

Rationale for doing things this way is summarized in commit 2fe1c3745.

Applying changes automatically after state change

For git operations that change the underlying state of the git meta working tree in $HOME, such as merges, pulling from remote, or checking out an older commit, post-install scripts that have changed will be re-run automatically git post-merge hook symlinked to ~/.local/lib/apply-changes to ensure a consistent environment.

For changes that affect currently running programs, apply-changes will alert the user if the X session or user login should be restarted to finish applying changes.

Window manager status bar

Status bar daemon xwin-statusd is forked and piped to xsetroot at startup to provide a concise dwm status bar conditionally listing the following status information when available, including:

Status bar output is suppressed to display notification text from notify-send when available, see attached notes for more info.

Window manager keybinds

Keyboard layouts and secondary layers are handled by keyd globally for better quality of life on non-standard keyboards. At the X server level, keybinds are handled by a mix of xkb, dwm, sxhkd and fcitx5 in such a way to avoid keybind stomping.

Caps Lock is remapped to Super_L on all platforms. dwm keybinds are the defaults with several exceptions, the modkey Mod1 is super instead of alt because many alt combinations are already taken by other applications I use.

Alt-based keybinds are kept to a minimum because these are commonly taken by applications.

shift + alt + key
kill window F4
counter-clockwise switch focused window tab

Super-based keybinds meant for system and window manager functions.

shift + super + key
float window[toggle] monocle window[toggle] space
set as master window[toggle] terminal return
launcher p
file manager e
ssh-add[toggle] backspace
partial screenshot screenshot print
reserved scroll lock
reserved pause
reboot shutdown F1
hibernate sleep F2
hibernate + reboot display off F3
configure networking calculator F4
configure displays switch active display[toggle] F5
minimum brightness lower brightness 10% F6
maximum brightness raise brightness 10% F7
configure audio mute[toggle] F8
lower volume 5% F9
raise volume 5% F10
randomize wallpaper F11
reserved F12~F24

Special keybinds that don’t fit in other categories.

alt + ctrl + key[special]
switch input method[toggle] space
clipboard manager ;
task manager delete
syslog insert

Generic 74-key Chromebook layout

Search key is Super_L, most missing keys are hidden behind Right Alt layer. Power key has been remapped to delete for better usability.

Function F1-F10 are in the usual places, F11 is lesser used and hidden behind Right Alt.

right alt + key remarks
prior up
next down
home left
end right
XF86Back F1 Right Alt + F* may not work on pre-EC chromebooks
XF86Forward F2
XF86Reload F3
F11 F4 opens fullscreen mode in most browsers
XF86LaunchA F5
lower brightness 10% F6
raise brightness 10% F7
mute[toggle] F8
lower volume 5% F9
raise volume 5% F10
F11 delete same as power key, keystroke repeat not available
delete backspace keystroke repeat works fine

Some environment notes

X server invocation

No display manager is used, login to tty1 to start the graphical shell.

All daemons and services required to support the graphical shell are initialized along with the X server and are terminated when the user terminates the session.

systemd unit services, cronjobs and similar mechanisms are avoided whenever possible.

At startup, startx will pass hardware-specific xorg.conf files to the X server, to enable hardware compositing on supported hardware and eliminate screen tearing.

Xorg’s security model forbids non-root users from passing arbitrary config files to the X server unless said configs are located in one of several “blessed” directories. Post-install scripts will create symlink /etc/X11/$(id -u)-override that points to ~/.config/xorg to override this behavior.

Optional X Window configuration

~/.xrandr

For use with multi-monitor and/or complicated display setups, you can override the default display layout with one or more commands to xrandr saved to optional config file ~/.xrandr

# e.g. two monitors, right is mounted vertically
--output HDMI-0 --auto --primary --rotate normal
--output HDMI-1 --auto --right-of HDMI-0 --rotate right

Commands in this file are passed to xrandr-cycle line by line at startup if it exists. For example, this configuration would suit a 2 monitor layout with the right monitor mounted vertically.

~/.xdecor

You can designate one or more paths to directories containing images or videos for use as a wallpaper using optional config file ~/.xdecor

# prefixing with ~/ is acceptable
~/Pictures/some/path
/media/sd_card/some/path

If it exists, xwin-decor will randomly pick a directory and file within it and set it as the wallpaper on startup. In the case of video files, a random video frame from that file will be taken and set as the wallpaper using ffmpeg.

X resources and theming

For consistency, xinit, dwm and other scripts make use of the C preprocessor to mangle config files and configure color schemes.

Theme settings and individual color schemes are stored as C header files containing preprocessor macros representing color hex codes in ~/.local/include. This directory is appended to $C_INCLUDE_PATH at login.

Optionally, you can apply another existing color scheme by naming it as an argument. This can be useful when dealing with TUI applications that force their own background colors.

List of available macros

Issues with HiDPI scaling

HiDPI display setups are currently not supported, 96dpi is assumed everywhere.

HiDPI scaling brings up innumerable display issues in every category of graphical software including electron-based applications that require polluting scripts and dotfiles to smooth out toolkit scaling issues. Maintaining mixed-DPI multi-monitor setups in X11 is even more painful.

As of posting, I don’t have a >1080p monitor to motivate such changes, I’m not about to pepper my scripts with toolkit-specific environment variables and conditional logic to support HiDPI scaling. See ~/.local/include/theme.h for more info.

Non-standard commands

Several commands are extended to include impure functions, such as purposefully mangling config files, and have the following precedence when multiple versions exist:

  1. Interactive shell functions defined in ~/.bashrc
  2. Non-interactive shell library executables in ~/.local/lib
    • Shell script snippets used by multiple scripts to reduce clutter.
  3. Normal executables and symlinks in ~/.local/bin
    • Some are shell functions promoted to scripts so they’ll work in dmenu or outside of a terminal context.
  4. /usr/bin system-wide executables

Interactive shell

path-gitstatus

The prompt path will feature embedded git information provided by path-gitstatus highlighting the root of a git worktree and it’s status.

Outside of git worktrees, the path component will be mangled by path-shorthand and be truncated to the last $PATH_WIDTH characters (default is 50) for improved usability.

Termux for Android

Single-user shell environment should work as expected on Termux without root access or changes to $PREFIX/etc with several caveats described below.

Post-install scripts make the following adjustments statically for existing scripts. These adjustments will also be saved as a diff patch in ~/.termux/diff.patch in case these changes are overwritten with git.

Termux:Widget

Scripts in ~/.shortcuts are meant for use with Termux:Widget which can be found wherever you got Termux. This is an optional add-on to Termux that lets you launch foreground or background scripts from an Android homescreen widget.

See the project page for documentation and environment notes, it’s important to note that scripts launched this way do not source ~/.profile or ~/.bashrc like they would running from a Termux instance.

You must give Termux permission to display over other apps via Settings > Apps > Display over other apps for this add-on to work properly.

Standard file descriptors

Shell scripts on Android systems without root access have no access to standard file descriptors /dev/std{in,out,err}, use /proc/self/fd/{0,1,2} instead.

ESC sequences

Using \e to insert escape literals in scripts works for some OSC codes, but not all, use octal \33 when in doubt.

$PREFIX

Previously, termux-chroot was used to ensure FHS-compliance, but it introduced unacceptable performance speed.

Use Termux’s own provided envvar $PREFIX to refer to standard filesystem locations within scripts or interactively, e.g. $PREFIX/tmp which expands to /data/data/com.termux/files/usr/tmp. In practice, shell script shebangs don’t need to be rewritten, Termux already rewrites these with some hidden voodoo I don’t care to understand.

Background processes since Android 11

The customized Android images that ship from Chinese and Korean manufacturers since version 11 have become far more aggressive in pruning “phantom” processes (daemons) in the pursuit of better battery life.

You may experience issues with processes backgrounded with the & operator being throttled or killed when multitasking outside of Termux. Daemons that fork without becoming a child process or exec’ing the same process that called it may be killed immediately or shortly after leaving Termux if not called in foreground mode.

In order to prevent Android from prematurely pruning ssh-agent while multitasking, it is called as the parent process for the current shell.

Termux developers recommend their very own termux-services for running common daemons. Launch daemons in foreground mode without forking and preferably with wakelock acquired from the Notification Bar or with termux-wake-lock if you wish to run a long-running task without being throttled by the operating system.

If you don’t mind the limitations of Termux:Widget, you can also run long-running scripts as a headless background tasks by putting it in ~/.shortcuts/tasks.

ssh-agent fingerprint SSH authentication

WARNING
This is an ongoing experiment in balancing convenience and security, your threat model may find the barebones security provided by fingerprint sensors unacceptable.

ssh-agent is set up to call termux-ssh-askpass which uses Android’s hardware-backed keystore to generate an OpenSSH key passphrase using the fingerprint lock on your Android device.

Specifically, a hardware-backed inaccessible RSA 4096-bit private key named default is generated during post-install and stored in the security chip on the device which is only made available during a short validity period after a successful fingerprint unlock. This inaccessible private key is used to sign the matching public key for the portable OpenSSH private key being unlocked by ssh-agent and friends to produce a passphrase from the signed nonce value emitted by the security chip on your Android device.

Simply put, this allows for fingerprint-based SSH authentication, a massive quality of life improvement over entering case-sensitive passphrases on a smartphone.

Important considerations

  1. Both the termux-api package and the companion add-on app Termux:API available from the same place you got Termux are required for this functionality to work.

  2. There is no chance of vendor or device lock-in, as you are not using key material from the security chip as your OpenSSH key.

    • The nonce value is not important, it’s just convenient seed data used to produce a reproducible passphrase that requires your fingerprint to unlock.
    • The key material locked in the hardware-backed keystore is also not important, you are simply using it to generate passphrases for your existing portable OpenSSH keys.
  3. Even though someone with physical access to your Android device could modify the hardware keystore without authentication and could replace keys with identically named keys that have an unlimited validity period, they will not be the same key material used to sign and your portable OpenSSH keys will still be safe.

  4. You understand that by replacing passphrases with biometrics, your fingerprint reader becomes your single point of failure, you have been warned.

Initial setup

To setup your existing OpenSSH keys for fingerprint-based SSH authentication, use the output of termux-ssh-askpass as your new passphrase in ssh-keygen.

new_pass="$(termux-ssh-askpass ~/.ssh/id_rsa)"
ssh-keygen -p -f ~/.ssh/id_rsa -N "$new_pass" -F 'old passphrase'

cd

chromium

NOTE
On first-run, chromium will momentarily exit and restart to rebuild configuration and enable use of externally customized color options.

chromium is not meant to be user-serviceable or configurable through plaintext without using system-wide group policy features, chromium is a shell script extended to mangle user-hostile internal state files to match the persistent plaintext configs described below:

C preprocessor syntax is also accepted, hex color values in the form #RRGGBB will be converted to a signed integer representing 0xBBGGRRAA in two’s complement hexadecimal with AA (alpha channel) always set to 0xFF

Managed policy overrides

chromium is managed by /etc/chromium/policies/managed/extensions.json, set up during post-install, which automatically installs several useful extensions on first-run, including uBlock Origin.

Configuring Vimium

Use of Vimium is considered optional, as I haven’t figured out a way to configure it automatically on first-run. Its configuration resides in ~/.config/chromium/vimium

Run configure.sh to rebuild vimium-options.json for importing back into Vimium by hand.

An ongoing experiment

chromium has proven difficult to configure non-interactively time and time again. Plaintext chromium configuration is an ongoing experiment of mine.

non-interactive functionality status
first-run config rebuild works
applying persistent chromium settings works
applying persistent chromium flags works
applying persistent omnibox settings works
extension install on first-run works (via group policy)
applying persistent extension settings no

git

git aliases are defined in ~/.gitconfig or implemented in interactive shell function git()

See Usage Notes for more information.

nano

NOTE
nano keybind macros make use of inline non-printable control characters, you must use nano or cat -v to view ~/.nanorc correctly.

notify-send

This particular notify-send implements only -t for expiration time in seconds, because it doesn’t tie into any dbus-based notification daemon implementing the Desktop Notifications spec.

Instead, it’s just a shell script that writes to a named pipe that gets picked up by xwin-statusd as a simple way to implement OSD text and single-line notifications.

Unlike other implementations, you can pass notifications/OSD text as an argument or via stdin without using xargs.

sc (spreadsheet calculator)

sc supports macros to some degree, but its macro implementation is difficult to understand and there aren’t many examples of it being used successfully anywhere that I’ve managed to find.

Instead, the shell function sc() offers an easier to understand macro system for statically mangling .sc spreadsheet files at runtime.

sc pre-run macro example scripts

  1. A macro script for an inventory spreadsheet that color-codes cells when specific strings are found.

    #!/usr/bin/env sh
    # apply colors to specific strings in column B
    
    file="${0%.*}" # derive .sc file name from name of this script
    
    # remove all instances of color from the file in place
    { rm "$file"; egrep -v '^color' > "$file"; } < "$file"
    
    cat <<- EOF >> "$file" # set some non-default colors
    	color 3 = @black;@red
    	color 4 = @black;@yellow
    	color 5 = @black;@green
    EOF
    # select only string cells from column B, apply colors based on string contents
    # sc format: leftstring B2 = "example string"
    egrep '^((left|right)string|label)' < "$file" | while read -r cmd cell _ str; do
    	case "$cell" in B*)
    		case "$str" in
    			*broken*) echo "color $cell:$cell 3";;
    			*bad*) echo "color $cell:$cell 4";;
    			*working*) echo "color $cell:$cell 5";;
    		esac;;
    	esac
    done >> "$file"
    
  2. A macro script that extracts specific fields from a spreadsheet and mangles them into arbitrary JSON data, I use this to update my figure collection page on my personal site.

    • sc is very old and predates most notions of CSV or tab delimited data, the easiest way to extract fields with spaces is use expect to output a colon separated table using the T command “interactively”, write it to the default filename ending in .cln, and then delete it when finshed.
    #!/usr/bin/env sh
    
    # generate simplified JSON data for website
    file="${0%.*}"
    
    expect <<- EOF > /dev/null
    	spawn sc "$file"
    	expect "sc 7.16" {
    		send -- "T\n"
    	}
    	expect "i> tbl" {
    		send -- "\n Q\n"
    		expect eof
    	}
    EOF
    
    # replace empty colon delimited fields with '(null)' for consistency
    # yes this is very ugly
    cat "${file%.*}.cln" \
    	| sed -e '/^::/d' -e 's/^:/(null):/g' -e 's/::/:(null):/g' \
    		-e 's/::/:(null):/g' -e 's/:$/:(null)/g' \
    	| tr ':' '\t' | cut -f1-5 | tail -n +5 | while read -r status id key desc; do
    		case "$desc" in
    			knockoff*|counterfeit*|fake*) id="x$id";;
    			*)	case "$status" in
    					unopened|displayed|storage);;
    					wishlist) id="w$id";;
    					*) id="p$id";;
    				esac;;
    		esac
    		year="${desc#*	}"
    		desc="${desc%	$year}"
    		desc="$(echo "$desc" | sed "s/'/\\\\'/g")" # escape quotes
    		printf "\t[ '%s', '%s', '%s (%s)' ],\n" \
    			"$id" "$key" "$desc" "$year"
    done > "${file%.*}.json"
    
    rm -f "${file%.*}.cln"
    

Games

A few Linux-compatible games I like that also can be fetched easily via the internet exist in this repo as scripts that auto-install the game on first run. Because these scripts install proprietary software they are not included during the post-install, some implementation notes are included.

Proprietary games will be installed to ~/.local/opt, configuration beyond the initial installation is outside the scope of this repo.

minecraft

minecraft launches or installs UltimMC offline launcher, and a Java runtime environment if not already installed.

UltimMC is a fork of MultiMC which allows you to play any version of Minecraft Java Edition offline with or without a paid Minecraft account, it can manage your mods, resource packs and saved worlds as “instances” you can import or export freely.

While you can play online multiplayer normally with a legitimate paid account, you can also login with just a username on 3rd-party servers that specifically allow unauthenticated (“pirate” or “cracked”) clients.

Regardless of which Minecraft version you prefer, using vanilla optimization mods such as Sodium, Lithium, and FerriteCore can improve framerate, performance lag, and GPU utilization by 2.5x or more.

Minimum requirements for acceptable performance:

genshin-impact

WARNING
Genshin Impact 4.0.0+ requires at least 170GB of disk space to unzip the game, this is on top of of the install size of 32-bit + 64bit Wine which is 1.3GB.

genshin-impact launches or installs the Windows version of Genshin Impact from official sources.

Before version 3.8.0, this script used a certain Linux patch that disabled the Linux-hostile anticheat software. Because it patched game files, it violated MiHoYo’s terms of service and you risked banning your account if used.

While newer versions don’t officially support Linux, the game now runs on Wine with some tweaks, patching game files is no longer required. To date, nobody has reported being banned for playing on a Steam Deck running Linux-based SteamOS.

Refer to troubleshooting guides for Windows or Linux-specific problems if you have issues running the game or logging in.

Camera movement issues

A common problem is mouse camera movement being extremely sensitive or unresponsive after switching workspaces, to fix:

  1. Go to Settings and set display resolution to any windowed mode.
  2. Click anywhere on the virtual Wine desktop to focus on it.
  3. Click on the Genshin Impact titlebar to focus it, make sure it turns blue.
  4. Go to Settings and switch back to fullscreen, mouse movement should now work correctly.

As a workaround, try to get into the habit of switching to a windowed resolution before focusing away from the game.

Manual installation

After installing the launcher, if you have barely enough disk space (at least 90GB) for the game but not for unzipping, the Windows troubleshooting guide includes direct download links to the required .zip files.

You can unzip in-memory with half the disk space required using wget -O - [url] | busybox unzip directly into ~/.local/opt/genshin-impact/drive_c/Program Files/Genshin Impact/Genshin Impact Game.

Even if you used the official installer, if you want to download language packs other than English, I would suggest this method, because downloading it in-game (15-18GB) is very slow and cannot be done in the background.

Usage

Wine 5.3 or later is required, various prerequsite tools are installed along with the game. Since this is a Windows game running over Wine using various hacks, this installation script and the steps required are awful and anything but automatic, read the script to understand what is being done before installing.

During the installation, a Wine prefix will be set up, some winetricks, prerequisite MSVC frameworks, along with the official installer will be downloaded and installed, install everything as it pops up. Follow the xmessage prompts as they pop up.

Run genshin-impact to launch the game directly, use -l flag to open the official launcher to install updates when needed, -m to use mangohud profiler and -- to stop accepting flags, all other flags will be passed to the game executable.

Minimum requirements for acceptable performance:

Downloads

STATISTICS
Version numbers for selected long-lived components found in the current revision:

Total on-disk size of the current revision is 310.46KiB out of a total compressed git history size of 986.05KiB.

Complete source listing

microsounds@shami:~$ git meta ls-tree --name-only -r master | xargs ls -lhgG
-rw-r--r-- 1  11K   Mar 30 2024 13:04 rev. 145 .bashrc
-rw-r--r-- 1 1.3K   Apr 20 2024 18:28 rev. 98  .comforts
-rw-r--r-- 1  558   Nov 28 2023 17:29 rev. 12  .comforts-git
-rw-r--r-- 1  850   Apr 16 2024 01:14 rev. 5   .config/chromium/local_state.conf
-rw-r--r-- 1 3.6K   May 25 2023 19:52 rev. 1   .config/chromium/omnibox.sql
-rw-r--r-- 1  427   May 25 2023 19:28 rev. 3   .config/chromium/preferences.conf
-rwxr-xr-x 1  465   Feb 13 2022 22:53 rev. 2   .config/chromium/vimium/configure.sh
-rw-r--r-- 1  639   Feb 13 2022 22:53 rev. 2   .config/chromium/vimium/general.json
-rw-r--r-- 1  608   Feb 12 2022 01:57 rev. 1   .config/chromium/vimium/keybinds.conf
-rw-r--r-- 1  442   Feb 12 2022 01:57 rev. 1   .config/chromium/vimium/style.css
-rw-r--r-- 1  807   Dec 24 2021 12:04 rev. 2   .config/dmenu/config.h
lrwxrwxrwx 1   14   (symbolic link)   rev. 0   .config/dmenu/pre-run -> ../dwm/pre-run
-rw-r--r-- 1 6.3K   Feb  1 2024 21:01 rev. 32  .config/dwm/config.h
-rw-r--r-- 1 1.7K   Jan 31 2024 14:15 rev. 1   .config/dwm/patches/desktop-icons.diff
-rw-r--r-- 1  560   Jul 16 2021 00:35 rev. 1   .config/dwm/patches/floating-alwayscenter.diff
-rw-r--r-- 1 1.7K   Jul 16 2021 00:35 rev. 1   .config/dwm/patches/floating-saveposition.diff
-rw-r--r-- 1  501   Jul 16 2021 00:35 rev. 3   .config/dwm/patches/monocle-indicator.diff
-rw-r--r-- 1 1.8K   Jul 16 2021 00:37 rev. 1   .config/dwm/patches/rule-ispermanent.diff
-rw-r--r-- 1  870   Jul 16 2021 00:35 rev. 1   .config/dwm/patches/status-allmonitors.diff
-rwxr-xr-x 1  250   Mar 11 2022 22:34 rev. 2   .config/dwm/pre-run
-rw-r--r-- 1  242   Apr 28 2023 22:37 rev. 1   .config/fcitx5/profile
-rw-r--r-- 1  360   Jan 31 2024 17:59 rev. 1   .config/fm/desktop.conf
-rw-r--r-- 1  719   Oct 17 2021 22:00 rev. 6   .config/fm/libfm.conf
-rw-r--r-- 1  387   Apr  3 2021 21:51 rev. 4   .config/fm/pcmanfm.conf
-rw-r--r-- 1  155   Apr  6 2021 15:35 rev. 1   .config/gtk/gtk2.conf
-rw-r--r-- 1  263   Apr  6 2021 15:35 rev. 3   .config/gtk/gtk3.conf
-rw-r--r-- 1  967   Jul 18 2021 11:56 rev. 15  .config/htop/htoprc
-rw-r--r-- 1  872   Nov 28 2023 18:11 rev. 2   .config/keyd/chromebook.conf
-rw-r--r-- 1   81   Nov 28 2023 17:29 rev. 1   .config/keyd/default.conf
-rw-r--r-- 1  820   Mar  1 2024 22:41 rev. 24  .config/mpv/mpv.conf
-rwxr-xr-x 1  323   Mar 11 2022 22:34 rev. 2   .config/nano/post-run
-rwxr-xr-x 1  215   Mar 11 2022 22:34 rev. 5   .config/nano/pre-run
-rw-r--r-- 1  197   Apr  6 2021 15:35 rev. 5   .config/sxhkd/chromebook
-rw-r--r-- 1 2.7K   Jan 15 2024 17:58 rev. 46  .config/sxhkd/default
-rw-r--r-- 1  401   Dec 20 2021 13:55 rev. 1   .config/sxhkd/mouse
-rwxr-xr-x 1  279   Sep 10 2023 23:30 rev. 1   .config/upstream/cmark-gfm-xhtml/pre-run
-rwxr-xr-x 1  556   Nov 28 2023 17:29 rev. 1   .config/upstream/keyd/pre-run
-rwxr-xr-x 1  519   Oct 26 2023 10:28 rev. 2   .config/upstream/sc/pre-run
-rwxr-xr-x 1  231   Mar 10 2022 17:55 rev. 1   .config/upstream/x48/post-run
-rwxr-xr-x 1  311   Apr 29 2023 09:35 rev. 5   .config/upstream/x48/pre-run
-rwxr-xr-x 1  313   Aug  4 2023 16:41 rev. 1   .config/upstream/xdiskusage/pre-run
-rwxr-xr-x 1  235   Dec  6 2021 18:11 rev. 2   .config/upstream/yt-dlp/post-run
-rw-r--r-- 1 1019   Dec 16 2021 12:51 rev. 5   .config/xkb/chromebook.xkb
-rw-r--r-- 1 2.2K   Dec 16 2021 07:15 rev. 1   .config/xkb/ntc-chip.xkb
-rw-r--r-- 1  199   Sep 23 2020 14:50 rev. 1   .config/xorg/amd.conf
-rw-r--r-- 1  368   Aug 24 2020 22:50 rev. 6   .config/xorg/intel.conf
-rw-r--r-- 1  939   Dec 15 2021 19:58 rev. 1   .config/xorg/ntc-chip.conf
-rw-r--r-- 1  289   Aug 29 2020 21:25 rev. 2   .config/xorg/nvidia.conf
-rw-r--r-- 1 2.5K   Dec 28 2023 22:56 rev. 31  .gitconfig
-rw-r--r-- 1 4.0K   Apr 20 2024 09:37 rev. 34  .github/workflows/ci.yml
-rw-r--r-- 1 2.5K   Sep 15 2022 02:32 rev. 7   .github/workflows/magnet-dl.yml
-rwxr-xr-x 1  232   Jan  5 2023 18:36 rev. 1   .local/bin/ascii2ps
-rwxr-xr-x 1 2.6K   Mar  2 2024 11:22 rev. 18  .local/bin/chromium
-rwxr-xr-x 1  181   Sep 25 2022 23:41 rev. 2   .local/bin/egrep
-rwxr-xr-x 1   85   Jul 15 2020 17:12 rev. 3   .local/bin/feh
lrwxrwxrwx 1    5   (symbolic link)   rev. 0   .local/bin/fgrep -> egrep
-rwxr-xr-x 1 2.7K   Mar 20 2024 17:43 rev. 9   .local/bin/genshin-impact
-rwxr-xr-x 1 1.6K   Jan 26 2024 20:48 rev. 5   .local/bin/getquote
-rwxr-xr-x 1  100   Jul 15 2020 17:12 rev. 2   .local/bin/make
-rwxr-xr-x 1  735   Mar 12 2024 13:29 rev. 6   .local/bin/minecraft
-rwxr-xr-x 1  153   Mar 30 2021 13:19 rev. 4   .local/bin/mpv
lrwxrwxrwx 1   29   (symbolic link)   rev. 0   .local/bin/nano-overlay -> ../../Scripts/nano_overlay.sh
-rwxr-xr-x 1  790   Nov  6 2023 17:44 rev. 1   .local/bin/nyaa-magnet
-rwxr-xr-x 1  423   Jan  7 2022 18:03 rev. 1   .local/bin/pprofiler
-rwxr-xr-x 1  907   Oct 10 2022 21:50 rev. 1   .local/bin/psp-h264
-rwxr-xr-x 1  731   Mar 21 2022 23:26 rev. 3   .local/bin/qr
lrwxrwxrwx 1    5   (symbolic link)   rev. 0   .local/bin/rgrep -> egrep
-rwxr-xr-x 1 1.0K   Dec  6 2021 00:36 rev. 3   .local/bin/scramble
-rwxr-xr-x 1  155   Oct 16 2020 13:58 rev. 1   .local/bin/scrot
-rwxr-xr-x 1  671   Nov 28 2023 16:45 rev. 10  .local/bin/startx
-rwxr-xr-x 1  367   Dec 16 2022 12:16 rev. 1   .local/bin/to-chromium
-rwxr-xr-x 1  659   Mar 21 2022 23:26 rev. 3   .local/bin/twopass
-rwxr-xr-x 1  192   Oct 10 2022 21:50 rev. 1   .local/bin/winenv
lrwxrwxrwx 1   29   (symbolic link)   rev. 0   .local/bin/xrandr-cycle -> ../../Scripts/xrandr_cycle.sh
lrwxrwxrwx 1   27   (symbolic link)   rev. 0   .local/bin/xwin-decor -> ../../Scripts/xwin_decor.sh
lrwxrwxrwx 1   26   (symbolic link)   rev. 0   .local/bin/xwin-statusd -> ../../Scripts/wm_status.sh
lrwxrwxrwx 1   26   (symbolic link)   rev. 0   .local/bin/xwin-webm -> ../../Scripts/xwin_webm.sh
lrwxrwxrwx 1   29   (symbolic link)   rev. 0   .local/bin/xwin-widgets -> ../../Scripts/xwin_widgets.sh
-rw-r--r-- 1  679   Oct 21 2021 23:42 rev. 1   .local/include/colors/campbell.h
-rw-r--r-- 1  457   Dec 14 2021 20:37 rev. 1   .local/include/colors/ncurses.h
-rw-r--r-- 1  749   Feb 15 2021 00:56 rev. 4   .local/include/colors/nightdrive.h
-rw-r--r-- 1  690   Nov 15 2021 23:00 rev. 5   .local/include/colors/overcast.h
-rw-r--r-- 1  642   Feb 15 2021 00:56 rev. 2   .local/include/colors/xterm.h
-rw-r--r-- 1 1.6K   Dec 24 2021 12:04 rev. 3   .local/include/theme.h
-rwxr-xr-x 1 1.1K   Mar  2 2024 19:09 rev. 2   .local/lib/apply-changes
-rwxr-xr-x 1  650   Jul 10 2021 23:42 rev. 2   .local/lib/conf-append
-rwxr-xr-x 1  477   Jul 10 2021 23:42 rev. 3   .local/lib/extern
-rwxr-xr-x 1  187   Nov 28 2023 16:45 rev. 3   .local/lib/is-chromebook
-rwxr-xr-x 1  194   Apr 14 2022 20:58 rev. 3   .local/lib/is-container
-rwxr-xr-x 1  376   Mar 11 2022 22:34 rev. 1   .local/lib/is-installed
-rwxr-xr-x 1  314   Jul 17 2021 22:28 rev. 1   .local/lib/is-newer
-rwxr-xr-x 1  356   Dec 15 2021 19:58 rev. 1   .local/lib/is-ntc-chip
-rwxr-xr-x 1  186   Dec 17 2023 15:36 rev. 2   .local/lib/is-termux
-rwxr-xr-x 1  258   Jul 10 2021 23:42 rev. 2   .local/lib/mk-tempdir
-rwxr-xr-x 1 1.3K   Apr  2 2023 19:20 rev. 5   .local/lib/moonphase-date
-rwxr-xr-x 1  526   Dec  3 2021 22:08 rev. 1   .local/lib/notify-send
-rwxr-xr-x 1 1.1K   Oct 21 2021 21:08 rev. 2   .local/lib/palette
lrwxrwxrwx 1   27   (symbolic link)   rev. 0   .local/lib/path-gitstatus -> ../../Scripts/git_status.sh
-rwxr-xr-x 1  553   Jul 10 2021 23:42 rev. 5   .local/lib/path-shorthand
-rwxr-xr-x 1  181   Aug  2 2021 15:47 rev. 1   .local/lib/sfx-play
-rwxr-xr-x 1  958   Jan  2 2024 14:18 rev. 4   .local/lib/sfx-synth
-rwxr-xr-x 1  526   Dec 28 2023 02:14 rev. 1   .local/lib/systemd-sleep
-rwxr-xr-x 1 2.5K   Dec 19 2023 23:01 rev. 4   .local/lib/termux-ssh-askpass
-rwxr-xr-x 1  319   Jul 23 2021 00:58 rev. 1   .local/lib/user-confirm
-rwxr-xr-x 1  284   Apr  2 2023 19:27 rev. 6   .local/lib/visual
-rwxr-xr-x 1  355   Mar 18 2024 11:37 rev. 1   .local/lib/x-user-confirm
-rw-r--r-- 1  172   May 29 2020 11:21 rev. 1   .local/share/X11/bitmaps/diag.xbm
-rw-r--r-- 1  280   Aug 14 2021 15:39 rev. 1   .local/share/applications/mimeapps.list
-rw-r--r-- 1   80   Aug 14 2021 15:39 rev. 1   .local/share/applications/nano.desktop
-rw-r--r-- 1  685   Mar 31 2021 21:37 rev. 3   .local/share/nano/md-kagami.nanorc
-rw-r--r-- 1  291   Jul 15 2020 16:41 rev. 2   .local/share/nano/stdc.syntax
-rw-r--r-- 1   84   Mar 26 2022 20:37 rev. 1   .mailmap
-rw-r--r-- 1 1.8K   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2015/assets/minecraft/textures/entity/alex.png
-rw-r--r-- 1 1.8K   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2015/assets/minecraft/textures/entity/steve.png
-rw-r--r-- 1  114   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2015/pack.mcmeta
-rw-r--r-- 1  32K   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2015/pack.png
-rw-r--r-- 1 2.0K   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2023/assets/minecraft/textures/entity/alex.png
-rw-r--r-- 1  106   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2023/pack.mcmeta
-rw-r--r-- 1  65K   Sep 25 2023 02:10 rev. 1   .minecraft/resourcepacks/HatsuneMiku_2023/pack.png
-rw-r--r-- 1 1.7K   Jan 26 2024 20:48 rev. 36  .nanorc
-rwxr-xr-x 1 1.7K   Aug 26 2023 09:38 rev. 23  .once.d/00-apt-repositories.sh
-rwxr-xr-x 1  695   Aug 20 2023 20:43 rev. 21  .once.d/01-install-essential.sh
-rwxr-xr-x 1  586   Mar  2 2024 12:39 rev. 6   .once.d/02-meta-config.sh
-rwxr-xr-x 1  213   Oct 22 2022 22:48 rev. 1   .once.d/0p-pocketchip-dpi.sh
-rwxr-xr-x 1 2.5K   Aug 20 2023 20:43 rev. 9   .once.d/10-git-upstream.sh
-rwxr-xr-x 1  657   Apr 29 2023 09:35 rev. 10  .once.d/13-posix-docs.sh
-rwxr-xr-x 1 1022   Mar 21 2022 23:26 rev. 11  .once.d/14-sunvox.sh
-rwxr-xr-x 1  549   Aug  2 2021 15:28 rev. 1   .once.d/15-sound-effects.sh
-rwxr-xr-x 1  499   Nov 21 2020 15:41 rev. 3   .once.d/20-xorg-override.sh
-rwxr-xr-x 1  387   Jun 18 2021 00:52 rev. 12  .once.d/21-network-manager.sh
-rwxr-xr-x 1  796   Jul  6 2022 16:51 rev. 11  .once.d/22-realtek-rtl8812au.sh
-rwxr-xr-x 1  619   Aug 26 2023 09:24 rev. 17  .once.d/23-grub-config.sh
-rwxr-xr-x 1  298   Nov 30 2021 00:48 rev. 1   .once.d/24-initramfs-resume.sh
-rwxr-xr-x 1  752   Mar 21 2022 23:26 rev. 13  .once.d/25-chromium-widevine.sh
-rwxr-xr-x 1 1.1K   Feb 15 2024 02:34 rev. 7   .once.d/26-freedesktop-tweaks.sh
-rwxr-xr-x 1  178   Mar 13 2021 01:07 rev. 4   .once.d/27-libvirt-rootless.sh
-rwxr-xr-x 1 1.5K   Mar 21 2022 23:26 rev. 9   .once.d/28-intel-undervolt.sh
-rwxr-xr-x 1  865   Dec 14 2023 22:03 rev. 6   .once.d/29-chromium-extensions.sh
-rwxr-xr-x 1   58   Nov 30 2021 00:47 rev. 3   .once.d/2a-remove-motd.sh
-rwxr-xr-x 1  201   Mar  2 2022 12:39 rev. 2   .once.d/2b-enscript-fonts.sh
-rwxr-xr-x 1  566   Nov 26 2022 20:37 rev. 1   .once.d/2c-csr8510-bluetooth.sh
-rwxr-xr-x 1 1.1K   Nov 23 2023 19:59 rev. 2   .once.d/2d-intel-bay-trail.sh
-rwxr-xr-x 1 4.3K   Mar 29 2024 21:07 rev. 32  .once.d/a0-android-termux.sh
-rwxr-xr-x 1  200   Nov 28 2023 16:34 rev. 10  .once.d/c0-chromebook-power-key.sh
-rw-r--r-- 1 1.1K   Oct 22 2022 22:48 rev. 1   .once.d/ntc-chip.patch
-rwxr-xr-x 1  199   Nov 28 2023 16:34 rev. 3   .once.d/p0-pocketchip-power-key.sh
-rwxr-xr-x 1  396   Oct 22 2022 22:48 rev. 1   .once.d/p1-pocketchip-network-manager.sh
-rw-r--r-- 1  886   Sep 10 2023 23:30 rev. 31  .profile
-rw-r--r-- 1  276   Dec 14 2021 20:38 rev. 6   .scrc
-rwxr-xr-x 1 1004   Mar 29 2024 21:07 rev. 8   .shortcuts/SFTP-Server
-rw-r--r-- 1 2.5K   Jan 31 2024 17:59 rev. 78  .xinitrc
-rw-r--r-- 1 2.0K   Dec 29 2023 10:42 rev. 29  .xresources
-rwxr-xr-x 1 4.3K   May 15 2022 23:36 rev. 32  Scripts/git_status.sh
-rwxr-xr-x 1  23K   Jun 25 2022 16:15 rev. 90  Scripts/nano_overlay.sh
-rwxr-xr-x 1 6.4K   Feb  5 2024 00:37 rev. 49  Scripts/wm_status.sh
-rwxr-xr-x 1 1.7K   Aug 20 2023 20:43 rev. 7   Scripts/xrandr_cycle.sh
-rwxr-xr-x 1 2.7K   Jan 31 2024 17:59 rev. 34  Scripts/xwin_decor.sh
-rwxr-xr-x 1 1.4K   Dec  3 2021 23:13 rev. 19  Scripts/xwin_webm.sh
-rwxr-xr-x 1 3.0K   Dec 13 2021 02:28 rev. 17  Scripts/xwin_widgets.sh
-rw-r--r-- 1 2.0K   Mar 12 2022 17:16 rev. 5   Userscripts/youtube_screenshot.user.js
-rw-r--r-- 1  44K   Mar 20 2024 23:40 rev. 213 readme.md