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)
Atualizar o macOS no Mac - Opencore Legacy Patcher
Crie alias para as tarefas que possuam longas linhas de comando - bash e zsh
Criando um gateway de internet com o Debian
Configuração básica do Conky para mostrar informações sobre a sua máquina no Desktop
Aprenda a criar músicas com Inteligência Artificial usando Suno AI
Instalando Zoom Client no Ubuntu 24.04 LTS
Instalando Zoom Client no Fedora 40
Instalando Navegador Firefox no Debian 12
Bloqueando propagandas no Youtube e outros sites com o uBlocker Origin
script para gerar arquivo .AppImage (4)
Como substituir pacotes do sistema Linux Mint 21.3 (2)
Dificuldade em ler binário (9)