Mark running containers in green in rofi menu
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
jellyfin
|
||||
sonarr
|
||||
sabnzbd
|
||||
homeassistant
|
||||
picard
|
||||
picard
|
||||
|
@ -1,14 +1,24 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# User chooses service
|
||||
# User chooses service, running services are marked in green
|
||||
set SERVICES (cat ~/NixFlake/config/rofi/menus/containers.txt) # TODO: This file should probably be generated by nix?
|
||||
set SERVICE (echo -e (string join "\n" $SERVICES) | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "pod" -i)
|
||||
set PROMPT ""
|
||||
for SERVICE in $SERVICES
|
||||
set SERVICE_RUNNING "$(systemctl list-units podman-$SERVICE.service | grep podman-$SERVICE.service)"
|
||||
if test -z $SERVICE_RUNNING
|
||||
set PROMPT $PROMPT$SERVICE"\n"
|
||||
else
|
||||
set PROMPT $PROMPT"<span foreground=\"green\">$SERVICE</span>\n"
|
||||
end
|
||||
end
|
||||
set SERVICE (echo -e $PROMPT | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "pod" -i -markup-rows)
|
||||
set SERVICE (echo -e $SERVICE | sd "<.*?>" "")
|
||||
if not contains $SERVICE $SERVICES
|
||||
exit
|
||||
end
|
||||
|
||||
# User chooses action
|
||||
set ACTIONS "start" "stop" "status"
|
||||
set ACTIONS "start" "stop" "restart" "status"
|
||||
set ACTION (echo -e (string join "\n" $ACTIONS) | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu -p "action" -i)
|
||||
if not contains $ACTION $ACTIONS
|
||||
exit
|
||||
|
Reference in New Issue
Block a user