Enviado em 19/11/2023 - 19:27h
Fala galera, tudo beleza? To tentando adicionar duas novas informações ao meu i3status modificando o seguinte script: https://github.com/i3/i3status/blob/main/contrib/any_position_wrapper.sh#!/usr/bin/env bash
function update_holder {
local instance="$1"
local replacement="$2"
echo "$json_array" | jq --argjson arg_j "$replacement" "(.[] | (select(.instance==\"$instance\"))) |= \$arg_j"
}
function remove_holder {
local instance="$1"
echo "$json_array" | jq "del(.[] | (select(.instance==\"$instance\")))"
}
function cmus {
artist=$(printf $(cmus-remote -C status | grep "tag artist" | cut -c 12-))
if [[ $artist = *[!\ ]* ]]; then
song=$(printf $(cmus-remote -C status | grep title | cut -c 11-))
printf "$artist ﱘ $song"
else
json_array=$(remove_holder holder__i3_layout)
fi
}
function split {
local layout=$(i3-msg -t get_tree | jq --raw-output 'recurse(.nodes[]; .nodes !=null) | select(.nodes[].focused).layout')
if [ "$layout" == splith ] ; then
local json='{ "full_text": "[horizontal]", "color": "#92BFEB" }'
json_array=$(update_holder holder__split "$json")
elif [ "$layout" == splitv ] ; then
local json='{ "full_text": "[vertical]", "color": "#92BFEB" }'
json_array=$(update_holder holder__split "$json")
elif [ "$layout" == tabbed ] ; then
local json='{ "full_text": "[tabbed]", "color": "#92BFEB" }'
json_array=$(update_holder holder__split "$json")
elif [ "$layout" == stacked ] ; then
local json='{ "full_text": "[stacked]", "color": "#92BFEB" }'
json_array=$(update_holder holder__split "$json")
else
json_array=$(remove_holder holder__split)
fi
}
i3status | (read line; echo "$line"; read line ; echo "$line" ; read line ; echo "$line" ; while true
do
read line
json_array="$(echo $line | sed -e 's/^,//')"
split
cmus
echo ",$json_array"
done)
Atenção a quem posta conteúdo de dicas, scripts e tal (2)
Manutenção de sistemas Linux Debian e derivados com apt-get, apt, aptitude e dpkg
Melhorando o tempo de boot do Fedora e outras distribuições
Como instalar as extensões Dash To Dock e Hide Top Bar no Gnome 45/46
Como Atualizar Fedora 39 para 40
Instalar Google Chrome no Debian e derivados
Consertando o erro do Sushi e Wayland no Opensuse Leap 15
Instalar a última versão do PostgreSQL no Lunix mantendo atualizado
Flathub na sua distribuição Linux e comandos básicos de gerenciamento
Dongle Bluetooth 5.0 não funciona no Pop Os 22.04 (4)
Acesso a internet servidor virtualizado (10)
Sistema da Coréia do Norte - Red Star OS (11)
redirecionando saida de comando touch para o AWK[AJUDA] (17)
Driver Realtek RTL8852BE não disponível para Ubuntu 22.04.4 LTS kernel... (5)