From 409ce9a05c58a2492db9c6e6108a0d0b55f8d715 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Sat, 28 Oct 2023 20:16:53 +0200 Subject: [PATCH] Update volshow script to use sockets --- tree/.config/hypr/hyprland.conf.tpl | 1 - tree/.local/bin/volshow | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tree/.config/hypr/hyprland.conf.tpl b/tree/.config/hypr/hyprland.conf.tpl index 4793789..433390b 100644 --- a/tree/.config/hypr/hyprland.conf.tpl +++ b/tree/.config/hypr/hyprland.conf.tpl @@ -131,7 +131,6 @@ device:epic-mouse-v1 { windowrule=float,title:Volume windowrule=size 300 100,title:Volume windowrule=move 100%-375 75,title:Volume -windowrule=noanim,title:Volume windowrule=rounding 35,title:Volume windowrule=nofocus,title:Volume diff --git a/tree/.local/bin/volshow b/tree/.local/bin/volshow index ed7ccb5..078af6e 100755 --- a/tree/.local/bin/volshow +++ b/tree/.local/bin/volshow @@ -1,9 +1,16 @@ #!/bin/sh +# Pops up a window showing the current volume -alacritty -t "Volume" \ - --class "volume_indicator" \ - --config-file "$HOME/.config/alacritty/silent.yml" \ - --command volume_indicator \ - --cols 30 \ - --rows 3 \ - --timeout 1000 +SOCKET="/tmp/volume_indicator" + +# If theres an existing volume_indicator running, prod the socket +# Otherwise, start a new volume_indicator instance. +nc -U "$SOCKET" 2>/dev/null || \ +ba alacritty -t "Volume" \ + --class "volume_indicator" \ + --config-file "$HOME/.config/alacritty/silent.yml" \ + --command volume_indicator \ + --cols 30 \ + --rows 3 \ + --socket "$SOCKET" \ + --timeout 2000