1
0
Fork 0

hlwm: oncall menu

This commit is contained in:
Vladimír Dudr 2025-01-02 09:01:56 +01:00
parent b9cb6352ec
commit 7cf5bf0aed
3 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1,28 @@
#!/bin/zsh
# set -x
auth="$(gopass metrans/oncall-apikey)"
if test -z $ROFI_RETV
then
rofi -show oncall -modi "oncall:$0" \
-kb-accept-custom "" \
-kb-accept-alt "" \
-kb-custom-1 "Shift+Return" \
# -sidebar-mode \
-kb-custom-2 "Control+Return"
fi
case "$ROFI_RETV" in
0) echo -e "\0use-hot-keys\x1ftrue\n"
echo -e "\0message\x1fConfirm to open, Shift-Enter to ack, Ctrl-Enter to resolve\n"
curl -s --header "Authorization: $auth" 'https://oncall.corp.metrans.cz/api/v1/alert_groups?state=new' | jq -r '.results[] | .title+"\u0000info\u001f"+.permalinks.web+"|"+.id'
;;
1) ( handlr open "${ROFI_INFO/|*}" ) & ;;
10) (
curl -s --request POST --header "Authorization: $auth" "https://oncall.corp.metrans.cz/api/v1/alert_groups/${ROFI_INFO/*|}/acknowledge"
) & ;;
11) (
curl -s --request POST --header "Authorization: $auth" "https://oncall.corp.metrans.cz/api/v1/alert_groups/${ROFI_INFO/*|}/resolve"
) & ;;
esac

View file

@ -34,6 +34,7 @@ hc keybind $Mod-Shift-x spawn systemd-run --scope --user rofi -show fb -modi "fb
hc keybind $Mod-z spawn systemd-run --scope --user rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
hc keybind $Mod-c spawn systemd-run --scope --user rofi -lines 0 -show calc -modi calc -no-show-match -no-sort -no-history -calc-command "echo -n '{result}' | xclip"
hc keybind $Mod-a spawn systemd-run --scope --user ~/bin/gopassmenu
hc keybind $Mod-v spawn systemd-run --scope --user ~/bin/oncall-menu
hc keybind $Mod-Shift-a spawn systemd-run --scope --user rofi -show pb -modi "pb:$HOME/.config/herbstluftwm/passboltmenu2"
hc keybind $Mod-m spawn systemd-run --scope --user ~/.config/herbstluftwm/pmount-dmenu
hc keybind $Mod-Escape spawn systemd-run --scope --user dunstctl close

View file

@ -11,7 +11,7 @@ panel_height=18
# bgcolor=$(hc get frame_border_normal_color)
# selbg=$(hc get window_border_active_color)
# selfg='#282828'
# fg='#fbf1c7'
# fg='#fbf1c7'
# bgcolor='#282828'
# selsecbg='#ebdbb2'
@ -118,7 +118,7 @@ hc --idle | {
### center
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
### print the right
res+="%{r}$memory$df$playing$volume$wifi$network$temperature$load $separator$date $separator%{U#f2f229}$charge%{U-}$separator"
res+="%{r}$alerts$memory$df$playing$volume$wifi$network$temperature$load $separator$date $separator%{U#f2f229}$charge%{U-}$separator"
#echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator"
done
@ -192,6 +192,11 @@ hc --idle | {
# notify "Player: ${cmd[1]}" "${cmd[2]}"
# player_status[${cmd[1]}]="${cmd[2]}"
;;
alerts)
alerts=" ${cmd[1]} $separator"
;;
battery)
#echo "battery" >&2
batt_perc="${cmd[1]}"