From: Niki Roo Date: Tue, 30 Jul 2024 21:31:15 +0000 (+0200) Subject: add Tech X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=HEAD;p=notes.git add Tech --- diff --git a/Tech/SteamDeck/docker.md b/Tech/SteamDeck/docker.md new file mode 100644 index 0000000..4e01520 --- /dev/null +++ b/Tech/SteamDeck/docker.md @@ -0,0 +1,10 @@ +# Docker + +To enable docker, configure the storage driver in `/etc/docker/daemon.json`: + +```json +{ + "storage-driver": "fuse-overlayfs" +} +``` + diff --git a/Tech/SteamDeck/fix_victor_vran.sh b/Tech/SteamDeck/fix_victor_vran.sh new file mode 100644 index 0000000..7298dfc --- /dev/null +++ b/Tech/SteamDeck/fix_victor_vran.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +################################ +# Victor Vran Installation Fix # +################################ + +if [ "$1" = "" ]; then + echo You must choose: debian or steamos >&2 + exit 1 +fi + +if [ "$USER" != root ]; then + echo Requires root access >&2 + exit 2 +fi + +if [ "$1" = debian ]; then + echo Debian installation... + apt-get install -y libcurl3-gnutls:i386 libopenal1:i386 libxt6:i386 + cd /usr/lib/i386-linux-gnu + ln -s libgcrypt.so.20 libgcrypt.so + ln -s libgcrypt.so libgcrypt.so.11 + cd - >/dev/null +elif [ "$1" = steamos ]; then + echo SteamOS installation... + steamos-readonly disable + #pacman-key --init + #pacman-key --populate archlinux + #pacman -Sy + pacman -S lib32-libcurl-gnutls lib32-libxrandr lib32-libxt lib32-sdl2 lib32-nettle lib32-gnutls lib32-gmp + cd /usr/lib32 + ln -s libgcrypt.so libgcrypt.so.11 + cd - >/dev/null + steamos-readonly enable +else + echo Unknown system: "$1" >&2 + exit 3 +fi + +echo +echo Note: remember to disable the i386 LD_LIBRARY_PATH +echo diff --git a/Tech/SteamDeck/game-mode.md b/Tech/SteamDeck/game-mode.md new file mode 100644 index 0000000..73145db --- /dev/null +++ b/Tech/SteamDeck/game-mode.md @@ -0,0 +1,12 @@ +# Game Mode + +I don't know if you still need help with this but maybe someone else does. +Konsole is a Qt application so it uses the standard Qt command line options to set window geometry: +LD_PRELOAD=${LD_PRELOAD/_32/_64} QT_SCALE_FACTOR=1.25 %command% --fullscreen --notransparency --new-tab --hide-menubar --qwindowgeometry 1024x640 + +I scale it from a lower resolution because that's what Valve does with the default Google Chrome installation. I disable the menubar because navigating menus is too hard anyway. The string substitution on LD_PRELOAD is to prevent the linker from loading the 32 bit version of the steamoverlay library, which would cause a wrong ELF class error since Konsole is 64 bit. + +I did the same with Elisa, a media player, which is also a Qt application. However, Elisa is a Flatpak, so you have to set environment variables with an option: +run --branch=stable --arch=x86_64 --command=elisa --env=QT_SCALE_FACTOR=1.25 --file-forwarding org.kde.elisa @@u @@ --qwindowgeometry 1024x640 + +I don't do this anymore because I ended up pairing my phone via Bluetooth to play music on the Deck. It's still useful to know because there are other useful Qt applications that you might want to apply this to, like KeePassXC or Kate. diff --git a/scaling.md b/Tech/SteamDeck/scaling.md similarity index 100% rename from scaling.md rename to Tech/SteamDeck/scaling.md diff --git a/Tech/SteamDeck/unlock.sh b/Tech/SteamDeck/unlock.sh new file mode 100755 index 0000000..84408f2 --- /dev/null +++ b/Tech/SteamDeck/unlock.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ "$USER" != root ]; then + echo Requires root access >&2 + exit 2 +fi + +steamos-readonly disable + +if [ "$INIT" = 1 ]; then + pacman-key --init + pacman-key --populate archlinux + pacman -Sy +fi + +pacman -S imagemagick +pacman -S docker +pacman -S linux-neptune-61-headers # for VBox +pacman -S virtualbox virtualbox-host-dkms virtualbox-guest-iso + +steamos-readonly enable + +modprobe vboxdrv + +echo If it failed, you may want to try again with INIT=1 diff --git a/color-theme.md b/Tech/color-theme.md similarity index 100% rename from color-theme.md rename to Tech/color-theme.md diff --git a/git.md b/Tech/git.md similarity index 100% rename from git.md rename to Tech/git.md diff --git a/mp4.md b/Tech/mp4.md similarity index 100% rename from mp4.md rename to Tech/mp4.md diff --git a/Tech/qemu.md b/Tech/qemu.md new file mode 100755 index 0000000..ac6b4c7 --- /dev/null +++ b/Tech/qemu.md @@ -0,0 +1,159 @@ +# Qemu + +Qemu can be started with: +* `qemu-kvm`: old versions of qemu, with KVM support +* `qemu`: old version of qemu +* `qemu-system-i386`: recent version, i386 mode +* `qemu-system-x86_64`: recen version, AMD64 mode + +## Disk file + +### Create a disk file + +Unless you use ISO files or `dd`-created raw files, you may want to use `qemu-img`. + +Some examples: +* `qemu-img create base.raw 2G` +* `qemu-img create -f qcow2 extra.qcow2 -b base.raw -F qcow2` + +The format can be forced with `-f [fmt]` (default is `raw`): +* recent formats: `raw`, `qcow2` +* legacy and third-party formats: `vmdk`, `vdi`, `vhd`, `vhdx`, `qcow1`, `qed` + +Snapshot mode: create a new disk with a base image: +* `-b base.img`: the base image will be the main disk, but changes will be written tio the new one +* `-F qcow2`: backing image format is qcow2 + +### Convert a disk file + +Converting an image can be done with `qemu-img convert`: +* `qemu-img convert input_file output_file` +* `qemu-img convert input_file1 input_file2... output_file`: for special multi-files input formats +* `qemu-img convert -c [...]`: add compression (on conversion, not on usage: you may want to re-apply it once in a while) + +The format can be forced with: +* `-f [fmt]`: input format +* `-O [fmt]`: output format + +The default format is `raw`), but you may choose between: +* recent formats: `raw`, `qcow2` +* legacy and third-party formats: `vmdk`, `vdi`, `vhd`, `vhdx`, `qcow1`, `qed` + +### Access the disk file (raw mode) from the Host + +You need to setup the loopback device to access such a file. +It can be easier if you setup your `fstab` for it. + +Your system must configure the loopback device with partitions support (i.e., `rc.local`): +* `modprobe -r loop` +* `modprobe loop max_part=8` + +Operations: +* `losetup file.raw /dev/loop0` +* `mount /dev/loop0p1 /mnt/loop/loop1` +* work in the mounted fs +* `umount /mnt/loop/loop1` +* `losetup -d /dev/loop0` + +### Use a disk file + +* to add: -snapshot # discard writes (beware of ctrl+a, S : write back!) + +no snapshot with blockdev... + + + +set -- "$@" -drive file="$disk2",index=1,media=disk,format=raw + +HDD="-hda $NAME.img" +HDD="-blockdev driver=raw,node-name=disk,file.driver=file,file.filename=$NAME.img" + +#### Floppy + +-drive file=/path/to/floppy.img,index=0,if=floppy,format=raw + +-blockdev driver=file,node-name=f0,filename=/path/to/floppy.img -device floppy,drive=f0 + +#### Cdrom + +Old (still compatible) version: +* `-cdrom cd.iso` + +#-hdb fat:rw:/tmp/fat # ?? + +## Graphics adapter + +You can choose your graphics adapter via the `-vga` switch: +* `-vga qxl` : QXL virtio via spice (recent) +* `-vga virtio` : normal virtio +* `-vga vmware` : VMWare SVGA-II compatible +* `-vga std` : XP+ +* `-vga cirrus` : old card, 256 colours + +Note that regarding performances, the graphics adapter is one thing, the display is another. Even an old DOS game can be unbearably slow if you use software rendering to process its graphics output. + +* `-display sdl`: more or less required if you do any graphical thing + +## Sound + +SOUND="-soundhw all" # old versions +SOUND="-audiodev pipewire,id=qemu" + +snd= pa, pipewire, alsa, sdl... + +set -- "$@" -machine pcspk-audiodev="$snd" +set -- "$@" -audiodev "$snd",id="$snd" +set -- "$@" -device adlib,audiodev="$snd" -device sb16,audiodev="$snd" + +## Network + +NET="-net none" + +## Miscallenaous options + +-machine accel=kvm,XXX + +RAM="-m 64m" + + -boot order=dac -k fr-be -usb -usbdevice tablet -serial stdio -name "$NAME" + +## Script + +```sh +#!/bin/sh + +NAME=`basename "$PWD"` + +DISK1="$NAME".hdc +DISK2="$NAME".hdd +CDROM="$NAME".iso +FLOPPY="$NAME".fdd + +[ "$SND" = "" ] && SND=pipewire +[ "$RAM" = "" ] && RAM=64m + +set -- +set -- "$@" -machine accel=kvm +set -- "$@" -machine pcspk-audiodev="$SND" +set -- "$@" -audiodev "$SND",id="$SND" +set -- "$@" -device adlib,audiodev="$SND" -device sb16,audiodev="$SND" +set -- "$@" -boot order=dac +set -- "$@" -m $RAM +set -- "$@" -name "$NAME" +set -- "$@" -display sdl +if [ -e "$FLOPPY" ]; then + set -- "$@" -drive file="$FLOPPY",index=0,if=floppy,format=raw +fi +if [ -e "$DISK1" ]; then + set -- "$@" -drive file="$DISK1",index=1,media=disk,format=raw +fi +if [ -e "$DISK2" ]; then + set -- "$@" -drive file="$DISK2",index=2,media=disk,format=raw +fi +if [ -e "$CDROM" ]; then + set -- "$@" -drive file="$CDROM",index=3,media=cdrom,format=raw +fi + +echo qemu-system-i386 "$@" +qemu-system-i386 "$@" +``` \ No newline at end of file diff --git a/Tech/scaling.md b/Tech/scaling.md new file mode 100644 index 0000000..16ad0a9 --- /dev/null +++ b/Tech/scaling.md @@ -0,0 +1,141 @@ +# Linux display + +This iis detailed in depth on [how does Linux's display works?](https://unix.stackexchange.com/questions/596894) QA. + +On most desktops system (like KDE or Gnome) there are settings available on their respective settings panel, this guide is for additional/manual settings that can be applied to scale an application or the whole desktop. This [reference article](https://wiki.archlinux.org/index.php/HiDPI) have many valuable informations for the matter. + +## Scaling applications + +Scaling application can be done mainly via [DPI](https://unix.stackexchange.com/questions/596765/is-x-dpi-dot-per-inch-setting-just-meant-for-text-scaling), specific environment variable (explained bellow), application own setting or some specific desktop setting (out of scope of this QA). + +* Qt applications can be scaled with the following environment variables, note that many applications are hard-coding sizing and font and thus the result on such app may not be as expected: + +```sh + export QT_AUTO_SCREEN_SET_FACTOR=0 + export QT_SCALE_FACTOR=2 + export QT_FONT_DPI=96 +``` + +* Gnome/GTK applications can be scaled with the following environment variables: + +```sh + export GDK_SCALE=2 + export GDK_DPI_SCALE=0.5 +``` + +* Gnome/GTK can as well be scaled globally with this Gnome setting: + +```sh + gsettings set org.gnome.desktop.interface text-scaling-factor 2.0 +``` + +* Chromium, can be scaled with the following command: + +```sh + chromium --high-dpi-support=1 --force-device-scale-factor=1.5 +``` + +* [Xpra](https://en.wikipedia.org/wiki/Xpra) (python) can be used along with i[Run scaled](https://github.com/kaueraal/run_scaled/blob/master/run_scaled) to achieve a per app scaling. + +* Environment variables modification can be placed in `~/.profile` for a global and automatic appliance after login. + +## Scaling the desktop with Xorg X11 + +[Xorg](https://wiki.archlinux.org/index.php/Xorg)'s extension RandR have a scaling feature and can be configured with [`xrandr`](https://wiki.archlinux.org/index.php/Xrandr). This can be used to scale the desktop to display a bigger environment, this can be useful for HiDPI (High Dots Per Inch) displays. + +RandR **can also be used the other way around**, example making a screen with 1366x768 max resolution support a greater resolution like 1920x1080. This is achieved by simulating the new greater resolution while rendering it for the supported max resolution, similar to when we watch a Full-HD video on a screen that is not Full-HD. + +## Scaling the desktop without changing the resolution + +* Getting the screen name: + +```sh + xrandr | grep connected | grep -v disconnected | awk '{print $1}' +``` + +* Reduce the **screen size** by 20% (zoom-in): + +```sh + xrandr --output screen-name --scale 0.8x0.8 +``` + +* Increase the **screen size** by 20% (zoom-out): + +```sh + xrandr --output screen-name --scale 1.2x1.2 +``` + +* Reset `xrandr` changes: + +```sh + xrandr --output screen-name --scale 1x1 +``` + +## Scaling the desktop and simulate/render a new resolution + +When using `xrandr` to "zoom-in" with the **previous method**, the desktop remain full screen but when we "zoom-out" with for instance `xrandr --output screen-name --scale 1.2x1.2` (to get an unsupported resolution) the desktop is not displayed in full screen because this require updating the resolution (to probably a higher unsupported resolution by the screen), we can use a combinaison of `--mode`, `--panning` and `--scale`, xrandr's parameters to achieve a full screen "zoom-out" scaling (simulate a new resolution), example: + +* Get the current setup: + +```sh + xdpyinfo | grep -B 2 resolution + # or + xdpyinfo +``` + +* Configuration example: + +``` + Scaling at: 120% + Used/max screen resolution: 1366 x 768 + Resolution at 120% (res x 1.2): 1640 x 922 (round) + Scaling factor (new res / res): 1.20058565 x 1.20208604 +``` + +* The idea here is to increase the screen resolution virtually (because we are limited to 1366x768 physically) the command would be (replace screen-name): + +```sh + xrandr --output screen-name --mode 1366x768 --panning 1640x922 --scale 1.20058565x1.20208604 +``` + +* Reset the changes with: + +```sh + xrandr --output screen-name --mode 1366x768 --panning 1366x768 --scale 1x1 + + # restarting the desktop may be required example with KDE + # kquitapp5 plasmashell + # plasmashell & +``` + +## Making xrandr changes persistent + +There is a multitude of methods to make `xrandr` changes persistent, [this](https://unix.stackexchange.com/questions/125556/how-can-i-make-xrandr-changes-persist) and [this](https://askubuntu.com/questions/63681/how-can-i-make-xrandr-customization-permanent) QA have many examples. + +## Experiments notes + +As a side note and experiments result while using SDDM + KDE, and after many tests to achieve a persistent config, I ended up loading a script with `~/.config/autostart` (`systemsettings5` > Startup... > Autostart), and naming my script `00-scriptname` to make it run first. + +```sh +# 00-scriptname + +# Applying the main xrandr suited changes (scaling at x1.15) + +xrandr --output eDP1 --mode 1366x768 --panning 1574x886 --scale 1.15226939x1.15364583 + +# This is where it get odd/complicated, sometimes the screen resolution is not applied correctly or not applied at all... +# Note that "xrandr --fb" can be used alone to change the screen resolution on a normal situation... +# Here we will be taking advantage of xrandr's "--fb" feature to make the config appliance stable and works every-time. + +# The odd thing here is while re-applying the new resolution 1574x886 with "--fb" nothing happen, but +# if we use use an unsupported resolution like 1574x884 (vs 1574x886) then xrandr force the resolution +# to "reset itself" to the configured resolution (1574x886)... + +# In short just re-apply the setting with "--fb" and an unsupported resolution to force a reset. +# ("--fb" can be used alone here without re-applying everything) + +#xrandr --fb 1574x884 +xrandr --fb 1574x884 --output eDP1 --mode 1366x768 --panning 1574x886 --scale 1.15226939x1.15364583 +``` + + diff --git a/web-css.md b/Tech/web-css.md similarity index 100% rename from web-css.md rename to Tech/web-css.md diff --git a/index.md b/index.md index 3dc12bc..6c5b97e 100644 --- a/index.md +++ b/index.md @@ -3,12 +3,17 @@ Some documentation: * Phone: - * [Framagenda](/Phone/Framagenda) + * [Framagenda](/Phone/Framagenda) * Politique: -* [Le droit d'asile (France)](/Politique/Le%20droit%20d%27asile%20pour%20les%20nuls) -* [color-theme](/color-theme) -* [git](/git) -* [mp4](/mp4) -* [scaling](/scaling) -* [web-css](/web-css) + * [Le droit d'asile (France)](/Politique/Le%20droit%20d%27asile%20pour%20les%20nuls) +* Tech: + * [Dark-Olympic](/Tech/color-theme) + * [Git](/Tech/git) + * [MP4 Conversion](/Tech/mp4) + * [Linux display](/Tech/scaling) + * [Web css](/Tech/web-css) + * SteamDeck: + * [Docker](/Tech/SteamDeck/docker) + * [Scaling](/Tech/SteamDeck/scaling) + * [Game Mode](/Tech/SteamDeck/game-mode) diff --git a/mkdocs/site b/mkdocs/site index 51b84c7..58d1fed 160000 --- a/mkdocs/site +++ b/mkdocs/site @@ -1 +1 @@ -Subproject commit 51b84c72be735fd8efcb880b1af1e9aac4ac4dc8 +Subproject commit 58d1fed77c89324fdbef2900ddbadf385255b293