JaKooLit / Ubuntu-Hyprland

Automated Hyprland installer for Ubuntu. NOTE: Repo Branches as per Ubuntu Versions
GNU General Public License v3.0
192 stars 15 forks source link

Waybar Toggle Script #14

Closed Uraxii closed 1 month ago

Uraxii commented 1 month ago

Feature Request

Hello!

The current Waybar toggle only kills the process and will not reopen Waybar when pressed again. I created this script to check weither Waybar is active and either kill or start the process. I image there are more checks that should get done, but this works well enough for my needs.

Modification to Keybind in /config/Keybinds.config

bind = $mainMod, B, exec, $scriptsDir/WaybarToggle.sh # Toggle hide/show waybar

WaybarToggle.sh

#!/bin/bash

if pgrep -x "waybar" > /dev/null
then
    # Waybar is running. Let's close it.
    pkill waybar
else
    # Waybar is NOT running, Let's start it in the background.
    waybar &
fi
Uraxii commented 1 month ago

Going to close this an recreate it as a bug.