PWA Opens as Floating Window... How to set it up to open as tiled?

This is more so a question to see if anyone else has come across it.

When I install a PWA from my browser (using Brave), when I open that PWA (in this case, it’s the Garuda Forrum PWA), it opens as a floating windows rather than the default tiled window that a normal Brave browser opens as. With it being a web app, how can I change the configs to have web apps open as tiled rather than floating?
If nobody has come across this before, that’s fine. I’m going to keep digging. Both SearX and Brave Search nor the forums show anything related to this or any fixes that I can find. Maybe I’m not searching the correct terms?

garuda-inxi:

System:
  Kernel: 6.7.3-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=a9c12044-67cf-480c-890c-6ada1683400f rw rootflags=subvol=@
    quiet loglevel=3 ibt=off
  Desktop: sway v: 0.3.2 info: waybar dm: greetd Distro: Garuda Linux
    base: Arch Linux
Machine:
  Type: Laptop System: ASUSTeK product: ASUS TUF Dash F15 FX516PM_FX516PM
    v: 1.0 serial: <filter>
  Mobo: ASUSTeK model: FX516PM v: 1.0 serial: <filter> UEFI: American
    Megatrends LLC. v: FX516PM.330 date: 05/15/2023
Battery:
  ID-1: BAT0 charge: 61.2 Wh (100.0%) condition: 61.2/76.0 Wh (80.6%)
    volts: 15.8 min: 15.8 model: ASUSTeK ASUS Battery type: Li-ion serial: N/A
    status: not charging cycles: 372
CPU:
  Info: model: 11th Gen Intel Core i7-11370H socket: U3E1 bits: 64
    type: MT MCP arch: Tiger Lake gen: core 11 level: v4 note: check built: 2020
    process: Intel 10nm family: 6 model-id: 0x8C (140) stepping: 1
    microcode: 0xB4
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 320 KiB desc: d-4x48 KiB; i-4x32 KiB L2: 5 MiB desc: 4x1.2 MiB
    L3: 12 MiB desc: 1x12 MiB
  Speed (MHz): avg: 479 high: 1033 min/max: 400/4800 base/boost: 3300/4800
    scaling: driver: intel_pstate governor: powersave volts: 0.8 V
    ext-clock: 100 MHz cores: 1: 400 2: 400 3: 400 4: 1033 5: 400 6: 400
    7: 400 8: 400 bogomips: 52838
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] vendor: ASUSTeK
    driver: i915 v: kernel arch: Gen-12.1 process: Intel 10nm built: 2020-21
    ports: active: DP-1 off: eDP-1 empty: DP-2,HDMI-A-1 bus-ID: 0000:00:02.0
    chip-ID: 8086:9a49 class-ID: 0300
  Device-2: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] vendor: ASUSTeK
    driver: nouveau v: kernel non-free: 545.xx+ status: current (as of 2023-10;
    EOL~2026-12-xx) arch: Ampere code: GAxxx process: TSMC n7 (7nm)
    built: 2020-2023 ports: active: none empty: HDMI-A-2 bus-ID: 0000:01:00.0
    chip-ID: 10de:2520 class-ID: 0300
  Display: wayland server: Xwayland v: 23.2.4 compositor: sway v: 0.3.2
    driver: gpu: i915 display-ID: 1
  Monitor-1: DP-1 model: LG (GoldStar) ULTRAGEAR serial: <filter>
    built: 2022 res: 2560x1440 dpi: 93 gamma: 1.2 size: 697x392mm (27.44x15.43")
    diag: 801mm (31.5") ratio: 16:9 modes: max: 2560x1440 min: 640x480
  Monitor-2: eDP-1 model: Najing CEC Panda 0x004d built: 2019 res: 1920x1080
    dpi: 142 gamma: 1.2 size: 344x194mm (13.54x7.64") diag: 395mm (15.5")
    ratio: 16:9 modes: 1920x1080
  API: Vulkan Message: No Vulkan data available.
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
  Device-1: Intel Tiger Lake-LP Smart Sound Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel alternate: snd_sof_pci_intel_tgl
    bus-ID: 0000:00:1f.3 chip-ID: 8086:a0c8 class-ID: 0403
  Device-2: NVIDIA GA106 High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel bus-ID: 0000:01:00.1 chip-ID: 10de:228e
    class-ID: 0403
  Device-3: Logitech G535 Wireless Gaming Headset
    driver: cdc_acm,hid-generic,snd-usb-audio,usbhid type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 3-5:4 chip-ID: 046d:0ac4
    class-ID: 0a00
  API: ALSA v: k6.7.3-zen1-1-zen status: kernel-api
    tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.0.3 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Wi-Fi 6 AX201 driver: iwlwifi v: kernel bus-ID: 0000:00:14.3
    chip-ID: 8086:a0f0 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK driver: r8169 v: kernel port: 3000 bus-ID: 0000:2e:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: eno2 state: up speed: 1000 Mbps duplex: full mac: <filter>
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 3-10:6 chip-ID: 8087:0026
    class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2
    lmp-v: 11 status: discoverable: no pairing: no class-ID: 6c010c
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
    v: 0.6 port: N/A bus-ID: 0000:00:0e.0 chip-ID: 8086:9a0b rev: class-ID: 0104
Drives:
  Local Storage: total: 1.38 TiB used: 23.79 GiB (1.7%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
    model: WD BLACK SN770 1TB size: 931.51 GiB block-size: physical: 512 B
    logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 731030WD temp: 36.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:5 vendor: Samsung
    model: MZVLQ512HBLU-00B00 size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: FXM7201Q temp: 27.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 146.5 GiB size: 146.5 GiB (100.00%)
    used: 23.79 GiB (16.2%) fs: btrfs block-size: 4096 B dev: /dev/nvme1n1p7
    maj-min: 259:12
  ID-2: /boot/efi raw-size: 1.4 GiB size: 1.39 GiB (99.80%)
    used: 596 KiB (0.0%) fs: vfat block-size: 512 B dev: /dev/nvme1n1p6
    maj-min: 259:11
  ID-3: /home raw-size: 146.5 GiB size: 146.5 GiB (100.00%)
    used: 23.79 GiB (16.2%) fs: btrfs block-size: 4096 B dev: /dev/nvme1n1p7
    maj-min: 259:12
  ID-4: /var/log raw-size: 146.5 GiB size: 146.5 GiB (100.00%)
    used: 23.79 GiB (16.2%) fs: btrfs block-size: 4096 B dev: /dev/nvme1n1p7
    maj-min: 259:12
  ID-5: /var/tmp raw-size: 146.5 GiB size: 146.5 GiB (100.00%)
    used: 23.79 GiB (16.2%) fs: btrfs block-size: 4096 B dev: /dev/nvme1n1p7
    maj-min: 259:12
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 15.32 GiB used: 1.49 GiB (9.7%)
    priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 8
    dev: /dev/zram0
  ID-2: swap-2 type: partition size: 16.85 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/nvme1n1p3 maj-min: 259:8
Sensors:
  System Temperatures: cpu: 39.0 C mobo: N/A
  Fan Speeds (rpm): cpu: 0
Info:
  Processes: 328 Uptime: 2h 26m wakeups: 0 Memory: total: 16 GiB
  available: 15.32 GiB used: 3.29 GiB (21.5%) igpu: 64 MiB Init: systemd
  v: 255 default: graphical tool: systemctl Compilers: gcc: 13.2.1 Packages:
  pm: pacman pkgs: 1468 libs: 426 tools: pamac,paru Shell: garuda-inxi (sudo)
  default: Bash v: 5.2.26 running-in: foot inxi: 3.3.31
Garuda (2.6.23-1):
  System install date:     2024-02-01
  Last full system update: 2024-02-04
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       Yes
  Failed units: 

In ~/.config/sway/config.d/application_defaults a bunch of rules are set to define window behavior for certain applications or application types. It could be one of these is providing the floating attribute to whatever your web app is doing.

I’m not sure, but my guess would be one of these:

# set floating for window roles
for_window [window_role="pop-up"] floating enable
for_window [window_role="bubble"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_role="Preferences"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
for_window [window_role="About"] floating enable

If you are not sure what attributes the application has, you can run swaymsg -t get_tree to list them out.

❯ swaymsg -t get_tree
#1: root "root"
  #2147483647: output "__i3"
    #2147483646: workspace "__i3_scratch"
  #3: output "eDP-1"
    #4: workspace "1"
      #10: con "(null)"
        #7: con "Chaotic-AUR | Packages | Requests | Recompilation | Reports - Feedback / Requests - Garuda Linux Forum — LibreWolf" (xdg_shell, pid: 5916, app_id: "LibreWolf")
      #9: con "(null)"
        #8: con "micro .config/sway/c ~" (xdg_shell, pid: 1081, app_id: "footclient")
        #12: con "(null)"
          #11: con "swaymsg -t get_tree ~" (xdg_shell, pid: 1081, app_id: "footclient")

From there you can figure out what attributes the window has which is making it eligible for a floating rule, then modify the rule or make a new one that defines the desired behavior.


TL;DR: press Meta+Space to toggle a window between floating and tiling. :wink:

2 Likes

Perfect, another command to add to my toolbox!

However, when running the command with the PWA open, it’s not giving it it’s own app_id, just showing the following:

#8: con "Garuda Linux Forum - PWA Opens as Floating Window... How to set it up to open as tiled? - Issues & Assistance / Sway - Garuda Linux Forum" (xwayland, pid: 2181, instance: "crx_ffoioocmcobpchlibmahnhghifacnbpd", class: "Brave-browser-beta", X11 window: 0xA00003)

What window type would that be? :thinking:

Ah, because you are running the browser in XWayland. X11 windows do not get an app_id. You can still define a rule using another attribute ( class, window_type, window_role, instance, etc), however in the case of an X11 window the behavior is probably not caused by a rule in the first place.

Rather, Sway tries to interpret what kind of window the application wants as best it can. In this case, the application appears to be “asking for” a floating window–at least as far as Sway can tell.

Probably the application will act “normally” if you just run it on Wayland, which will probably give you better performance as well. You can launch a Chromium browser on Wayland by passing the --ozone-platform-hint=auto flag.

brave --ozone-platform-hint=auto

If you launch the browser with a keybinding you can add the flag right into your Sway config. If you are using a launcher, copy the desktop file from /usr/share/applications/ to ~/.local/share/applications/ and edit the Exec= line to add the flag.

1 Like

Oh wow, I had no idea Brave ran in X11 by default on Wayland systems. I’ll make sure and check that from now on! Let me try that and see if that fixes it!

image

Does this look correct?

Actually in brave://flags there is an option to change it from Auto to Wayland. Once I did that, relogged, the PWA is opening as a tiled window now! I did try to put the flag in the config file and even tried the .desktop option in the exec= line. Neither worked, but changing the flag did, thank you!

Gotcha, okay I don’t actually use Brave and assumed it used this flag the same as all the other Chromium browsers. Good to know it handles this a special way!

1 Like

@BluishHumility
I did just notice that Floorp (Firedragon as well) offers experimental PWA/Web App support for Linux :eyes: That was the sole reason I was staying on Brave. Going to do some testing on it and see how it works. Then I can finally fully move over the Firedragon. :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.