Swaybar calls waybar is there a way to pass config and stylesheet

Hello,

I have somewhat odd circumstance. On a test laptop I installed Garuda sway w/o issue. When I installed QTILE and Hyprland from a NON garuda source. Provided by a developer of Hyprland/Qtile themes. His QTILE config for waybar overwrote the version that came with Garuda SWAY.

In .config/sway/config.d/theme the swaybar_command calls waybar
Which sources the config and style.css from .config/waybar

#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
  swaybar_command waybar
}

I copied the original Garuda sway waybar files to .config/sway/waybar

I read the man pages, searched online but could not find anyway of getting it to read the config files from the alternate directory.

swaybar_command  waybar -c ~/.config/sway/waybar/config -s ~/.config/sway/waybar/style.css 
 

No matter what I tried Waybar would not load. I tried quoting it, etc…

My workaround hack was to run it as a exec command in the autostart shell script.

It works but I would like to see if there’s a way to do it with swaybar_command

Thanks in advance.

Don

garuda-inx
find-the-command: "garuda-inx" is not found locally, searching in repositories...
find-the-command: /var/cache/pkgfile/*.files are out of date, update? [Y/n] y
:: Updating 5 repos...
  download complete: garuda               [   268.4 KiB   674K/s  4 remaining]
  download complete: multilib             [   210.7 KiB   195K/s  3 remaining]
  download complete: core                 [  1045.7 KiB   676K/s  2 remaining]
  download complete: chaotic-aur          [    52.7 MiB  26.7M/s  1 remaining]
  download complete: extra                [    38.5 MiB  8.49M/s  0 remaining]
:: download complete in 4.54s             <    92.7 MiB  20.4M/s  5 files    >
:: waiting for 1 process to finish repacking repos...
find-the-command: command not found: "garuda-inx"

 ╭─dwilliams@osirus in ~ as 🧙 took 11s
[🔍] × garuda-inxi
System:
  Kernel: 6.5.9-zen2-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: hpet,acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=f5c7dc93-4bef-4ad0-b001-fd27b89226a1 rw rootflags=subvol=@
    quiet resume=UUID=b6041209-8a0b-4f2e-9322-3564fed67378 loglevel=3 ibt=off
  Desktop: sway v: 1.8.1 info: waybar vt: 1 dm: greetd Distro: Garuda Linux
    base: Arch Linux
Machine:
  Type: Laptop System: Dell product: Latitude E6540 v: 00
    serial: <superuser required> Chassis: type: 9 serial: <superuser required>
  Mobo: Dell model: N/A serial: <superuser required> UEFI: Dell v: A21
    date: 05/19/2017
Battery:
  ID-1: BAT0 charge: 76.7 Wh (100.0%) condition: 76.7/99.9 Wh (76.8%)
    volts: 12.6 min: 11.1 model: LGC-LGC3.0 DELL 5DN1K4A type: Li-ion
    serial: <filter> status: full
CPU:
  Info: model: Intel Core i7-4810MQ bits: 64 type: MT MCP arch: Haswell
    gen: core 4 level: v3 note: check built: 2013-15 process: Intel 22nm
    family: 6 model-id: 0x3C (60) stepping: 3 microcode: 0x28
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
    L3: 6 MiB desc: 1x6 MiB
  Speed (MHz): avg: 1575 high: 3800 min/max: 800/3800 scaling:
    driver: intel_cpufreq governor: schedutil cores: 1: 1000 2: 800 3: 800
    4: 800 5: 3800 6: 800 7: 3800 8: 800 bogomips: 44694
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel 4th Gen Core Processor Integrated Graphics vendor: Dell
    driver: i915 v: kernel arch: Gen-7.5 process: Intel 22nm built: 2013 ports:
    active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2, HDMI-A-3, VGA-1
    bus-ID: 00:02.0 chip-ID: 8086:0416 class-ID: 0300
  Device-2: AMD Mars XTX [Radeon HD 8790M] vendor: Dell driver: radeon
    v: kernel alternate: amdgpu arch: GCN-1 code: Southern Islands
    process: TSMC 28nm built: 2011-20 pcie: gen: 3 speed: 8 GT/s lanes: 8
    ports: active: none empty: VGA-2 bus-ID: 01:00.0 chip-ID: 1002:6606
    class-ID: 0300 temp: 42.0 C
  Device-3: Microdia Integrated Webcam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-1.5:3 chip-ID: 0c45:64d0
    class-ID: 0e02
  Display: wayland server: Xwayland v: 23.2.2 compositor: sway v: 1.8.1
    driver: gpu: i915 display-ID: 1
  Monitor-1: eDP-1 model: Samsung 0x4c48 built: 2014 res: 1920x1080 hz: 60
    dpi: 142 gamma: 1.2 scale: 1 size: 344x194mm (13.54x7.64")
    diag: 395mm (15.5") ratio: 16:9 modes: 1920x1080
  API: Vulkan v: 1.3.269 layers: 3 device: 0 type: integrated-gpu name: Intel
    HD Graphics 4600 (HSW GT2) driver: mesa intel v: 23.2.1-arch1.2
    device-ID: 8086:0416 surfaces: xcb,xlib,wayland device: 1 type: cpu
    name: llvmpipe (LLVM 16.0.6 256 bits) driver: mesa llvmpipe
    v: 23.2.1-arch1.2 (LLVM 16.0.6) device-ID: 10005:0000
    surfaces: xcb,xlib,wayland
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio vendor: Dell
    driver: snd_hda_intel v: kernel bus-ID: 00:03.0 chip-ID: 8086:0c0c
    class-ID: 0403
  Device-2: Intel 8 Series/C220 Series High Definition Audio vendor: Dell 8
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8c20
    class-ID: 0403
  API: ALSA v: k6.5.9-zen2-1-zen status: kernel-api tools: N/A
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 0.3.85 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 Ethernet I217-LM vendor: Dell driver: e1000e v: kernel
    port: f060 bus-ID: 00:19.0 chip-ID: 8086:153a class-ID: 0200
  IF: eno1 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Intel Centrino Ultimate-N 6300 driver: iwlwifi v: kernel pcie:
    gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 03:00.0 chip-ID: 8086:422b
    class-ID: 0280
  IF: wlp3s0 state: down mac: <filter>
Drives:
  Local Storage: total: 223.57 GiB used: 10.41 GiB (4.7%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Kingston model: SV300S37A240G
    size: 223.57 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    tech: SSD serial: <filter> fw-rev: UA scheme: GPT
Partition:
  ID-1: / raw-size: 214.47 GiB size: 214.47 GiB (100.00%)
    used: 10.41 GiB (4.9%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 576 KiB (0.2%) fs: vfat dev: /dev/sda1 maj-min: 8:1
  ID-3: /home raw-size: 214.47 GiB size: 214.47 GiB (100.00%)
    used: 10.41 GiB (4.9%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
  ID-4: /var/log raw-size: 214.47 GiB size: 214.47 GiB (100.00%)
    used: 10.41 GiB (4.9%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
  ID-5: /var/tmp raw-size: 214.47 GiB size: 214.47 GiB (100.00%)
    used: 10.41 GiB (4.9%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 7.66 GiB used: 768 KiB (0.0%) priority: 100
    comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 8 dev: /dev/zram0
  ID-2: swap-2 type: partition size: 8.8 GiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/sda3 maj-min: 8:3
Sensors:
  System Temperatures: cpu: 48.0 C mobo: 47.0 C sodimm: SODIMM C gpu: radeon
    temp: 42.0 C
  Fan Speeds (rpm): cpu: 3191
Info:
  Processes: 267 Uptime: 42m wakeups: 0 Memory: total: 8 GiB
  available: 7.66 GiB used: 2.02 GiB (26.3%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 Packages:
  pm: pacman pkgs: 1251 libs: 377 tools: paru Shell: fish v: 3.6.1
  running-in: alacritty inxi: 3.3.31
Garuda (2.6.19-2):
  System install date:     2023-11-24
  Last full system update: 2023-11-25 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       No/Undetected
  Failed units:

You are not choosing a valid location for the config files, see here: Configuration · Alexays/Waybar Wiki · GitHub

Config file

The configuration uses the JSON file format and is named config.

Valid directories for this file are:

  • ~/.config/waybar/
  • ~/waybar/
  • /etc/xdg/waybar/
2 Likes

thank you

I would argue that ‘valid’ in this context should be interpreted as that is the default behavior unless specified My issue is that with multiple desktops calling waybar the configs get overwritten, or if there are configs in those different directories which one will it read ? Lastly, since you can specify the location it’s a supported option.

I am looking for a method to get swaybar_commnad to pass those parameters to waybar

Regards,

You can argue all you like, although you should know you are “arguing” with the author of the application in this case. :face_with_hand_over_mouth:

Yes, in a nutshell this is the biggest issue with installing multiple DEs or WMs on top of one another. Frankly, this issue is rather tame compared to some of the conflicts this kind of setup can introduce.

It is a supported option for Waybar, but it is not necessarily a supported option for sway-bar (see here: sway-bar(5) — Arch manual pages). The swaybar_command doesn’t seem to allow anything other than just straight up running a command without options.

One way around this would be to create a custom script and run that instead.

sudo micro /usr/local/bin/custom_waybar
#!/bin/bash
exec waybar -c $HOME/.config/sway/waybar/config -s $HOME/.config/sway/waybar/style.css

Save and exit the file, then make it executable.

sudo chmod +x /usr/local/bin/custom_waybar

Change the swaybar_command to use your custom script.

micro ~/.config/sway/config.d/theme
...
bar {
  swaybar_command custom_waybar
}

Save, then reload the Sway config to test.

3 Likes

Thank you!

Yeah I did read over the man pages and didn’t see a way to make swaybar accept it. But I totally didn’t think about having it call a script instead! DUH! :man_facepalming:

That is a much nicer solution and will make more sense to anyone who looked at it later. (Including myself)

I did it as as script in the autostart file.

I appreciate the help!!

Regards,
D

1 Like

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