First time using WM and Waybar and I can’t for the life of me find a good OSD for volume and brightness, so I created one using Waybar and Niri keybind spawn function

  • HlSTR@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    This is so nice, I’m currently switching from garuda/hyprland to cachyOS/niri and redoing my whole DE in the process

    I’ve used barify with mako before to do something similar but I would love if you could share how you did this because it look much better

    • ColdWater@lemmy.caOP
      link
      fedilink
      arrow-up
      1
      ·
      3 days ago

      basically every time I change volume or brightness Niri will call Waybar to spawn with its own config and style (it has to be a separate config and style or it will be a nightmare manage) to show up and use flock to stop Waybar from spamming/running again if it already running with the same spawn command here is my Niri keybind (if you wanna make your own you only have to edit file path to your waybar osd config and waybar style css and change “1%” for how much you want volume to change each time) :

      XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ -l 1.0 && flock -n /tmp/waybar_vol.lock -c 'timeout 7s waybar -c ~/.config/waybar/configvolumeosd -s ~/.config/waybar/style2osd.css'"; }
      
      XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- && flock -n /tmp/waybar_vol.lock -c 'timeout 7s waybar -c ~/.config/waybar/configvolumeosd -s ~/.config/waybar/style2osd.css'"; }
      
      XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && flock -n /tmp/waybar_mic.lock -c 'timeout 7s waybar -c ~/.config/waybar/configvolumeosd -s ~/.config/waybar/style2osd.css'"; }
      

      —this is my waybar config for osd (you can use any module you want):

      { “layer”: “overlay”, “position”: “bottom”, “margin-bottom”: 100, “height”: 33, “spacing” : 0, “exclusive”: false, “passthrough”: false, “width”: 200,

      “modules-left”: [

      ],

      “modules-center”: [

      ],

      “modules-right”: [

      	"custom/exit",
      	"custom/playerctlprevious",
      	"custom/playerctlplaypause",
      	"custom/playerctlnext",
      	"pulseaudio/slider",
      	"wireplumber",
      

      ],

      “pulseaudio/slider”: { “min”: 0, “max”: 100, “orientation”: “horizontal” },

      “wireplumber”: { “format”: “{icon} {volume}%”, “format-muted”: “”, “format-icons”: { “default”: [“”, “”, " "] }, “on-click”: “easyeffects”, },

      “mpris”: { “format”: “{player_icon} {dynamic}”, “format-paused”: “{status_icon} <i>{dynamic}</i>”, “player-icons”: { “default”: “▶”, “mpv”: “🎵” }, “status-icons”: { “paused”: “󰏤”, }, // “ignored-players”: [“firefox”] “interval”: 1, },

      "custom/playerctlplaypause": {
      	"format": "󰐎",
      	"on-click": "playerctl play-pause",
      	"tooltip": false,
      

      },

      "custom/playerctlnext": {
      	"format": "󰒭",
      	"on-click": "playerctl next",
      	"tooltip": false,
      

      },

      	"custom/playerctlprevious": {
      	"format": "󰒮",
      	"on-click": "playerctl previous",
      	"tooltip": false,
      

      },

      “custom/exit”: { “format”: “󰅗”, “on-click”: “sh /home/coldwater/.config/waybar/scripts/exit.sh”, },

      “custom/name”: { “format”: “Media Control”, },

      “mpris”: { “format”: “{player_icon} {artist} - {title}”, “format-paused”: “{player_icon} <i>{artist} - {title}</i>”, “max-length”: 40, },

      }

      • pabryan@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        2 days ago

        What about spawning once and for all? It would hide on startup. Then keypress shows it and starts the timer to rehide it. Then you wouldn’t have to worry about process management with flock. Each keypress just sets it to visible (which is fine if.it’s already visible) and restarts the timer.

        You could use your daemon manager (systemd most commonly) to manage the process.

        Just a thought. In any event, looks quite cool and I’ll give it a try 😃

        • HlSTR@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          3 days ago

          Thx a lot, i’ve glanced over it but it look quite clear, I will thinker with it tonight while tweaking my system

  • Magitian@programming.dev
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    3 days ago

    Sorry to burst your bubble, but wouldn’t it be more convenient to just use DankMaterialShell for a more complete Material You shell?

    • pcouy@lemmy.pierre-couy.fr
      link
      fedilink
      arrow-up
      3
      ·
      3 days ago

      I think your missing the point about the whole “linux desktop customization” hobby. The fun is in building the thing yourself by assembling software that “does one thing and does it well”. Getting to use after it’s built is just added bonus :)

    • ColdWater@lemmy.caOP
      link
      fedilink
      arrow-up
      3
      ·
      3 days ago

      It’s also more convenient to just use KDE ;) but honestly any shell that’s related to quickshell look like a pain to config and I probably stuck with the layout or style it come with, but with waybar I can make anything from scratch in just a few hours while quickshell require programming skill I don’t have and I also got a real life job.