From 2515910d41bf21a8d58f476bc04a91c2cf0fef3f Mon Sep 17 00:00:00 2001 From: GaspardCulis Date: Sun, 29 Oct 2023 13:56:07 +0100 Subject: [PATCH] Added i3status-rust config --- bar/i3status-rust/config.toml | 70 ++++++++++++++++++++++++ bar/i3status-rust/scripts/refresh-rate | 28 ++++++++++ bar/i3status-rust/scripts/toggle-profile | 32 +++++++++++ sync | 1 + 4 files changed, 131 insertions(+) create mode 100644 bar/i3status-rust/config.toml create mode 100755 bar/i3status-rust/scripts/refresh-rate create mode 100755 bar/i3status-rust/scripts/toggle-profile diff --git a/bar/i3status-rust/config.toml b/bar/i3status-rust/config.toml new file mode 100644 index 0000000..8f99d3f --- /dev/null +++ b/bar/i3status-rust/config.toml @@ -0,0 +1,70 @@ +icons_format = "{icon}" + +[theme] +theme = "solarized-dark" +[theme.overrides] +idle_bg = "#123456" +idle_fg = "#abcdef" + +[icons] +icons = "awesome4" + +[[block]] +block = "cpu" + +[[block]] +block = "custom" +command = "~/.config/i3status-rust/scripts/toggle-profile" +json = true +[[block.click]] +button = "left" +cmd="~/.config/i3status-rust/scripts/toggle-profile toggle" +sync = true +update = true + +[[block]] +block = "custom" +command = "cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status" +interval = 2 +format = " \uf26c $text " + +[[block]] +block = "custom" +command = "~/.config/i3status-rust/scripts/refresh-rate" +json = true +[[block.click]] +button = "left" +cmd="~/.config/i3status-rust/scripts/refresh-rate toggle" +sync = true +update = true + +[[block]] +block = "memory" +format = " $icon $mem_total_used_percents.eng(w:2) " +format_alt = " $icon_swap $swap_used_percents.eng(w:2) " + +[[block]] +block = "disk_space" +path = "/" +info_type = "available" +alert_unit = "GB" +interval = 20 +warning = 20.0 +alert = 10.0 +format = " $icon root: $available.eng(w:2) " + +[[block]] +block = "battery" +interval = 5 +format = "$icon $percentage $power $time" + +[[block]] +block = "sound" +[[block.click]] +button = "left" +cmd = "pavucontrol" + +[[block]] +block = "time" +interval = 1 +format = " $timestamp.datetime(f:'%a %d/%m %X') " diff --git a/bar/i3status-rust/scripts/refresh-rate b/bar/i3status-rust/scripts/refresh-rate new file mode 100755 index 0000000..1436e2d --- /dev/null +++ b/bar/i3status-rust/scripts/refresh-rate @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +get-refresh-rate () { + xrandr --screen 0 | grep "*" | cut -d "*" -f 1 | awk '{print $NF}' | cut -d "." -f 1 +} + +get-refresh-rate-json () { + refresh_rate="$(get-refresh-rate)" + state="idle" + if [ "$refresh_rate" == "165" ]; then + state="info" + fi + echo "{\"icon\": \"\", \"state\": \"$state\", \"text\": \"${refresh_rate}Hz\", \"short_text\": \"\"}" +} + +refresh_rate=$(get-refresh-rate) + +if [ "$1" == "toggle" ]; then + if [ $refresh_rate == "60" ]; then + xrandr --screen 0 -r 165 + get-refresh-rate-json + else + xrandr --screen 0 -r 60 + get-refresh-rate-json + fi +else + get-refresh-rate-json +fi diff --git a/bar/i3status-rust/scripts/toggle-profile b/bar/i3status-rust/scripts/toggle-profile new file mode 100755 index 0000000..7dbb654 --- /dev/null +++ b/bar/i3status-rust/scripts/toggle-profile @@ -0,0 +1,32 @@ +#!/bin/bash + +get-profile () { + asusctl profile -p | awk '{print $4}' +} + +get-profile-json () { + profile="$(get-profile)" + state="idle" + if [ "$profile" == "Balanced" ]; then + state="info" + elif [ "$profile" == "Performance" ]; then + state="warning" + fi + echo "{\"icon\": \"\", \"state\": \"$state\", \"text\": \"$profile\", \"short_text\": \"\"}" +} + +active_profile="$(get-profile)" + +if [ "$1" == "toggle" ]; then + +if [ "$active_profile" == "Quiet" ]; then + asusctl profile -P Balanced +elif [ "$active_profile" == "Balanced" ]; then + asusctl profile -P Performance +else + asusctl profile -P Quiet +fi + +fi + +get-profile-json diff --git a/sync b/sync index 4b8c990..02b4298 100755 --- a/sync +++ b/sync @@ -22,6 +22,7 @@ synced_files = [ ('term/rio/', '~/.config/rio/'), ('term/alacritty/', '~/.config/alacritty/'), ('bar/waybar/', '~/.config/waybar/'), + ('bar/i3status-rust/', '~/.config/i3status-rust/'), ('home/xinitrc', '~/.xinitrc'), ('misc/picom/', '~/.config/picom/'), ('misc/runst/', '~/.config/runst/'),