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)
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
Solução rápida para o problema do Network Manager conectar mas não navegar
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
Interface Gráfica no Linux Mint 22.1. (1)
Como corrigir o erro chave publica virtual box (7)