Passing Xauth to another user
Run in the source user:
xauth list
Copy paste the output, then run as the destination user
xauth add <output of the previous command as-is, including spaces>
Persist VIM cursor position
Add to vimrc/init.vim:
autocmd BufReadPost * silent! normal! g`"zv
Source (stackoverflow)
Scale any GTK application
Run the app with the env var GDK_SCALE
Do note it's GDK, not GTK. GDK is a low-level UI library used by GTK.
Example:
GDK_SCALE=2 gajim
Do not mangle clipboard while pasting in VIM
To not mangle the clipboard contents while pasting in visual mode in order to replace the selected text
Add to vimrc/init.vim:
xnoremap p pgvy
Disable pipewire on Arch Linux
Having both pipewire and pulseaudio enabled might cause issues, when pipewire takes hold of the sound device and borks.
On Arch Linux, pipewire gets pulled as a dependency of a few random pieces of software (such as obs studio),
and includes an auto-activation socket file.
Run the following as your user, to mask the service and activation socket:
systemctl mask --user pipewire.socket pipewire
Restore a deleted file from a running process
When a file gets deleted, it is only unliked, the underlying inode
(the thing that actually stores the data of the file) is left untouched until no more links are present.
The file descriptor table of a process maps numerical ids of opened files (file descriptors, fds) to inodes.
[ity@ity-pc ~]$ ls -l /proc/1958123/fd
total 0
lrwx------ 1 ity ity 64 Nov 20 18:34 0 -> /dev/pts/4
lrwx------ 1 ity ity 64 Nov 20 18:34 1 -> /dev/pts/4
lrwx------ 1 ity ity 64 Nov 20 18:34 2 -> /dev/pts/4
lr-x------ 1 ity ity 64 Nov 20 18:34 3 -> '/home/ity/Tests/config.txt (deleted)'
One can then simply for example cat
the appropriate file descriptor in procfs back in:
cat /proc/1958123/fd/3 > /home/ity/Tests/config.txt
TODO figure out, if since the directory entry got a new inode, there are any unexpected consequences (such as the file not updating on currently opened processes when edited), and if there is a way to restore the link.
Confirm each replace in VIM
https://vi.stackexchange.com/questions/373/can-i-do-an-interactive-substitute-search-replace
Mapping obscure keys in VIM
https://vi.stackexchange.com/questions/2350/how-to-map-alt-key