Laptop wakes up automatically on power cable plugging in

It may seem similar to Laptop wakes up automatically in suspended state when charges but it’s somehow different.
In my case the laptop wakes up automatically right on plugging in power cable. It wakes up with black screen (no image) and no reaction on shortcuts (except power button). This usually happens on critically low battery (3-5%): it’s discharged quickly due to bad health and regular blackouts (because of war).

Last errors:

$ journalctl -p 3 -xb
чер 21 22:06:07 roman-pc kernel: x86/cpu: SGX disabled by BIOS.
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: No pointer back to namespace node in package (____ptrval____) (20230628/dsargs-30>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Aborting method \_SB.PCI0.SPI1.FPNT._CRS due to previous error (AE_AML_INVALID_RE>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Method execution failed \_SB.PCI0.SPI1.FPNT._CRS due to previous error (AE_AML_IN>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Aborting method \_SB.PCI0.SPI1.FPNT._CRS due to previous error (AE_AML_INVALID_RE>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Method execution failed \_SB.PCI0.SPI1.FPNT._CRS due to previous error (AE_AML_IN>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Aborting method \_SB.PCI0.SPI2.FPNT._CRS due to previous error (AE_AML_INVALID_RE>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Method execution failed \_SB.PCI0.SPI2.FPNT._CRS due to previous error (AE_AML_IN>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Aborting method \_SB.PCI0.SPI2.FPNT._CRS due to previous error (AE_AML_INVALID_RE>
чер 21 22:06:07 roman-pc kernel: ACPI Error: Method execution failed \_SB.PCI0.SPI2.FPNT._CRS due to previous error (AE_AML_IN>
чер 21 22:06:07 roman-pc systemd-modules-load[320]: Failed to find module 'bbswitch'
чер 21 22:06:08 roman-pc (udev-worker)[373]: sdb4: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[375]: sda2: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[381]: sda4: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[407]: sdb2: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[393]: sda1: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[402]: sdb3: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[376]: sdb1: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:08 roman-pc (udev-worker)[384]: sda3: /etc/udev/rules.d/99-disable-polling.rules:1 Failed to write ATTR{/sys/devi>
чер 21 22:06:09 roman-pc kernel: ACPI Error: No pointer back to namespace node in package 000000003d519c13 (20230628/dsargs-30>
чер 21 22:06:09 roman-pc kernel: ACPI Error: Aborting method \_SB.PCI0.B0D4.PPCC due to previous error (AE_AML_INTERNAL) (2023>
чер 21 22:06:59 roman-pc systemd[1]: Failed to start Service to inject keycodes without the GUI application.
░░ Subject: A start job for unit key-mapper.service has failed

$ inxi -F
System:
  Host: roman-pc Kernel: 6.9.3-3-MANJARO arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.0.5 Distro: Manjaro Linux
Machine:
  Type: Laptop System: Dell product: G3 3779 v: N/A
    serial: <superuser required>
  Mobo: Dell model: 04R93M v: A00 serial: <superuser required> UEFI: Dell
    v: 1.2.1 date: 07/18/2018
Battery:
  ID-1: BAT0 charge: 3.0 Wh (85.7%) condition: 3.5/56.0 Wh (6.3%)
CPU:
  Info: 6-core model: Intel Core i7-8750H bits: 64 type: MT MCP cache:
    L2: 1.5 MiB
  Speed (MHz): avg: 800 min/max: 800/4100 cores: 1: 800 2: 800 3: 800 4: 800
    5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] driver: i915 v: kernel
  Device-2: NVIDIA GP106M [GeForce GTX 1060 Mobile] driver: nvidia
    v: 550.90.07
  Device-3: Realtek Integrated Webcam driver: uvcvideo type: USB
  Display: x11 server: X.Org v: 21.1.13 with: Xwayland v: 24.1.0 driver: X:
    loaded: modesetting,nvidia dri: iris gpu: i915,nvidia,nvidia-nvswitch
    resolution: 1: 1920x1080~60Hz 2: N/A
  API: EGL v: 1.5 drivers: iris,nvidia,swrast
    platforms: x11,surfaceless,device
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 550.90.07
    renderer: NVIDIA GeForce GTX 1060 with Max-Q Design/PCIe/SSE2
  API: Vulkan v: 1.3.279 drivers: nvidia,intel surfaces: xcb,xlib
Audio:
  Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel
  Device-2: NVIDIA GP106 High Definition Audio driver: snd_hda_intel
  API: ALSA v: k6.9.3-3-MANJARO status: kernel-api
  Server-1: PulseAudio v: 17.0 status: active
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi
  IF: wlan0 state: down mac: ea:1c:b6:be:47:1c
  Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    driver: r8169
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: 3c:2c:30:99:09:d6
  IF-ID-1: docker0 state: down mac: 02:42:c4:e2:85:bd
Drives:
  Local Storage: total: 2.05 TiB used: 466.92 GiB (22.2%)
  ID-1: /dev/sda vendor: Seagate model: ST2000LM007-1R8174 size: 1.82 TiB
  ID-2: /dev/sdb vendor: SK Hynix model: SC311 SATA 256GB size: 238.47 GiB
Partition:
  ID-1: / size: 44.06 GiB used: 32.39 GiB (73.5%) fs: ext4 dev: /dev/sdb2
  ID-2: /boot/efi size: 299.4 MiB used: 296 KiB (0.1%) fs: vfat
    dev: /dev/sdb1
  ID-3: /home size: 172.33 GiB used: 31 GiB (18.0%) fs: ext4 dev: /dev/sdb3
  ID-4: /var size: 91.11 GiB used: 20.43 GiB (22.4%) fs: ext4 dev: /dev/sda4
Swap:
  ID-1: swap-1 type: partition size: 17.08 GiB used: 0 KiB (0.0%)
    dev: /dev/sdb4
Sensors:
  System Temperatures: cpu: N/A mobo: N/A gpu: nvidia temp: 52 C
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 16 GiB available: 15.48 GiB used: 4.66 GiB (30.1%)
  Processes: 382 Uptime: 41m Shell: Bash inxi: 3.3.35

On black screen it sometimes reports a few typical messages like:

[...] atkbd serio0: Failed to deactivate keyboard on isa0060/serio0
...

you should dig into using udev-rules for adjusting the behaviour on different situations. you can control the actions that are activated/deactivated if you change from battery to ac.