Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/strix007/wsl

My wsl config
https://github.com/strix007/wsl

emacs lf linux shell vim wsl zathura zsh zsh-plugin

Last synced: about 21 hours ago
JSON representation

My wsl config

Awesome Lists containing this project

README

        

#+TITLE: Arbab Khan’s Dotfiles
#+AUTHOR: Arbab Khan
#+EMAIL: [email protected]
#+DESCRIPTION: These are the dotfiles for my arch wsl instance.

* WSL Configuration Of Arbab Khan:noexport:
This is my WSL configuration for my arch WSL instance.

* Table of Contents
:PROPERTIES:
:TOC: :include all :ignore this
:END:
:CONTENTS:
- [[#caution][Caution]]
- [[#about][About]]
- [[#what-to-install][What To Install]]
- [[#windows-11][Windows 11]]
- [[#wsl][WSL]]
- [[#shell][Shell]]
- [[#tmux][Tmux]]
- [[#neovim][NeoVim]]
- [[#lf][lf]]
- [[#fzf][fzf]]
- [[#mpd][MPD]]
- [[#emacs][Emacs]]
- [[#setup-instructions][Setup Instructions]]
- [[#windows][Windows]]
- [[#wezterm][WezTerm]]
- [[#vcxsrv][VcXsrv]]
- [[#firewall][Firewall]]
- [[#startup][Startup]]
- [[#blurry-fonts][Blurry Fonts]]
- [[#shortcut][Shortcut]]
- [[#archwsl][ArchWSL]]
- [[#systemd][Systemd]]
- [[#emacs-daemon][Emacs Daemon]]
- [[#contributing][Contributing]]
:END:

* Caution
:PROPERTIES:
:CUSTOM_ID: caution
:END:

I have not tested these dotfiles on other WSL distributions and am not sure how will they work.

You also need to do simple little tweaks here and there to get things working, there are too many to list but they are simple enough that a simple google search should help you.

* About
:PROPERTIES:
:CUSTOM_ID: about
:END:

This is a very basic configuration for WSL2 on Windows 11 using [[https://github.com/yuk7/ArchWSL][yuk7's ArchWSL]].

This configuration also heavily relies on [[https://aalonso.dev/blog/how-to-use-gui-apps-in-wsl2-forwarding-x-server-cdj][Aitor Alono's article on how to use GUI apps in WSL2]].

This configuration uses WezTerm on the Windows side to spawn directly into the WSL instance without going through powershell though any terminal can work.

* What To Install
:PROPERTIES:
:CUSTOM_ID: what-to-install
:END:
** Windows 11
:PROPERTIES:
:CUSTOM_ID: windows-11
:END:
- [[https://learn.microsoft.com/en-us/windows/wsl/install][WSL2]]
- [[https://wezfurlong.org/wezterm/install/windows.html][WezTerm]]
- [[https://github.com/VSWSL/Arch-WSL#Installation][Arch-WSL]]
- [[https://github.com/ryanoasis/nerd-fonts#font-installation][Nerd Font]]
- [[https://sourceforge.net/projects/vcxsrv][VcXsrv]]
** WSL
:PROPERTIES:
:CUSTOM_ID: wsl
:END:
*** Shell
:PROPERTIES:
:CUSTOM_ID: shell
:END:
- [[https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH][Zsh]]
- [[https://getantidote.github.io/install][Antidote]]
- [[https://github.com/junegunn/fzf#installation][fzf]]
- [[https://github.com/jstkdng/ueberzugpp][ueberzug++]]
- [[https://github.com/eza-community/eza][eza]]
- [[https://github.com/ajeetdsouza/zoxide#installation][zoxide]]
- [[https://github.com/mozilla/sccache#installation][sccache]]
- [[https://github.com/4U6U57/wsl-open][wsl-open]]
- [[https://github.com/laurent22/wslpath][wslpath]]
- [[https://github.com/nullpo-head/WSL-Hello-sudo][WSL-Hello-sudo]]
*** Tmux
:PROPERTIES:
:CUSTOM_ID: tmux
:END:
- [[https://github.com/tmux/tmux][tmux]]
- [[https://github.com/tmux-plugins/tpm][tpm]]
- [[https://github.com/mikefarah/yq][yq]]
- [[https://github.com/junegunn/fzf#installation][fzf]]
- [[https://github.com/ajeetdsouza/zoxide][zoxide]]
- [[https://github.com/facebook/pathpicker/][fpp]]
- [[https://github.com/golang/go][go]]
*** NeoVim
:PROPERTIES:
:CUSTOM_ID: neovim
:END:
- [[https://github.com/neovim/neovim/wiki/Installing-Neovim][neovim]]
- [[https://www.gnu.org/software/make/#download][make]]
- [[https://github.com/mah0x211/lua-pcre2][lua-pcre2]]
*** lf
:PROPERTIES:
:CUSTOM_ID: lf
:END:
- [[https://github.com/gokcehan/lf][lf]]
- [[https://github.com/junegunn/fzf#installation][fzf]]
- [[https://github.com/jstkdng/ueberzugpp][ueberzug++]]
- [[https://github.com/andreafrancia/trash-cli][trash-cli]]
- [[https://github.com/sharkdp/bat#installation][bat]]
- [[https://github.com/dirkvdb/ffmpegthumbnailer][ffmpegthumbnailer]]
- [[https://imagemagick.org/script/download.php][imagemagick]]
- [[https://poppler.freedesktop.org/][poppler]]
- [[https://github.com/marianosimone/epub-thumbnailer][epub-thumbnailer]]
- [[https://wkhtmltopdf.org/downloads.html][wkhtmltopdf]]
- [[https://github.com/hpjansson/chafa#Installing][chafa]]
*** fzf
:PROPERTIES:
:CUSTOM_ID: fzf
:END:
- [[https://github.com/hpjansson/chafa#Installing][chafa]]
- [[https://github.com/jstkdng/ueberzugpp][ueberzug++]]
- [[https://stedolan.github.io/jq][jq]]
- [[https://github.com/eza-community/eza][eza]]
- [[https://sourceforge.net/projects/w3m/][w3m]]
- [[https://github.com/charmbracelet/glow][glow]]
- [[https://github.com/transmission/transmission][transmission-cli]]
- [[https://github.com/sharkdp/bat#installation][bat]]
*** MPD
:PROPERTIES:
:CUSTOM_ID: mpd
:END:
- [[https://mpd.readthedocs.io/en/stable/user.html][mpd]]
- [[https://github.com/MusicPlayerDaemon/mpc][mpc]]
- [[https://rybczak.net/ncmpcpp/installation][ncmpcpp]]
*** Emacs
:PROPERTIES:
:CUSTOM_ID: emacs
:END:
Under WSLg, you would need to compile emacs yourself with =pgtk= and =native-comp= but due to some hibernation issues I faced with WSLg, I switched over to forwarding a X server with VcXsrv. So you don’t need to compile emacs from scratch anymore, but it is still the prefered method to install emacs as compared to a distro repository.
#+begin_example
# Install the necessary developement tools
sudo pacman -S base-devel git --needed
sudo pacman -S libxpm libjpeg libpng libtiff giflib librsvg libxml2 gnutls gtk3 webkit2gtk --needed
# Clone the Emacs repository
git clone git://git.sv.gnu.org/emacs.git
# cd into the Emacs repository
cd emacs
# Generate build files
./autogen
# Configure the Emacs features per your needs
./configure --with-native-compilation=aot --with-xwidgets --with-tree-sitter --with-json --with-imagemagick --with-mailutils
# Build Emacs
make
# Install Emacs
sudo make install
#+end_example
- [[https://github.com/jgm/pandoc/blob/main/INSTALL.md][pandoc]]

* Setup Instructions
:PROPERTIES:
:CUSTOM_ID: setup-instructions
:END:
** Windows
:PROPERTIES:
:CUSTOM_ID: windows
:END:
*** WezTerm
:PROPERTIES:
:CUSTOM_ID: wezterm
:END:
To setup WezTerm with =wezterm.lua=, after installing wezterm you need to move to move =wezterm.lua= to where you have installed WezTerm, typically =C:\Program Files\WezTerm= . Doing so might require administrator privilages.
*** VcXsrv
:PROPERTIES:
:CUSTOM_ID: vcxsrv
:END:
**** Firewall
:PROPERTIES:
:CUSTOM_ID: firewall
:END:

After VcxSrv is installed, we need to ensure the proper rules for VcxSrv on our firewall. These steps assume you do not have custom firewall rules(like an antivirus). If you do have custom rules set, you may need to configure it manually.

To ensure the proper firewall rules, open =Windows Security= ,go to =Firewall & network protection= -> =Allow an app through firewall= and ensure =VcXsrv windows xserver= has both =Private networks= and =Public networks= permissions.

**** Startup
:PROPERTIES:
:CUSTOM_ID: startup
:END:
To automatically start VcXsrv on startup, move the =Windows/config.xlaunch= file to the =%AppData%\Microsoft\Windows\Start Menu\Programs\Startup= directory and enable it in =TaskManager=
:CUSTOM_ID: startup
:END:

**** Blurry Fonts
:PROPERTIES:
:CUSTOM_ID: blurry-fonts
:END:
If you experience blurry fonts, follow [[https://superuser.com/questions/1370361/blurry-fonts-on-using-windows-default-scaling-with-wsl-gui-applications-hidpi/1550608#1550608][this]] answer.

**** Shortcut
:PROPERTIES:
:CUSTOM_ID: shortcut
:END:
To make a shortcut for any GUI application for VcXsrv, right-click on desktop, click =New= -> =Shortcut= and put the shortcut command as such =C:\Windows\System32\wsl.exe --distribution Arch zsh -ic "/your command here/"=

* ArchWSL
:PROPERTIES:
:CUSTOM_ID: archwsl
:END:
*** Systemd
:PROPERTIES:
:CUSTOM_ID: systemd
:END:
To enable systemd, you need to edit =/etc/wsl.conf= with sudo privileges i.e. =sudo vim /etc/wsl.conf= and add the following lines
#+begin_example
[boot]
systemd=true
#+end_example
and then restart your WSL instance by going into the windows terminal and typing the followin command =wsl --shutdown= and then opening WezTerm.
*** Emacs Daemon
:PROPERTIES:
:CUSTOM_ID: emacs-daemon
:END:
To enable Emacs daemon on WSL, we need to create a systemd user service for the Emacs daemon.
We can do so by the following steps.
**** Create a service unit file for the Emacs daemon
:PROPERTIES:
:CUSTOM_ID: create-a-service-unit-file-for-the-emacs-daemon
:TOC: :ignore this
:END:
=vim ~/.config/systemd/user/emacs.service=
**** Add the following content to the file
:PROPERTIES:
:CUSTOM_ID: add-the-following-content-to-the-file
:TOC: :ignore this
:END:
#+begin_example
[Unit]
Description=Emacs text editor (daemon)

[Service]
Type=forking
ExecStart=/usr/local/bin/emacs --daemon
ExecStop=/usr/local/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Restart=always

[Install]
WantedBy=default.target
#+end_example
**** Reload systemd user manager
:PROPERTIES:
:CUSTOM_ID: reload-systemd-user-manager
:TOC: :ignore this
:END:
=systemctl --user daemon-reload=
**** Enable the systemd user manager
:PROPERTIES:
:CUSTOM_ID: enable-the-systemd-user-manager
:TOC: :ignore this
:END:
=systemctl --user enable emacs.service=

* Contributing
:PROPERTIES:
:CUSTOM_ID: contributing
:END:
If you see me doing anything inefficiently in this config or you think something would be useful to me or you want to correct some error on my part, feel free to open a pull request.