greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.89k stars 475 forks source link

Future block ideas #715

Open ammgws opened 4 years ago

ammgws commented 4 years ago

Took a quick look at some other status line generators and listed up their blocks to see what ones might be good to implement ourselves. Of interest to me are blocks that use DBus/i3 IPC/etc since we can write those natively to get asynchronously updating blocks and no calls to external programs.

Note that there are a lot of simple blocks here that could be handled by the custom block, especially those that just call external programs, so I don't see the advantage of adding those into the Rust codebase since there's no performance gains etc to be made. However we could look into the idea of having contributed configs for the custom block either in the repo or wiki or somewhere. Another idea could be allowing for modules/blocks from other status line generators to be able to be imported/used directly in i3status-rust.

From bumblebee-status: block description comment
apt Displays APT package update information we have pacman already, so I guess we could have this too Done in #943
arandr Enables handy interaction with arandr for display management
caffeine Enable/disable automatic screen locking
currency Displays currency exchange rates
dnf Displays DNF package update information implemented in https://github.com/greshake/i3status-rust/pull/1311/
dunst Toggle dunst notifications implemented by #851
getcrypto Displays the price of a cryptocurrency
git Print branch and git status for currently focused window
hddtemp Fetch hard drive temeperature data from a hddtemp daemon
hostname Displays the system hostname easily covered by a Custom block
http_status Display HTTP status code easily covered by a Custom block
indicator Displays the indicator status, for numlock, scrolllock and capslock interested if can get async implementation. some discussion in #267
kernel Shows Linux kernel version information easily covered by a Custom block
libvirtvms Displays count of running libvirt VMs
mocp Displays information about the current song in mocp covered by music block (assuming mocp has MPRIS interface)
octoprint Displays the Octorpint status and the printer’s bed/tools temperature in the status bar
pihole Displays the pi-hole status (up/down) together with the number of ads that were blocked today
ping Periodically checks the RTT of a configurable host using ICMP echos easily covered by a Custom block (example added in examples/README.md)
prime Displays and changes the current selected prime video card
progress Show progress for cp, mv, dd, … this seems useful to me
publicip Displays public IP address could be added to net block
redshift Displays the current color temperature of redshift implemented by #802
rotation Shows a widget for each connected screen and allows the user to loop through different orientations
rss RSS news ticker
smartstatus Displays HDD smart status of different drives or all drives
spaceapi Displays the state of a Space API endpoint Space API is an API for hackspaces based on JSON
sun Displays sunrise and sunset times possibly add via more qualifiers to the weather block
system Adds the possibility to shutdown or reboot the system easily covered by a Custom block
twmn Toggle twmn notifications
vault Copy passwords from a password store into the clipboard (currently supports only ‘pass’)
vpn Displays the VPN profile that is currently in use
xkcd Opens a random xkcd comic in the browser easily covered by a Custom block (example added in examples/README.md)
yubikey Shows yubikey information
zpool Displays info about zpools present on the system
From py3status: block description comment
air_quality Display air quality polluting in a given location could be added to weather block
aws_bill Display bill for Amazon Web Services
bitcoin_price Display bitcoin using bitcoincharts.com
check_tcp Display status of a TCP port on a given host
coin_balance Display balances of diverse crypto-currencies
coin_market Display cryptocurrency coins
conky Display Conky objects/variables on the bar
do_not_disturb Turn on and off desktop notifications implemented by #851
dpms Turn on and off DPMS and screen saver blanking
dropboxd_status Display status of Dropbox daemon
emerge_status Display information about the currently running emerge process
fedora_updates Display number of pending updates for Fedora Linux
file_status Display if files or directories exists
frame Group modules and treat them as a single one
getjson Display JSON data fetched from a URL easily covered by a Custom block
gitlab Display number of issues, requests and more from a GitLab project
glpi Display number of open tickets from GLPI
google_calendar Display upcoming Google Calendar events
graphite Display Graphite metrics
group Group modules and switch between them
hamster Display time tracking activities from Hamster
hueshift Shift color temperature on the screen implemented by #802
i3block Support i3blocks blocklets in py3status possibly a good idea
i3pystatus Support i3pystatus modules in py3status possibly a good idea
icinga2 Display service status for Icinga2
imap Display number of unread messages from IMAP account
insync Display Insync status
kdeconnector Display information about your smartphone with KDEConnector already implemented
khal_calendar Displays upcoming khal events
mega_sync mega_sync
ns_checker Display DNS resolution success on a configured domain
process_status Display status of a process on your system
rainbow Add color cycling fun to your i3bar
rate_counter Display time spent and calculate the price of your service
rt Display number of ongoing tickets from RT queues
scratchpad Display number of scratchpad windows and urgency hints
screenshot Take screenshots and upload them to a given server easily covered by a Custom block (example added in examples/README.md)
selinux Display SELinux state
sql Display data stored in MariaDB, MySQL, sqlite3, and hopefully more
systemd Display status of a service on your system possibly even more useful if it could track all services and display failed ones
systemd_suspend_inhibitor Turn on and off systemd suspend inhibitor
thunderbird_todos Display number of todos and more for Thunderbird
timer Simple countdown timer
tor_rate Display transfer rates of a tor instance
transmission Display number of torrents and more
twitch Display if a Twitch channel is currently streaming or not
uname Display system information easily covered by a Custom block (example added in examples/README.md)
usbguard Allow or Reject newly plugged USB devices using USBGuard
velib_metropole Display information about Velib Métropole stations
vnstat Display vnstat statistics
wanda_the_fish Display a fortune-telling, swimming fish
whoami Display logged-in username easily covered by a Custom block
xsel Display X selection
yandexdisk_status Display Yandex.Disk status
yubikey Show an indicator when YubiKey is waiting for a touch
From i3blocks: block description
afs Show usage information for an AFS directory
calendar Current date/time and click for calendar
disk-io Monitor disk reads and writes
dunst Toggle Dunst notifications using a simple Do-Not-Disturb button implemented in #851
email Show the number of unread IMAP messages
gpu-load Shows load of Nvidia GPUs already covered by nvidia-gpu block
go Show the currently installed Go version easily covered by a Custom block
keyindicator Show the status of capslock or numlock
key_light Control the keyboard backlight
kubernetes Show the kubernetes current context and namespace
monitor_manager Manage monitor on/off, resolution, extend, clone
nm-vpn Show vpn status using network manager
openvpn Show openvpn status
rofi-calendar Current date/time and click for calendar using rofi
shutdown_menu Shutdown menu using rofi or zenity easily covered by a Custom block
tahoe-lafs Show status of your tahoe-lafs grid
usb Show connected usb storage device info
ytdl-mpv Play youtube videos from your clipboard using youtube-dl

Others

762:

Hi I have a custom block that shows this: | DP-1(1.0) HEADLESS-1(1.0) | to show the active outputs and their current scale factor. It might be nice to have something like this built in.

gurditsbedi commented 4 years ago

From my point of view, apt and do-not-disturb seem promising. apt : AFAIK, apt and pacman belong to most used distros. do-not-disturb: Some times focus is needed.

ammgws commented 4 years ago

apt seems reasonable given it should have a large user base.

Although both do-not-disturb and apt could be implemented using the Custom block. As mentioned in the first post, I wonder if we should have a collection of custom block configs that we ship as part of i3status-rs for those trivial blocks. Saves the user time from thinking of the block and the commands, and saves us from having to implement them in Rust. @atheriel What do you think (whenever you see this)?

flying7eleven commented 4 years ago

I would vote for a "all-in-one" solution. Personally, I hate the hassle that I have to maintain several external scripts which are "just" called by i3status-rs. Also setting up a new computer would require more effort than just copying a single configuration file (sure, I could also copy all files). Additionally, I agree to the point of @ammgws that someone who starts setting up the bar would have to think about how to realize all the blocks instead of just adding them to the config. This could cause confusion.

From the list in the initial issue, I would be very interested in some of the blocks and could imagine to contribute (for) some of them.

ammgws commented 4 years ago

Do you have any scripts that aren't covered by anything from the list in the first post and are general enough to be useful for others? If so please list those up as well.

atheriel commented 4 years ago

I think a collection of simple/common uses of the Custom block (shell one-liners, basically) would be a great addition to the documentation. We could potentially re-jig blocks.md so that the Custom block gets its own section at the end with a large number of examples.

AkechiShiro commented 4 years ago

Hey @ammgws, could you update your first comment to add that the redshift block was added (partially) in #802, just so beginners coming here don't think nothing has been done for this, since the hueshift block is kinda of lesser complete redshift block (Though I do agree that the redshift block is more complete).

norpol commented 3 years ago

I hope it's ok to add a suggestions in this thread.

Firefox and Chrome have a "Sharing Indicator", this results with no additional configuration with a sharing indicator becoming a tiling-window.

I believe it would be nice to have configuration that omits the sharing-indicator window itself in sway + an additional status item in i3dstatus that will be visible once the sharing indicator id shows up in the swaytree.

An alternative to using the sharing-indicator of Firefox we could add a "audio recording" indicator to sound.rs.

Adding some similar functionality for the webcam is not trivial until we have pipewire though, unless fuser /dev/video* is used.

OK, webcam sharing indicator works fairly simple, here an example (and I hope not to resource consuming):

(example requires bash, fuser, and pactl installed)

#!/usr/bin/env bash
set -ueo pipefail

if fuser /dev/video* >/dev/null; then
    icon="music_play"
    state="Critical"
    text="Rec"
else
    icon=""
    state="Idle"
    text=""
fi

cat - <<EOF
    {
       "icon": "${icon}",
           "state": "${state}",
           "text": "${text}"
}
EOF
[[block]]
block = "custom"
command = '~/bin/webcam_status'
json = true
interval = 1

and the same for audio

#!/usr/bin/env bash
set -ueo pipefail

if  [ -n "$(pactl list source-outputs short)" ]; then
    icon="microphone_full"
    state="Critical"
    text="Rec"
else
    icon=""
    state="Idle"
    text=""
fi

cat - <<EOF
    {
       "icon": "${icon}",
           "state": "${state}",
           "text": "${text}"
}
EOF
[[block]]
block = "custom"
command = '~/bin/audio_status'
json = true
interval = 1

In addition I'm using

for_window [title=".*Sharing Indicator" app_id="firefox"]  {
        floating enable
        border none
        title none
        move position -1000 -1000
}

to hide the Firefox Sharing Indicator since there is no proper way of minimizing/hiding windows in swaywm. Though an better alternative to this is adding this to your userChrome.css (via)

#webrtcIndicator {
  display: none;
}
MaxVerevkin commented 3 years ago

xkcd, getjson, screenshot, shutdown_menu and system should also be easily covered by custom.

frame - sounds interesting.

rainbow - sounds fun, I can imagine it being implemented with a more advanced alternating mechanism. Perhaps use HSV color space and for every block increase the hue value?

ammgws commented 3 years ago

I have been thinking about creating a udiskie block since all the info can be grabbed via D-Bus, and it would be pretty handy since tray icons aren't currently working on sway. May get around to it one day if no one else does, just need to suss out the bus properties/behaviour.

ObiWahn commented 3 years ago

Hi, I would like to have a trayicon holder block or at least something that lets me use nextcloud.

GladOSkar commented 3 years ago

@ObiWahn tray icons are not managed by i3status-rust, but by your DE's bar. We have no control over them.

You can of course use a custom block to run the nextcloud binary when clicked, which, if nextcloud is already running in the background, will open up its GUI:

[[block]]
block = "custom"
command = "echo \uf0c2 Nextcloud"
on_click = "nextcloud"

(The unicode codepoint is an Icon from NF, you might have to change/remove it)

i3srs-nc

MaxVerevkin commented 3 years ago

Block idea: a menu - user provides a list of strings and commands associated with those strings. Scrolling on the block will cycle through those strings. Clicking on the block will run the command.

[[block]]
block = "menu"
text = "\uf011 "
[[block.items]]
display = "-> Power Off <-"
cmd = "poweroff"
[[block.items]]
display = "->   Sleep   <-"
cmd = "systemctl suspend"

A prototype:

https://user-images.githubusercontent.com/34583604/142244898-015858e3-5f06-4026-9b98-6a40279eee17.mp4

ammgws commented 3 years ago

Looks good!

mildred commented 1 year ago

I'd love to see a block with IO usage, of course I can run an external command but spawning external commands takes up resources.

jkauerl commented 6 months ago

Hello, im new to Open Source Development and Rust and wanted to know a good first PR to tackle. Any recommendation?

GreyXor commented 4 months ago

A tuned switcher (via dbus)

tbaumann commented 3 months ago

It would be nice if the custom component would support the waybar JSON format. There are a bunch of stuff that could be used from there and from custom modules.

https://github.com/Alexays/Waybar/wiki

tbaumann commented 3 months ago

Custom can be used for clickable buttons. But it does always require a command option even if you don't use it.

[[block]]
block = "custom"
command = "/run/current-system/sw/bin/false"
format = " "

[[block.click]]
button = "left"
cmd = "/nix/store/92rdwiipzag7bix2fzdirxqm41x5dwfn-wlogout-1.2.2/bin/wlogout"

Suggestion: Make command optional or add a button block.

MaxVerevkin commented 3 months ago

You can just set

command = "echo <button label>"
interval = "once"

I'm not sure it is worth making command optional. Though if a potential implementation is simple enough, I will accept it.