Add rofi podman-systemd menu
This commit is contained in:
3
config/rofi/menus/containers.txt
Normal file
3
config/rofi/menus/containers.txt
Normal file
@ -0,0 +1,3 @@
|
||||
jellyfin
|
||||
homeassistant
|
||||
picard
|
25
config/rofi/menus/systemd-podman.fish
Executable file
25
config/rofi/menus/systemd-podman.fish
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# User chooses service
|
||||
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)
|
||||
if not contains $SERVICE $SERVICES
|
||||
exit
|
||||
end
|
||||
|
||||
# User chooses action
|
||||
set OPS "start" "stop" "status"
|
||||
set OP (echo -e (string join "\n" $OPS) | rofi -theme ~/NixFlake/config/rofi/rofi.rasi -dmenu)
|
||||
if not contains $OP $OPS
|
||||
exit
|
||||
end
|
||||
|
||||
# Execute command
|
||||
set COMMAND_ROOT "pkexec --user root systemctl $OP podman-$SERVICE.service"
|
||||
set COMMAND_USER "systemctl $OP podman-$SERVICE.service"
|
||||
set EVAL_RESULT "$(eval $COMMAND_USER)"
|
||||
|
||||
# Display result if it exists
|
||||
if test -n "$EVAL_RESULT"
|
||||
rofi -theme ~/NixFlake/config/rofi/rofi.rasi -e "$EVAL_RESULT"
|
||||
end
|
Reference in New Issue
Block a user