Technical Stuff
Remove the fish greeting
The greeting text when starting the fish shell is friendly and nice. But after seeing it a couple of times you get tired of it. To remove the greeting set the fish_greeting
variable to an empty list in ~/.config/fish/config.fish
:
set fish_greeting
Alternatively create a universal variable:
set -U fish_greeting
Check out the fish documentation for more details.
Default desktop environment for Xorg in CentOS 8
According to /etc/X11/xinit/Xclients
if there is a file named /etc/sysconfig/desktop
it is sourced for a variable called PREFERRED. The Xclients file has support for the strings "GNOME", "MATE", "KDE" and "LXDE" by default. You can specify the path to the init script of other desktops in the PREFERRED variable. Let's take XFCE as an example:
PREFERRED="$(type -p startxfce4)"
Enable vmware tools in Solus
Looks like there's a bug in Solus 4.1 with Budgie desktop environment preventing the vmtools from working properly. Vmtools can be enabled again by restarting the vmtoolsd service. To do this at startup for the current user a Desktop entry can be created in ~/.config/autostart
. For example a file named restart_vmtoolsd.desktop with the following contents:
[Desktop Entry]
Name=RestartVmtoolsd
GenericName=Restart the vmtoolsd service
Comment=This is a work-around
Exec=sudo systemctl restart vmtoolsd.service
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true
I should note that I have added the following line to sudoers to make this work (as my user belongs to the sudo group):
%sudo ALL=NOPASSWD: /bin/systemctl
Disable the bell in a Manjaro/Arch VM
Add the following to ~/.xprofile
:
xset -b
Resetting the desktop background image in Manjaro i3
When running Manjaro i3 in a VM, changing the screen size often (always?) results in a distorted desktop background image. It will be drawn in a tiled rather than filled manner. Restoring the desktop background image can be done with nitrogen
:
nitrogen --restore
Activate adblock in qutebrowser
This one is easy to forget. Activate adblock in qutebrowser like this:
:adblock-update
Manually mount a shared folder in a VMWare Linux guest
If the shared folder has not been mounted automatically this is how it's done for Linux Kernel 4.0 and later:
vmhgfs-fuse .host:/shared /mnt/hgfs/shared -o subtype=vmhgfs-fuse
Refer to Mounting Shared Folders in a Linux Guest.
Create symbolic links in Windows 10
PowerShell can create symbolic links. It's really annoying that it isn't simpler than this in Windows:
New-Item -ItemType SymbolicLink -Path <link_name> -Target <target>
or in a shorter form:
ni <link_name> -i SymbolicLink -ta <target>
Note: I could not get mklink
working in CMD.
Setup Flutter on Linux (using Manjaro Linux and Fish)
Install the flutter snap
sudo snap install flutter --classic
De-googlify as best we can
flutter config --no-analytics
dart --disable-analytics
Add the Brave browser as the chrome executable
In your fish config:
set -x CHROME_EXECUTABLE /usr/bin/brave
Or create a universal variable:
set -U CHROME_EXECUTABLE /usr/bin/brave
Install Android Studio IDE and the Android SDK command-line tools
In Android Studio, enter settings and go to "Appearance & Behavior" > "System settings" > "Android SDK". In the "SDK Tools" tab make sure "Android SDK Command-line Tools" is checked.
Install the Flutter and Dart plugins
In Android Studio, go to Settings > Plugins. Select Marketplace and search for and install the Flutter plugin. Android Studio will ask you to also install the Dart plugin, do it.
Accept all the SDK package licenses
flutter doctor --android-licenses
Check that everything is set up OK
flutter doctor
Install Kali Desktop In WSL2
Install Kali Linux for WSL2 and update the system:
sudo apt update
sudo apt full-upgrade -y
Install the win kex package (takes a while):
sudo apt install -y kali-win-kex
Install the default desktop metapackage (takes a while):
sudo apt install -y kali-linux-default
Start kex in Window mode (VNC):
kex --win
Start kex in Enhanced Session Mode (RDP):
kex --esm --ip
Start kex in Seamless mode (Windows X server):
kex --sl
Add -s
for sound support in all modes.
Enable Advanced Mouse In VMWare Guest
By default only a basic mouse is enabled in the guest OS (with three buttons). To enable advanced mice one have to edit the vmx file for the virtual machine. Shut down the VM and add the following to the vmx file:
mouse.vusb.enable = "TRUE"
mouse.vusb.useBasicMode = "FALSE"
Add Custom App Launcher in Ubuntu
Create a .desktop file in ~/.local/share/applications for the application. For example:
[Desktop Entry]
Type=Application
Name=p4merge
Icon=<path_to_p4merge>/lib/P4VResources/icons/p4merge.svg
Terminal=false
Exec=<path_to_p4merge>/bin/p4merge
If the application comes with multiple icon resolutions, place them in the correstponding folder under ~/.local/share/icons/. For example:
me@home ~/.l/s/icons> tree
.
└─ hicolor
├─ 128x128
│ └─ apps
│ └─ myapp.png
├─ 16x16
│ └─ apps
│ └─ myapp.png
├─ 256x256
│ └─ apps
│ └─ myapp.png
├─ 32x32
│ └─ apps
│ └─ myapp.png
├─ 512x512
│ └─ apps
│ └─ myapp.png
└─ 64x64
└─ apps
└─ myapp.png
The Icon entry in the .desktop file should look like this instead of a full path to the file:
Icon=myapp
Notice that, in some cases, when you launch a custom desktop application the correct icon will not be visible in the dock and it is not possible to add the application to the favorites. This can happen when the StartupWMClass does not match with the WMClass of the application.
To fix this an entry named StartupWMClass can be added to the .desktop file. To find out the actual StartupWMClass of the application you can use the xprop tool.
- Start the custom application
- Run
xprop WM_CLASS
- Place the cursor over the custom application window and click. You should get a list of one or more WM_CLASS strings.
In the p4merge example this was returned on Ubuntu 20.04.3:
WM_CLASS(STRING) = "p4merge.bin", "Helix Merge"
The .desktop file for p4merge was updated to look like this:
[Desktop Entry]
Type=Application
Name=p4merge
Icon=<path_to_p4merge>/lib/P4VResources/icons/p4merge.svg
Terminal=false
Exec=<path_to_p4merge>/bin/p4merge
StartupWMClass=Helix Merge
Add Gerrit Commands to Sublime Merge
Add the following to "~/.config/sublime-merge/Packages/User/Default.sublime-commands" to be able to push to Gerrit master branch via the command palette:
[
{
"caption": "Push to Gerrit - for review",
"command": "git",
"args": {"argv": ["push", "origin", "HEAD:refs/for/master"]}
},
{
"caption": "Push to Gerrit - WIP",
"command": "git",
"args": {"argv": ["push", "origin", "HEAD:refs/for/master%wip"]}
},
{
"caption": "Push to Gerrit - WIP ready for review",
"command": "git",
"args": {"argv": ["push", "origin", "HEAD:refs/for/master%ready"]}
},
{
"caption": "Push to Gerrit - private",
"command": "git",
"args": {"argv": ["push", "origin", "HEAD:refs/for/master%private"]}
},
{
"caption": "Push to Gerrit - remove private",
"command": "git",
"args": {"argv": ["push", "origin", "HEAD:refs/for/master%remove-private"]}
}
]
VMWare Guest Window Resolution Autofit
Arch based distros might have problems with adapting the resolution to the window size on the host after boot. If this is resolved by restarting the vmtoolsd service the solution to the problem could be to add a couple of kernel modules to the initramfs. This will let them be loaded before any boot hooks are run. See Archwiki - autofit problems and Archwiki - mkinitcpio.
Edit /etc/mkinitcpio.conf and add the following kernel modules:
MODULES=(vsock vmw_vsock_vmci_transport vmw_balloon vmw_vmci vmwgfx)
Then regenerate the initramfs:
sudo mkinitcpio -P
Fix the Powerlevel10k ZSH Bug
In Manjaro Plasma edition there's a bug in the powerlevel10k ZSH prompt theme. It doesn't show the git status correctly. There is a missing character at the end of the status string. I copied the theme scripts to my local share folder.
mkdir -p ~/.local/share/zsh
cp /usr/share/zsh/manjaro-zsh-prompt ~/.local/share/zsh/
cp /usr/share/zsh/p10k-portable.zsh ~/.local/share/zsh/
cp /usr/share/zsh/p10k.zsh ~/.local/share/zsh/
In ~/.zshrc I make sure to reference my version of manjaro-zsh-prompt.
# Use my modified manjaro zsh prompt
if [[ -e ~/.local/share/zsh/manjaro-zsh-prompt ]]; then
source ~/.local/share/zsh/manjaro-zsh-prompt
fi
In manjaro-zsh-prompt the references to p10k.zsh and p10k-portable.zsh must be to my versions as well:
if [[ $USE_POWERLINE == false ]]; then
# Use 8 colors and ASCII.
source ~/.local/share/zsh/p10k-portable.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=black,bold'
else
# Use 256 colors and UNICODE.
source ~/.local/share/zsh/p10k.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=244'
fi
And in both p10k zsh files I added the fix in the end of the my_git_formatter function. The fix is a missing space in the res variable. This should be added just before my_git_format is set to res in the end of the function:
res+=" " <---add this
typeset -g my_git_format=$res
}
I picked up this fix from the Manjaro forum.
Enable Hyper-V Enhanced Session and Integration Services for Manjaro
Create a Manjaro virtual machine in Hyper-V Manager. Install the hyperv package and enable the services.
sudo pamac install hyperv
systemctl enable --now hv_fcopy_daemon.service
systemctl enable --now hv_kvp_daemon.service
systemctl enable --now hv_vss_daemon.service
Enable enhanced session mode by utilizing Xrdp and the hv_sock kernel module.
git clone https://github.com/microsoft/linux-vm-tools
cd linux-vm-tools/arch
./makepkg.sh
./install-config.sh
Edit ~/.xinitrc
and remove "--exit-with-session" from the line "local dbus_args=(--sh-syntax --exit-with-session)". Shut down the virtual machine. On the Windows host enable hv_sock on the virtual machine by using powershell as admin:
Set-VM -VMName <name> -EnhancedSessionTransportType HvSocket
The next time a connection is made to the virtual machine it will enable enhanced session. Disable enhanced session by using powershell as admin:
Set-VM -VMName <name> -EnhancedSessionTransportType VMBus
Disable Samsung Nvme From Going Cold During Sleep
I have a Tuxedo computer with a nvme ssd from Samsung. The computer will hang after waking up from sleep probably since the ssd has lost power during the nap. This can be prevented with a udev rule.
cat /etc/udev/rules.d/99-pulse1502-samsung-nvme.rules:
SUBSYSTEM=="pci", ACTION=="add", ATTR{vendor}=="0x144d", ATTR{device}=="0xa80a", RUN+="/bin/sh -c 'echo 0 | tee /sys/bus/pci/devices/$kernel/d3cold_allowed'"
SUBSYSTEM=="pci", ACTION=="add", ATTR{vendor}=="0x144d", ATTR{device}=="0xa808", RUN+="/bin/sh -c 'echo 0 | tee /sys/bus/pci/devices/$kernel/d3cold_allowed'"
Automount a NFS Share via SystemD
This is great for laptops as you can set sane timeouts to let SystemD unmount the file system when idle.
cat /etc/fstab
<ip_address>:/photos /mnt/photos nfs _netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
Set Up Windows 11 Without Internet
You install Windows 11 and for some reason don't have access to Internet. It might be due to missing drivers or that you don't want to or can have access. During installation you will get a message saying that you've lost internet connection. Open cmd with shift + F10 and type OOBE\BYPASSNRNO
. Your computer will restart and you will have the option to click "I don't have internet". Your installation can continue. This was found here