diff --git a/dotfiles/.config/waybar/launch.sh b/dotfiles/.config/waybar/launch.sh index e6ce99dc3..eab5bc1e8 100755 --- a/dotfiles/.config/waybar/launch.sh +++ b/dotfiles/.config/waybar/launch.sh @@ -11,7 +11,8 @@ # invocation proceeds; all others exit immediately. # ----------------------------------------------------- -exec 200>/tmp/waybar-launch.lock +lock_file="/tmp/waybar-launch-$USER.lock" +exec 200>$lock_file flock -n 200 || exit 0 # ----------------------------------------------------- @@ -97,12 +98,12 @@ _toggle_module() { search_string=" \"$module_name\"" if ! grep -qF "$search_string" "$file"; then sed -i "s| //\"$module_name\"| \"$module_name\"|g" "$file" - fi + fi else search_string=" //\"$module_name\"" if ! grep -qF "$search_string" "$file"; then sed -i "s| \"$module_name\"| //\"$module_name\"|g" "$file" - fi + fi fi } @@ -139,4 +140,4 @@ fi # Explicitly release the lock (optional) -> flock releases on exit flock -u 200 -exec 200>&- \ No newline at end of file +exec 200>&-