power menu, redshift, polybar

This commit is contained in:
azpsen 2024-01-28 16:37:10 -06:00
parent 89516a6ce1
commit 319b44ecbd
307 changed files with 7642 additions and 5 deletions

View File

@ -17,8 +17,10 @@ bspc rule -a Nvidia-settings state=floating
bspc rule -a openrgb state=floating bspc rule -a openrgb state=floating
bspc rule -a Sxiv state=floating bspc rule -a Sxiv state=floating
dunst & pgrep -x dunst > /dev/null || dunst &
~/.config/bspwm/scripts/notify.sh & pgrep -x notify.sh > /dev/null || ~/.config/bspwm/scripts/notify.sh &
picom & ~/.config/bspwm/scripts/launch-polybar.sh &
pgrep -x picom > /dev/null || picom &

View File

@ -0,0 +1,6 @@
#!/bin/bash
killall -q polybar
polybar primary 2>&1 | tee -a /tmp/polybar.log & disown
polybar secondary 2>&1 | tee -a /tmp/polybar.log & disown

View File

@ -10,12 +10,12 @@ while true; do
continue continue
fi fi
current_track=$(playerctl -p Feishin metadata --format '{{ title }}\n{{ artist }}\n{{ album }}') current_track=$(playerctl -p Feishin metadata --format '<i>{{ title }}</i>\n{{ artist }}\n{{ album }}')
album_art_url=$(playerctl -p Feishin metadata mpris:artUrl) album_art_url=$(playerctl -p Feishin metadata mpris:artUrl)
album_art_file="/tmp/album_art.jpg" album_art_file="/tmp/album_art.jpg"
wget -q -O $album_art_file $album_art_url wget -q -O $album_art_file $album_art_url
if [[ "$current_track" != "$previous_track" ]]; then if [[ "$current_track" != "$previous_track" ]]; then
notify-send "Now Playing" "$current_track" -i $album_art_file notify-send "now playing" "$current_track" -i $album_art_file
previous_track="$current_track" previous_track="$current_track"
fi fi
sleep 1 sleep 1

271
.config/cava/config Normal file
View File

@ -0,0 +1,271 @@
## Configuration file for CAVA.
# Remove the ; to change parameters.
[general]
# Smoothing mode. Can be 'normal', 'scientific' or 'waves'. DEPRECATED as of 0.6.0
; mode = normal
# Accepts only non-negative values.
; framerate = 30
# 'autosens' will attempt to decrease sensitivity if the bars peak. 1 = on, 0 = off
# new as of 0.6.0 autosens of low values (dynamic range)
# 'overshoot' allows bars to overshoot (in % of terminal height) without initiating autosens. DEPRECATED as of 0.6.0
; autosens = 1
; overshoot = 20
# Manual sensitivity in %. If autosens is enabled, this will only be the initial value.
# 200 means double height. Accepts only non-negative values.
; sensitivity = 100
# The number of bars (0-512). 0 sets it to auto (fill up console).
# Bars' width and space between bars in number of characters.
; bars = 0
; bar_width = 2
; bar_spacing = 1
# bar_height is only used for output in "noritake" format
; bar_height = 32
# For SDL width and space between bars is in pixels, defaults are:
; bar_width = 20
; bar_spacing = 5
# sdl_glsl have these default values, they are only used to calulate max number of bars.
; bar_width = 1
; bar_spacing = 0
# Lower and higher cutoff frequencies for lowest and highest bars
# the bandwidth of the visualizer.
# Note: there is a minimum total bandwidth of 43Mhz x number of bars.
# Cava will automatically increase the higher cutoff if a too low band is specified.
; lower_cutoff_freq = 50
; higher_cutoff_freq = 10000
# Seconds with no input before cava goes to sleep mode. Cava will not perform FFT or drawing and
# only check for input once per second. Cava will wake up once input is detected. 0 = disable.
; sleep_timer = 0
[input]
# Audio capturing method. Possible methods are: 'fifo', 'portaudio', 'pipewire', 'alsa', 'pulse', 'sndio', 'oss' or 'shmem'
# Defaults to 'oss', 'sndio', 'pipewire', 'pulse', 'alsa', 'portaudio' or 'fifo', in that order, dependent on what support cava was built with.
# On Mac it defaults to 'portaudio' or 'fifo'
# On windows this is automatic and no input settings are needed.
#
# All input methods uses the same config variable 'source'
# to define where it should get the audio.
#
# For pulseaudio and pipewire 'source' will be the source. Default: 'auto', which uses the monitor source of the default sink
# (all pulseaudio sinks(outputs) have 'monitor' sources(inputs) associated with them).
#
# For pipewire 'source' will be the object name or object.serial of the device to capture from.
# Both input and output devices are supported.
#
# For alsa 'source' will be the capture device.
# For fifo 'source' will be the path to fifo-file.
# For shmem 'source' will be /squeezelite-AA:BB:CC:DD:EE:FF where 'AA:BB:CC:DD:EE:FF' will be squeezelite's MAC address
#
# For sndio 'source' will be a monitor sub-device, e.g. 'snd/0.monitor'. Default: 'default', in which case a device
# should be specified with the environment variable AUDIODEVICE, e.g. on the commandline: AUDIODEVICE=snd/0.monitor cava.
#
# For oss 'source' will be the path to a audio device, e.g. '/dev/dsp2'. Default: '/dev/dsp', i.e. the default audio device.
# README.md contains further information on how to setup CAVA for OSS on FreeBSD.
#
; method = pulse
; source = auto
method = pipewire
source = auto
; method = alsa
; source = hw:Loopback,1
; method = fifo
; source = /tmp/mpd.fifo
; method = shmem
; source = /squeezelite-AA:BB:CC:DD:EE:FF
; method = portaudio
; source = auto
; method = sndio
; source = default
; method = oss
; source = /dev/dsp
# The sample rate and format can be configured for some input methods. Currently
# the following methods support such a configuration: 'fifo', 'pipewire' and 'oss'.
# Other methods ignore these settings.
#
# For 'oss' they are only preferred values, i.e. if the values are not supported
# by the chosen audio device, the device will use other supported values instead.
# Example: 48000 and 32, but the device only supports 44100 and 16, then it will
# use 44100 and 16.
#
; sample_rate = 44100
; sample_bits = 16
[output]
# Output method. Can be 'ncurses', 'noncurses', 'raw', 'noritake', 'sdl'
# or 'sdl_glsl'.
# 'noncurses' (default) uses a buffer and cursor movements to only print
# changes from frame to frame in the terminal. Uses less resources and is less
# prone to tearing (vsync issues) than 'ncurses'.
#
# 'raw' is an 8 or 16 bit (configurable via the 'bit_format' option) data
# stream of the bar heights that can be used to send to other applications.
# 'raw' defaults to 200 bars, which can be adjusted in the 'bars' option above.
#
# 'noritake' outputs a bitmap in the format expected by a Noritake VFD display
# in graphic mode. It only support the 3000 series graphical VFDs for now.
#
# 'sdl' uses the Simple DirectMedia Layer to render in a graphical context.
# 'sdl_glsl' uses SDL to create an OpenGL context. Write your own shaders or
# use one of the predefined ones.
; method = noncurses
# Orientation of the visualization. Can be 'bottom', 'top', 'left' or 'right'.
# Default is 'bottom'. Other orientations are only supported on sdl and ncruses
# output. Note: many fonts have weird glyphs for 'top' and 'right' characters,
# which can make ncurses not look right.
; orientation = bottom
# Visual channels. Can be 'stereo' or 'mono'.
# 'stereo' mirrors both channels with low frequencies in center.
# 'mono' outputs left to right lowest to highest frequencies.
# 'mono_option' set mono to either take input from 'left', 'right' or 'average'.
# set 'reverse' to 1 to display frequencies the other way around.
channels = mono
mono_option = average
; reverse = 0
# Raw output target. A fifo will be created if target does not exist.
; raw_target = /dev/stdout
# Raw data format. Can be 'binary' or 'ascii'.
; data_format = binary
# Binary bit format, can be '8bit' (0-255) or '16bit' (0-65530).
; bit_format = 16bit
# Ascii max value. In 'ascii' mode range will run from 0 to value specified here
; ascii_max_range = 1000
# Ascii delimiters. In ascii format each bar and frame is separated by a delimiters.
# Use decimal value in ascii table (i.e. 59 = ';' and 10 = '\n' (line feed)).
; bar_delimiter = 59
; frame_delimiter = 10
# sdl window size and position. -1,-1 is centered.
; sdl_width = 1000
; sdl_height = 500
; sdl_x = -1
; sdl_y= -1
; sdl_full_screen = 0
# set label on bars on the x-axis. Can be 'frequency' or 'none'. Default: 'none'
# 'frequency' displays the lower cut off frequency of the bar above.
# Only supported on ncurses and noncurses output.
; xaxis = none
# enable alacritty synchronized updates. 1 = on, 0 = off
# removes flickering in alacritty terminal emulator.
# defaults to off since the behaviour in other terminal emulators is unknown
; alacritty_sync = 0
# Shaders for sdl_glsl, located in $HOME/.config/cava/shaders
; vertex_shader = pass_through.vert
; fragment_shader = bar_spectrum.frag
; for glsl output mode, keep rendering even if no audio
; continuous_rendering = 0
# disable console blank (screen saver) in tty
# (Not supported on FreeBSD)
; disable_blanking = 0
[color]
# Colors can be one of seven predefined: black, blue, cyan, green, magenta, red, white, yellow.
# Or defined by hex code '#xxxxxx' (hex code must be within ''). User defined colors requires
# a terminal that can change color definitions such as Gnome-terminal or rxvt.
# default is to keep current terminal color
; background = default
; foreground = default
# SDL and sdl_glsl only support hex code colors, these are the default:
; background = '#111111'
; foreground = '#D3C6AA'
# Gradient mode, only hex defined colors are supported,
# background must also be defined in hex or remain commented out. 1 = on, 0 = off.
# You can define as many as 8 different colors. They range from bottom to top of screen
; gradient = 0
; gradient_count = 8
; gradient_color_1 = '#59cc33'
; gradient_color_2 = '#80cc33'
; gradient_color_3 = '#a6cc33'
; gradient_color_4 = '#cccc33'
; gradient_color_5 = '#cca633'
; gradient_color_6 = '#cc8033'
; gradient_color_7 = '#cc5933'
; gradient_color_8 = '#cc3333'
# everforest colors
gradient = 1
gradient_count = 5
gradient_color_1 = '#A8C181'
gradient_color_2 = '#BFB26D'
gradient_color_3 = '#D3A165'
gradient_color_4 = '#E18F6C'
gradient_color_5 = '#E77E7F'
[smoothing]
# Percentage value for integral smoothing. Takes values from 0 - 100.
# Higher values means smoother, but less precise. 0 to disable.
# DEPRECATED as of 0.8.0, use noise_reduction instead
; integral = 77
# Disables or enables the so-called "Monstercat smoothing" with or without "waves". Set to 0 to disable.
; monstercat = 0
; waves = 0
# Set gravity percentage for "drop off". Higher values means bars will drop faster.
# Accepts only non-negative values. 50 means half gravity, 200 means double. Set to 0 to disable "drop off".
# DEPRECATED as of 0.8.0, use noise_reduction instead
; gravity = 100
# In bar height, bars that would have been lower that this will not be drawn.
# DEPRECATED as of 0.8.0
; ignore = 0
# Noise reduction, int 0 - 100. default 77
# the raw visualization is very noisy, this factor adjusts the integral and gravity filters to keep the signal smooth
# 100 will be very slow and smooth, 0 will be fast but noisy.
noise_reduction = 40
[eq]
# This one is tricky. You can have as much keys as you want.
# Remember to uncomment more than one key! More keys = more precision.
# Look at readme.md on github for further explanations and examples.
; 1 = 1 # bass
; 2 = 1
; 3 = 1 # midtone
; 4 = 1
; 5 = 1 # treble

462
.config/dunst/dunstrc Normal file
View File

@ -0,0 +1,462 @@
# See dunst(5) for all configuration options
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a window manager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern window managers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
# follow = keyboard
### Geometry ###
# dynamic width from 0 to 300
# width = (0, 300)
# constant width of 300
width = (200, 600)
# The maximum height of a single notification, excluding the frame.
height = 300
# Position the notification in the top right corner
origin = top-right
# Offset from the origin
offset = 10x36
# Scale factor. It is auto-detected if value is 0.
scale = 1
# Maximum number of notification (0 means no limit)
notification_limit = 10
### Progress bar ###
# Turn on the progess bar. It appears when a progress hint is passed with
# for example dunstify -h int:value:12
progress_bar = true
# Set the progress bar height. This includes the frame, so make sure
# it's at least twice as big as the frame width.
progress_bar_height = 10
# Set the frame width of the progress bar
progress_bar_frame_width = 1
# Set the minimum width for the progress bar
progress_bar_min_width = 150
# Set the maximum width for the progress bar
progress_bar_max_width = 300
# Corner radius for the progress bar. 0 disables rounded corners.
progress_bar_corner_radius = 0
# Corner radius for the icon image.
icon_corner_radius = 0
# Show how many messages are currently hidden (because of
# notification_limit).
indicate_hidden = yes
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.). (X11 only)
transparency = 5
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
# If gap_size is greater than 0, this setting will be ignored.
separator_height = 2
# Padding between text and separator.
padding = 15
# Horizontal padding.
horizontal_padding = 15
# Padding between text and icon.
text_icon_padding = 0
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 3
# Defines color of the frame around the notification window.
frame_color = "#7A8478"
# Size of gap to display between notifications - requires a compositor.
# If value is greater than 0, separator_height will be ignored and a border
# of size frame_width will be drawn around each notification instead.
# Click events on gaps do not currently propagate to applications below.
gap_size = 0
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
# A client can set the 'transient' hint to bypass this. See the rules
# section for how to disable this if necessary
# idle_threshold = 120
### Text ###
font = JetBrainsMonoNL Nerd Font Mono 12
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
line_height = 2
# Possible values are:
# full: Allow a small subset of html markup in notifications:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <https://docs.gtk.org/Pango/pango_markup.html>.
#
# strip: This setting is provided for compatibility with some broken
# clients that send markup even though it's not enabled on the
# server. Dunst will try to strip the markup but the parsing is
# simplistic so using this option outside of matching rules for
# specific applications *IS GREATLY DISCOURAGED*.
#
# no: Disable markup parsing, incoming notifications will be treated as
# plain text. Dunst will not advertise that it has the body-markup
# capability if this is set as a global setting.
#
# It's important to note that markup inside the format option will be parsed
# regardless of what this is set to.
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%s</b>\n%b\n"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Vertical alignment of message text and icon.
# Possible values are "top", "center" and "bottom".
vertical_alignment = top
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60
# Specify where to make an ellipsis in long lines.
# Possible values are "start", "middle" and "end".
ellipsize = end
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Stack together notifications with the same content
stack_duplicates = true
# Hide the count of stacked notifications with the same content
hide_duplicate_count = false
# Display indicators for URLs (U) and actions (A).
show_indicators = yes
### Icons ###
# Recursive icon lookup. You can set a single theme, instead of having to
# define all lookup paths.
enable_recursive_icon_lookup = true
# Set icon theme (only used for recursive icon lookup)
icon_theme = Reversal-black-dark
# You can also set multiple icon themes, with the leftmost one being used first.
# icon_theme = "Adwaita, breeze"
# Align icons left/right/top/off
icon_position = left
# Scale small icons up to this size, set to 0 to disable. Helpful
# for e.g. small files or high-dpi screens. In case of conflict,
# max_icon_size takes precedence over this.
min_icon_size = 22
# Scale larger icons down to this size, set to 0 to disable
max_icon_size = 128
# Paths to default icons (only neccesary when not using recursive icon lookup)
#icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
icon_path = ~/.local/share/icons/Reversal-black-dark/devices/16/
### History ###
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = yes
# Maximum amount of notifications kept in history
history_length = 50
### Misc/Advanced ###
# dmenu path.
dmenu = /usr/bin/rofi -dmenu -p " 󰎟 dunst "
# Browser for opening urls in context menu.
browser = /usr/bin/xdg-open
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = dunst
# Define the class of the windows spawned by dunst
class = dunst
# Define the corner radius of the notification window
# in pixel size. If the radius is 0, you have no rounded
# corners.
# The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons.
corner_radius = 0
# Ignore the dbus closeNotification message.
# Useful to enforce the timeout set by dunst configuration. Without this
# parameter, an application may close the notification sent before the
# user defined timeout.
ignore_dbusclose = false
### Wayland ###
# These settings are Wayland-specific. They have no effect when using X11
# Uncomment this if you want to let notications appear under fullscreen
# applications (default: overlay)
# layer = top
# Set this to true to use X11 output on Wayland.
force_xwayland = false
### Legacy
# Use the Xinerama extension instead of RandR for multi-monitor support.
# This setting is provided for compatibility with older nVidia drivers that
# do not support RandR and using it on systems that support RandR is highly
# discouraged.
#
# By enabling this setting dunst will not be able to detect when a monitor
# is connected or disconnected which might break follow mode if the screen
# layout changes.
force_xinerama = false
### mouse
# Defines list of actions for each mouse event
# Possible values are:
# * none: Don't do anything.
# * do_action: Invoke the action determined by the action_name rule. If there is no
# such action, open the context menu.
# * open_url: If the notification has exactly one url, open it. If there are multiple
# ones, open the context menu.
# * close_current: Close current notification.
# * close_all: Close all notifications.
# * context: Open context menu for the notification.
# * context_all: Open context menu for all notifications.
# These values can be strung together for each mouse event, and
# will be executed in sequence.
mouse_left_click = do_action, close_current
mouse_middle_click = close_all
mouse_right_click = close_current
# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
# Calculate the dpi to use on a per-monitor basis.
# If this setting is enabled the Xft.dpi value will be ignored and instead
# dunst will attempt to calculate an appropriate dpi value for each monitor
# using the resolution and physical size. This might be useful in setups
# where there are multiple screens with very different dpi values.
per_monitor_dpi = false
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#232A2E"
foreground = "#D3C6AA" #gray2#
highlight = "#A7C080"
timeout = 10
# Icon for notifications with low urgency, uncomment to enable
#default_icon = /path/to/icon
[urgency_normal]
background = "#232A2E"
foreground = "#D3C6AA" #bejsikFG#
highlight = "#A7C080"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
#default_icon = /path/to/icon
[urgency_critical]
background = "#232A2E"
foreground = "#E69875" #orange#
frame_color = "#E67E80" #red#
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable
#default_icon = /path/to/icon
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
#
# Messages can be matched by
# appname (discouraged, see desktop_entry)
# body
# category
# desktop_entry
# icon
# match_transient
# msg_urgency
# stack_tag
# summary
#
# and you can override the
# background
# foreground
# format
# frame_color
# fullscreen
# new_icon
# set_stack_tag
# set_transient
# set_category
# timeout
# urgency
# icon_position
# skip_display
# history_ignore
# action_name
# word_wrap
# ellipsize
# alignment
# hide_text
#
# Shell-like globbing will get expanded.
#
# Instead of the appname filter, it's recommended to use the desktop_entry filter.
# GLib based applications export their desktop-entry name. In comparison to the appname,
# the desktop-entry won't get localized.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
# Disable the transient hint so that idle_threshold cannot be bypassed from the
# client
#[transient_disable]
# match_transient = yes
# set_transient = no
#
# Make the handling of transient notifications more strict by making them not
# be placed in history.
#[transient_history_ignore]
# match_transient = yes
# history_ignore = yes
# fullscreen values
# show: show the notifications, regardless if there is a fullscreen window opened
# delay: displays the new notification, if there is no fullscreen window active
# If the notification is already drawn, it won't get undrawn.
# pushback: same as delay, but when switching into fullscreen, the notification will get
# withdrawn from screen again and will get delayed like a new notification
#[fullscreen_delay_everything]
# fullscreen = delay
#[fullscreen_show_critical]
# msg_urgency = critical
# fullscreen = show
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# skip_display = true
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[skip-display]
# # This notification will not be displayed, but will be included in the history
# summary = "foobar"
# skip_display = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
#[stack-volumes]
# appname = "some_volume_notifiers"
# set_stack_tag = "volume"
#
# vim: ft=cfg

259
.config/polybar/config.ini Normal file
View File

@ -0,0 +1,259 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/polybar/polybar
;
; The README contains a lot of information
;
;==========================================================
[colors]
background = #000000
background-alt = #373B41
foreground = #C5C8C6
primary = #A7C080
secondary = #8ABEB7
alert = #A54242
disabled = #707880
[bar/primary]
width = 100%
height = 24pt
radius = 0
monitor = DP-2
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 0pt
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = "JetBrainsMonoNL Nerd Font Mono:pixelsize=12;2"
modules-left = bspwm xwindow
modules-center = date
modules-right = music filesystem memory cpu wlan
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
wm-restack = bspwm
wm-name = bspwm
; wm-restack = i3
; override-redirect = true
[bar/secondary]
width = 100%
height = 24pt
radius = 0
monitor = HDMI-0
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 0pt
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = "JetBrainsMonoNL Nerd Font Mono:pixelsize=12;2"
modules-left = bspwm xwindow
modules-center = date
modules-right = music filesystem memory cpu wlan
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
wm-restack = bspwm
wm-name = bspwm
; wm-restack = i3
; override-redirect = true
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 16pt
[module/bspwm]
type = internal/bspwm
pin-workspaces = true
format = <label-state>
label-focused = " %name% "
label-focused-foreground = ${colors.background}
label-focused-background = ${colors.primary}
label-occupied = " %name% "
label-empty = " %name% "
label-urgent = " %name% "
label-dimmed = " %name% "
label-dimmed-foreground = ${colors.foreground}
label-dimmed-underline = ${bar/top.background}
label-dimmed-focused = " %name% "
label-dimmed-focused-background = ${colors.secondary}
label-dimmed-focused-foreground = ${colors.background}
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
[module/music]
type = custom/script
exec = ~/.config/polybar/scripts/player-mpris-tail/player-mpris-tail.py -f '%{F#A7C080}{icon}%{F-} {artist} - {title}' --icon-playing  --icon-paused  --icon-none 󰎊 --icon-stopped 
tail = true
click-middle = ~/.config/polybar/scripts/player-mpris-tail/player-mpris-tail.py previous &
click-right = ~/.config/polybar/scripts/player-mpris-tail/player-mpris-tail.py next &
click-left = ~/.config/polybar/scripts/player-mpris-tail/player-mpris-tail.py play-pause &
icon-playing =
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#A7C080}%mountpoint%%{F-} %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled}
[module/redshift]
type = custom/script
format-prefix = " "
exec = source ~/.config/polybar/scripts/polybar-redshift/env.sh && ~/.config/polybar/scripts/polybar-redshift/redshift.sh temperature
click-left = source ~/.config/polybar/scripts/polybar-redshift/env.sh && ~/.config/polybar/polybar-redshift/scripts/redshift.sh toggle
scroll-up = source ~/.config/polybar/scripts/polybar-redshift/env.sh && ~/.config/polybar/scripts/polybar-redshift/redshift.sh increase
scroll-down = source ~/.config/polybar/scripts/polybar-redshift/env.sh && ~/.config/polybar/scripts/polybar-redshift/redshift.sh decrease
interval=0.5
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "vol "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ${colors.disabled}
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
label-layout = %layout%
label-layout-foreground = ${colors.primary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-foreground = ${colors.background}
label-indicator-background = ${colors.secondary}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "ram "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "cpu "
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#A7C080}%ifname%%{F#707880} disconnected
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %{F#A7C080}%ifname%%{F-} %essid% %local_ip%
[module/eth]
inherit = network-base
interface-type = wired
label-connected = %{F#A7C080}%ifname%%{F-} %local_ip%
[module/date]
type = internal/date
interval = 1
date = %A, %d %B %H:%M
date-alt = %Y-%m-%d %H:%M:%S
label = %date%
label-foreground = ${colors.primary}
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini

View File

@ -0,0 +1,15 @@
# Script: battery-combined-shell
A shell script that shows the battery status.
It supports two rechargeable batteries and changing icons. It works even if only one battery is used.
## Module
```ini
[module/battery-combined-shell]
type = custom/script
exec = ~/polybar-scripts/battery-combined-shell.sh
interval = 10
```

View File

@ -0,0 +1,61 @@
#!/bin/sh
PATH_AC="/sys/class/power_supply/AC"
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
ac=0
battery_level_0=0
battery_level_1=0
battery_max_0=0
battery_max_1=0
if [ -f "$PATH_AC/online" ]; then
ac=$(cat "$PATH_AC/online")
fi
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
fi
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
fi
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
fi
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
fi
battery_level=$(("$battery_level_0 + $battery_level_1"))
battery_max=$(("$battery_max_0 + $battery_max_1"))
battery_percent=$(("$battery_level * 100"))
battery_percent=$(("$battery_percent / $battery_max"))
if [ "$ac" -eq 1 ]; then
icon="#1"
if [ "$battery_percent" -gt 97 ]; then
echo "$icon"
else
echo "$icon $battery_percent %"
fi
else
if [ "$battery_percent" -gt 85 ]; then
icon="#21"
elif [ "$battery_percent" -gt 60 ]; then
icon="#22"
elif [ "$battery_percent" -gt 35 ]; then
icon="#23"
elif [ "$battery_percent" -gt 10 ]; then
icon="#24"
else
icon="#25"
fi
echo "$icon $battery_percent %"
fi

View File

@ -0,0 +1,31 @@
# Script: battery-combined-tlp
A shell script that shows the battery status.
It uses TLP and requires root privileges. Note that the icon doesn't change.
![battery-combined-tlp](screenshots/1.png)
## Dependencies
* `tlp`
## Configuration
You have to add the `tlp-stat` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /usr/bin/tlp-stat
```
## Module
```ini
[module/battery-combined-tlp]
type = custom/script
exec = ~/polybar-scripts/battery-combined-tlp.sh
interval = 10
```

View File

@ -0,0 +1,5 @@
#!/bin/sh
battery=$(sudo tlp-stat -b | tac | grep -m 1 "Charge" | tr -d -c "[:digit:],.")
echo "# $battery %"

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

View File

@ -0,0 +1,4 @@
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", \
RUN+="/home/user/.config/polybar/battery-combined-udev.sh --update"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", \
RUN+="/home/user/.config/polybar/battery-combined-udev.sh --update"

View File

@ -0,0 +1,22 @@
# Script: battery-combined-udev
A shell script that shows the battery status. This is an extended version of [battery-combined-shell](../battery-combined-shell).
It supports two rechargeable batteries and changing icons. It works even if only one battery is used.
This script is able to display power supply changes in real time. For this udev is being used.
## Configuration
Copy `95-battery.rules` to `/etc/udev/rules.d/95-battery.rules`. Make sure that the paths in the file have been modified properly.
## Module
```ini
[module/battery-combined-udev]
type = custom/script
exec = ~/polybar-scripts/battery-combined-udev.sh
tail = true
```

View File

@ -0,0 +1,88 @@
#!/bin/sh
battery_print() {
PATH_AC="/sys/class/power_supply/AC"
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
ac=0
battery_level_0=0
battery_level_1=0
battery_max_0=0
battery_max_1=0
if [ -f "$PATH_AC/online" ]; then
ac=$(cat "$PATH_AC/online")
fi
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
fi
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
fi
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
fi
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
fi
battery_level=$(("$battery_level_0 + $battery_level_1"))
battery_max=$(("$battery_max_0 + $battery_max_1"))
battery_percent=$(("$battery_level * 100"))
battery_percent=$(("$battery_percent / $battery_max"))
if [ "$ac" -eq 1 ]; then
icon="#1"
if [ "$battery_percent" -gt 97 ]; then
echo "$icon"
else
echo "$icon $battery_percent %"
fi
else
if [ "$battery_percent" -gt 85 ]; then
icon="#21"
elif [ "$battery_percent" -gt 60 ]; then
icon="#22"
elif [ "$battery_percent" -gt 35 ]; then
icon="#23"
elif [ "$battery_percent" -gt 10 ]; then
icon="#24"
else
icon="#25"
fi
echo "$icon $battery_percent %"
fi
}
path_pid="/tmp/polybar-battery-combined-udev.pid"
case "$1" in
--update)
pid=$(cat $path_pid)
if [ "$pid" != "" ]; then
kill -10 "$pid"
fi
;;
*)
echo $$ > $path_pid
trap exit INT
trap "echo" USR1
while true; do
battery_print
sleep 30 &
wait
done
;;
esac

View File

@ -0,0 +1,29 @@
# Script: battery-cyberpower
A shell script that shows the battery status for CyberPower UPS devices.
This script is able to display power supply changes in real time.
## Dependencies
* `pwrstat` from CyberPower's website
## Configuration
You have to add the `pwrstat` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /usr/bin/pwrstat
```
## Module
```ini
[module/battery-cyberpower]
type = custom/script
exec = ~/polybar-scripts/battery-cyberpower.sh
tail = true
```

View File

@ -0,0 +1,56 @@
#!/bin/sh
ICON_AC="#1"
ICON_BATTERY_FULL="#21"
ICON_BATTERY_GOOD="#22"
ICON_BATTERY_LOW="#23"
ICON_BATTERY_CAUTION="#24"
ICON_BATTERY_EMPTY="#25"
SHOW_ESTIMATION=1
battery_print() {
battery_info="$(sudo pwrstat -status)"
battery_capacity="$(echo "$battery_info" | awk '/Capacity/{print $3}')"
battery_ac="$(echo "$battery_info" | awk '/Power Supply by/{print $4,$5}')"
battery_load="$(echo "$battery_info" | grep "Load" | cut -d \( -f 2 | tr -d ' %)')"
battery_remaining="$(echo "$battery_info" | awk '/Remaining Runtime/{print $3}')"
output=""
if [ "$battery_ac" = "Utility Power" ]; then
if [ "$battery_capacity" -gt 97 ]; then
output="$ICON_AC"
else
output="$ICON_AC $battery_capacity %"
fi
else
if [ "$battery_capacity" -gt 85 ]; then
output="$ICON_BATTERY_FULL $battery_capacity %"
elif [ "$battery_capacity" -gt 60 ]; then
output="$ICON_BATTERY_GOOD $battery_capacity %"
elif [ "$battery_capacity" -gt 35 ]; then
output="$ICON_BATTERY_LOW $battery_capacity %"
elif [ "$battery_capacity" -gt 10 ]; then
output="$ICON_BATTERY_CAUTION $battery_capacity %"
else
output="$ICON_BATTERY_EMPTY $battery_capacity %"
fi
fi
if [ "$SHOW_ESTIMATION" -eq 1 ]; then
output="$output ($battery_load % / $battery_remaining min)"
fi
echo "$output"
}
trap exit INT
trap "echo" USR1
while true; do
battery_print "$@"
sleep 30 &
wait
done

View File

@ -0,0 +1,16 @@
# Script: dunst-snooze
A script to disable/enable Dunst notifications. When disabled, notifications will still be created and saved by dunst until you enable it again.
![dunst-pause](screenshots/1.png)
![dunst-pause](screenshots/2.png)
## Module
```ini
[module/dunst-snooze]
type = custom/script
exec = ~/polybar-scripts/dunst-snooze.sh
interval = 10
click-left = ~/polybar-scripts/dunst-snooze.sh --toggle &
```

View File

@ -0,0 +1,14 @@
#!/bin/sh
case "$1" in
--toggle)
dunstctl set-paused toggle
;;
*)
if [ "$(dunstctl is-paused)" = "true" ]; then
echo "#1"
else
echo "#2"
fi
;;
esac

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

View File

@ -0,0 +1,44 @@
# Script: easteregg-pornhub
A script that shows a button and opens a random video at a large porn website.
![easteregg-pornhub](screenshots/1.png)
## Configuration
Set your browser at the `click-left` option in your module.
You should also enable the overline and underline option in your polybar.
```ini
[bar/barname]
overline-size = 5
underline-size = 4
```
## Module
```ini
[module/easteregg-pornhub]
type = custom/script
exec = echo " hub "
interval = 3600
click-left = "firefox --private-window https://pornhub.com/random" &
format = <label>
format-prefix = " Porn "
format-prefix-foreground = #ffffff
format-prefix-background = #000000
format-overline = #000000
format-underline = #000000
format-foreground = #000000
format-background = #ffa500
format-suffix = " "
format-suffix-background = #000000
format-suffix-foreground = #000000
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,29 @@
# Script: inbox-imap-pythongpg
A script that shows if there are unread mails in your IMAPs inbox. Passwords are encrypted with gpg.
![inbox-imap-pythongpg](screenshots/1.png)
## Configuration
You must have a gpg key to secure your password in configuration files. Encrypt your password using your gpg key like this.
```ini
echo 'your password' > /tmp/imappass
gpg -er 'your gpg keyid' /tmp/imappass
mv /tmp/imappass.gpg ~/.imappass.gpg
shred /tmp/imappass && rm /tmp/imappass
```
For Gmail, you must allow [less secure apps](https://myaccount.google.com/security#connectedapps).
## Module
```ini
[module/inbox-imap-pythongpg]
type = custom/script
exec = ~/polybar-scripts/inbox-imap-pythongpg.py
interval = 60
```

View File

@ -0,0 +1,14 @@
#!/usr/bin/python
import imaplib
import os
import subprocess
completed_process = subprocess.run(['gpg', '-dq', os.path.join(os.getenv('HOME'), '.imappass.gpg')], check=True, stdout=subprocess.PIPE, encoding="utf-8");
password = completed_process.stdout[:-1]
obj = imaplib.IMAP4_SSL('imap.mail.net', 993)
# Only put your email address below.
obj.login('your email address', password)
obj.select()
print(len(obj.search(None, 'unseen')[1][0].split()))

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

View File

@ -0,0 +1,3 @@
machine mail.server.tld
login username
password supersecretpw

View File

@ -0,0 +1,27 @@
# Script: inbox-imap-shellnetrc
A script that shows if there are unread mails in your IMAP inbox.
This script actually use IMAPs. `curl` can also handle unencrypted IMAP. You only need to change the protocol in the command.
The login data is stored in a `.netrc`. This is more secure because the password is not visible in the process list.
## Dependencies
* `curl`
## Configuration
For Gmail, you must allow [less secure apps](https://myaccount.google.com/security#connectedapps).
## Module
```ini
[module/inbox-imap-shellnetrc]
type = custom/script
exec = ~/polybar-scripts/inbox-imap-shellnetrc.sh
interval = 60
```

View File

@ -0,0 +1,12 @@
#!/bin/sh
SERVER=""
NETRC=".netrc"
inbox=$(curl -sf --netrc-file "$NETRC" -X "STATUS INBOX (UNSEEN)" imaps://"$SERVER"/INBOX | tr -d -c "[:digit:]")
if [ "$inbox" ] && [ "$inbox" -gt 0 ]; then
echo "# $inbox"
else
echo ""
fi

View File

@ -0,0 +1,22 @@
# Script: inbox-imap-shellpass
A script that shows if there are unread mails in your IMAP inbox.
This script actually use IMAPs. `curl` can also handle unencrypted IMAP. You only need to change the protocol in the command.
The login data can be stored in your `pass` password manager.
## Dependencies
* `curl`
## Module
```ini
[module/inbox-imap-shellpass]
type = custom/script
exec = ~/polybar-scripts/inbox-imap-shellpass.sh
interval = 60
```

View File

@ -0,0 +1,19 @@
#!/bin/sh
SERVER=""
LOGIN=""
PASS=""
KEYGRIP=""
if [ "$(gpg-connect-agent 'keyinfo --list' /bye | grep "$KEYGRIP" | awk '{ print $7 }')" = 1 ]; then
password=$(pass show "$PASS" | head -n 1)
inbox=$(echo "user = \"$LOGIN:$password\"" | curl -sf -K- -X "STATUS INBOX (UNSEEN)" imaps://"$SERVER"/INBOX | tr -d -c "[:digit:]")
if [ "$inbox" ] && [ "$inbox" -gt 0 ]; then
echo "# $inbox"
else
echo ""
fi
else
echo ""
fi

View File

@ -0,0 +1,3 @@
machine mail.server.tld
login username
password supersecretpw

View File

@ -0,0 +1,22 @@
# Script: inbox-pop3-shellnetrc
A script that shows if there are unread mails in your POP3 inbox.
This script actually use POP3s. `curl` can also handle unencrypted POP3. You only need to change the protocol in the command.
The login data is stored in a `.netrc`. This is more secure because the password is not visible in the process list.
## Dependencies
* `curl`
## Module
```ini
[module/inbox-pop3-shellnetrc]
type = custom/script
exec = ~/polybar-scripts/inbox-pop3-shellnetrc.sh
interval = 60
```

View File

@ -0,0 +1,12 @@
#!/bin/sh
SERVER=""
NETRC=".netrc"
inbox=$(curl -sf --netrc-file "$NETRC" pop3s://"$SERVER" | wc -l)
if [ "$inbox" -gt 0 ]; then
echo "# $inbox"
else
echo ""
fi

View File

@ -0,0 +1,30 @@
# Script: info-airqualityindex
A script that shows the local World Air Quality Index. It's an indicator for the air pollution.
![info-airqualityindex](screenshots/1.png)
## Dependencies
* `curl`
* `jq`
## Configuration
You need an API token. [Request one](https://aqicn.org/data-platform/token/).
Choose a city and make sure that the result is what you expect. `berlin` is a valid `CITY` here: http://aqicn.org/city/berlin/. Or use the [map](https://aqicn.org/map/) to find a monitoring station near you. `germany/berlin/friedrichshain-frankfurter-allee` works also as `CITY`.
If `CITY` is left empty, the location is retrieved via the Mozilla Location API.
## Module
```ini
[module/info-airqualityindex]
type = custom/script
exec = ~/polybar-scripts/info-airqualityindex.sh
interval = 600
```

View File

@ -0,0 +1,41 @@
#!/bin/sh
TOKEN=""
CITY=""
API="https://api.waqi.info/feed"
if [ -n "$CITY" ]; then
aqi=$(curl -sf "$API/$CITY/?token=$TOKEN")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ -n "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
aqi=$(curl -sf "$API/geo:$location_lat;$location_lon/?token=$TOKEN")
fi
fi
if [ -n "$aqi" ]; then
if [ "$(echo "$aqi" | jq -r '.status')" = "ok" ]; then
aqi=$(echo "$aqi" | jq '.data.aqi')
if [ "$aqi" -lt 50 ]; then
echo "%{F#009966}#%{F-} $aqi"
elif [ "$aqi" -lt 100 ]; then
echo "%{F#ffde33}#%{F-} $aqi"
elif [ "$aqi" -lt 150 ]; then
echo "%{F#ff9933}#%{F-} $aqi"
elif [ "$aqi" -lt 200 ]; then
echo "%{F#cc0033}#%{F-} $aqi"
elif [ "$aqi" -lt 300 ]; then
echo "%{F#660099}#%{F-} $aqi"
else
echo "%{F#7e0023}#%{F-} $aqi"
fi
else
echo "$aqi" | jq -r '.data'
fi
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,15 @@
# Script: info-camera-mic
A shell script for displaying an indicator of camera and microphone usage.
![info-camera-mic](screenshots/1.png)
## Module
```ini
[module/info-camera-mic]
type = custom/script
exec = ~/polybar-scripts/info-camera-mic.sh
interval = 5
```

View File

@ -0,0 +1,11 @@
#!/bin/sh
if lsof /dev/video0 >/dev/null 2>&1; then
camera="#1"
fi
if pacmd list-sources 2>&1 | grep -q RUNNING; then
mic="#2"
fi
echo "$camera $mic"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,29 @@
# Script: info-cava
A simple script that runs a small audio visualizer using cava on your taskbar
![info-cava](screenshots/1.png)
## Dependencies
* [`cava`](https://github.com/karlstav/cava)
## Configuration
Configuration can be made by providing the following command line arguments:
* `-f`|`--framerate FRAMERATE` : Framerate to be used by cava, default is 60.
* `-b`|`--bars BARS`: Amount of bars, default is 8.
* `-e`|`--extra_colors EXTRA_COLORS`: Color gradient used on higher values, separated by commas, default is `fdd,fcc,fbb,faa`, spaces and #s are ignored.
* `-c`|`--channels {stereo,left,right,average}`: Audio channels to be used, defaults to stereo.
## Module
```ini
[module/info-cava]
type = custom/script
exec = ~/polybar-scripts/info-cava.py -f 24 -b 12 -e fffdfc,fffafe,ffeafa,ffc3d2 -c average
tail = true
```

View File

@ -0,0 +1,75 @@
#!/bin/env python3
import argparse
import os
import signal
import subprocess
import sys
import tempfile
if len(sys.argv) > 1 and sys.argv[1] == '--subproc':
ramp_list = [' ', '', '', '', '', '', '', '', '']
ramp_list.extend(
f'%{{F#{color.strip(" #")}}}█%{{F-}}'
for color in sys.argv[2].split(',')
if color
)
while True:
cava_input = input().strip().split()
cava_input = [int(i) for i in cava_input]
output = ''
for bar in cava_input:
if bar < len(ramp_list):
output += ramp_list[bar]
else:
output += ramp_list[-1]
print(output)
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--framerate', type=int, default=60,
help='Framerate to be used by cava, default is 60')
parser.add_argument('-b', '--bars', type=int, default=8,
help='Amount of bars, default is 8')
parser.add_argument('-e', '--extra_colors', default='fdd,fcc,fbb,faa',
help='Color gradient used on higher values, separated by commas, default is')
parser.add_argument('-c', '--channels', choices=['stereo', 'left', 'right', 'average'],
help='Audio channels to be used, defaults to stereo')
opts = parser.parse_args()
conf_channels = ''
if opts.channels != 'stereo':
conf_channels = (
'channels=mono\n'
f'mono_option={opts.channels}'
)
conf_ascii_max_range = 12 + len([i for i in opts.extra_colors.split(',') if i])
cava_conf = tempfile.mkstemp('','polybar-cava-conf.')[1]
with open(cava_conf, 'w') as cava_conf_file:
cava_conf_file.write(
'[general]\n'
f'framerate={opts.framerate}\n'
f'bars={opts.bars}\n'
'[output]\n'
'method=raw\n'
'data_format=ascii\n'
f'ascii_max_range={conf_ascii_max_range}\n'
'bar_delimiter=32\n'
+ conf_channels
)
cava_proc = subprocess.Popen(['cava', '-p', cava_conf], stdout=subprocess.PIPE)
self_proc = subprocess.Popen(['python3', __file__, '--subproc', opts.extra_colors], stdin=cava_proc.stdout)
def cleanup(sig, frame):
os.remove(cava_conf)
cava_proc.kill()
self_proc.kill()
sys.exit(0)
signal.signal(signal.SIGTERM, cleanup)
signal.signal(signal.SIGINT, cleanup)
self_proc.wait()

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,26 @@
# Script: info-docker
Shows the number of Docker containers in one of the states: `created`, `restarting`, `running`, `removing`, `paused`, `exited`, `dead`
![info-docker](screenshots/1.png)
## Configuration
You have to add the `docker` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /usr/bin/docker ps -qf status=running
user ALL=(ALL) NOPASSWD: /usr/bin/docker ps -qf status=exited
user ALL=(ALL) NOPASSWD: /usr/bin/docker ps -qf status=dead
```
## Module
```ini
[module/info-docker]
type = custom/script
exec = ~/polybar-scripts/info-docker.sh
interval = 60
```

View File

@ -0,0 +1,9 @@
#!/bin/sh
STATUS="running exited dead"
for stat in $STATUS; do
output="$output $(sudo docker ps -qf status="$stat" | wc -l) |"
done
echo "|$output"

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

View File

@ -0,0 +1,20 @@
# Script: info-dualshock4
A shell script that shows the battery level of a DualShock 4 Controller.
![info-dualshock4](screenshots/1.png)
## Configuration
The Icon is from [Font Awesome 5](https://fontawesome.com/icons/playstation?style=brands).
## Module
```ini
[module/battery-dualshock4]
type= custom/script
exec = ~/polybar-scripts/info-dualshock4.sh
interval = 10
```

View File

@ -0,0 +1,5 @@
#!/bin/sh
for i in /sys/class/power_supply/sony_controller_battery_*/capacity; do
echo "# $(cat /sys/class/power_supply/sony_controller_battery_"$i"/capacity)%"
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,18 @@
# Script: info-ethermine
This script reports the current hashrate (in MH/s) for your ethermine account.
## Dependencies
* `python-requests`
## Module
```ini
[module/info-ethermine]
type = custom/script
exec = ~/polybar-scripts/info-ethermine.sh
interval = 60
```

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python3
import requests
miner = ""
data = requests.get(f"https://api.ethermine.org/miner/{miner}/dashboard").json()['data']['statistics']
data = data[-1]
current_hash_rate = data["currentHashrate"]
currentMHs = round(current_hash_rate/1e6, 1)
print(f"{currentMHs}MH/s")

View File

@ -0,0 +1,15 @@
# Script: info-eyestrain
A script for avoiding digital eye strain.
It follows the 20-20-20 rule. The timer displays how long it is until the next break. You can add this to send a notification and play a sound when the time is up.
## Module
```ini
[module/info-eyestrain]
type = custom/script
exec = ~/polybar-scripts/info-eyestrain.sh
interval = 60
```

View File

@ -0,0 +1,10 @@
#!/bin/sh
time=$((20 - $(date '+%-M') % 20))
#if [ $time -eq 20 ]; then
# notify-send 'Break' &
# ogg123 beep.ogg &> /dev/null &
#fi
echo "$time"

View File

@ -0,0 +1,25 @@
# Script: info-gitlab-pipelines
Displays the number of succeeded, running and failed gitlab-pipelines triggered by a user.
![info-gitlab-pipelines](screenshots/1.png)
## Dependencies
* jq
## Configuration
Insert the specific server-url, username and your GitLab token (Settings -> Access Token).
## Module
```ini
[module/info-gitlab-pipelines]
type = custom/script
exec = ~/polybar-scripts/info-gitlab-pipelines.sh
interval = 30
...

View File

@ -0,0 +1,23 @@
#!/bin/sh
GITLAB_USERNAME=""
GITLAB_SERVER="https://gitlab.com"
GITLAB_ACCESS_TOKEN=""
HOURS_AGO="6"
available_projects=$(curl -sH "Private-Token: $GITLAB_ACCESS_TOKEN" \
"$GITLAB_SERVER/api/v4/projects?membership=true" | jq '.[] | .id')
time=$(date -d "$HOURS_AGO hours ago" -Iseconds)
get_pipelines(){
curl -sH "Private-Token: $GITLAB_ACCESS_TOKEN" \
"$GITLAB_SERVER/api/v4/projects/$id/pipelines?username=$GITLAB_USERNAME&status=$1&updated_after=$time"| jq length
}
for id in $available_projects; do
success=$((success + $(get_pipelines "success")))
running=$((running + $(get_pipelines "running")))
failed=$((failed + $(get_pipelines "failed")))
done
echo "|%{F#7cfc00}$success%{F-}|%{F#ffff00}$running%{F-}|%{F#f00}$failed%{F-}|"

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

View File

@ -0,0 +1,33 @@
# Script: info-hackspeed
A small script that shows your typing speed. Happy Hacking!
![info-hackspeed](screenshots/1.png)
## Dependencies
* `xorg-xinput`
* `awk`
* coreutils (`rm`, `stdbuf`, `mktemp`, `stat`, you probably have this)
## Configuration
* `KEYBOARD_ID`: name of your keyboard. See Setup above. Default: `AT Translated Set 2 keyboard`
* `METRIC`: either `cpm` (characters per minute) of `wpm` ([words per minute, 1 word = 5 characters](https://en.wikipedia.org/wiki/Words_per_minute)). Default: `cpm`
* `FORMAT`: format string according to which the metric will be output. Default: `# %d $METRIC`
* `INTERVAL`: amount of seconds to gather data. Default: 20
* `LAYOUT`: keyboard layout, to be able to only count letters and numbers. Currently supported are `qwerty`, `azerty`, `qwertz` and `dvorak`. If you have a different layout, please contribute a condition for it! See the script's source code. Use the special value `dontcare` to count all keys, not just letters and numbers. Default: `qwerty`
If after 20 seconds the value stays at 0 even though you're typing, you may have to configure the name of your keyboard. Change the setting `KEYBOARD_ID` (see Configuration below) in the script. You can find your keyboard description with `xinput list --short`.
## Module
```ini
[module/info-hackspeed]
type = custom/script
exec = ~/polybar-scripts/info-hackspeed.sh
tail = true
```

View File

@ -0,0 +1,64 @@
#!/bin/sh
# shellcheck disable=SC2016,SC2059
KEYBOARD_ID="AT Translated Set 2 keyboard"
# cpm: characters per minute
# wpm: words per minute (1 word = 5 characters)
METRIC=cpm
FORMAT="# %d $METRIC"
INTERVAL=20
# If you have a keyboard layout that is not listed here yet, create a condition
# yourself. $3 is the key index. Use `xinput test "AT Translated Set 2 keyboard"`
# to see key codes in real time. Be sure to open a pull request for your
# layout's condition!
LAYOUT=qwerty
case "$LAYOUT" in
qwerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 53) || ($3 >= 52 && $3 <= 58)'; ;;
azerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 54) || ($3 >= 52 && $3 <= 57)'; ;;
qwertz) CONDITION='($3 >= 10 && $3 <= 20) || ($3 >= 24 && $3 <= 34) || ($3 == 36) || ($3 >= 38 && $3 <= 48) || ($3 >= 52 && $3 <= 58)'; ;;
dvorak) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 27 && $3 <= 33) || ($3 >= 38 && $3 <= 47) || ($3 >= 53 && $3 <= 61)'; ;;
dontcare) CONDITION='1'; ;; # Just register all key presses, not only letters and numbers
*) echo "Unsupported layout \"$LAYOUT\""; exit 1; ;;
esac
# We have to account for the fact we're not listening a whole minute
multiply_by=60
divide_by=$INTERVAL
case "$METRIC" in
wpm) divide_by=$((divide_by * 5)); ;;
cpm) ;;
*) echo "Unsupported metric \"$METRIC\""; exit 1; ;;
esac
hackspeed_cache="$(mktemp -p '' hackspeed_cache.XXXXX)"
trap 'rm "$hackspeed_cache"' EXIT
# Write a dot to our cache for each key press
printf '' > "$hackspeed_cache"
xinput test "$KEYBOARD_ID" | \
stdbuf -o0 awk '$1 == "key" && $2 == "press" && ('"$CONDITION"') {printf "."}' >> "$hackspeed_cache" &
while true; do
# Ask the kernel how big the file is with the command `stat`. The number we
# get is the file size in bytes, which equals the amount of dots the file
# contains, and hence how much keys were pressed since the file was last
# cleared.
lines=$(stat --format %s "$hackspeed_cache")
# Truncate the cache file so that in the next iteration, we count only new
# keypresses
printf '' > "$hackspeed_cache"
# The shell only does integer operations, so make sure to first multiply and
# then divide
value=$((lines * multiply_by / divide_by))
printf "$FORMAT\\n" "$value"
sleep $INTERVAL
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

View File

@ -0,0 +1,31 @@
# Script: info-healthchecks.io
Shows the health of your services registered with [healthchecks.io](https://healthchecks.io).
![info-healthchecks.io](screenshots/1.png)
## Dependencies
* `jq`
* `curl`
## Configuration
Modify any of the all-caps variables to configure the script:
* `API_KEY`: Your [healthchecks.io](https://healthchecks.io) API key. These are project specific and can be generated on the project settings page.
* `CHECK_ENDPOINT`: URL of the checks API endpoint. Change if self-hosting.
* `STATES`: Array of states to monitor. Available options: `"up" "down" "new" "pending" "grace" "started" "paused"`
* `COLORS`: Associative array that maps a color to each configured state. Defaults to white (#ffffff).
* `SHOWN_TAGS`: Array of tags to show. Leave empty to disable filtering based on tags.
## Module
```ini
[module/info-healthchecks.io]
type = custom/script
exec = ~/polybar-scripts/info-healthchecks.io.sh
interval = 60
```

View File

@ -0,0 +1,49 @@
#!/bin/bash
# Your API Key
API_KEY=""
# URL of the checks api endpoint. Change if self-hosting the service.
CHECK_ENDPOINT="https://healthchecks.io/api/v1/checks/"
# States to track
# Available options: up down new pending grace started paused
STATES=("up" "down")
# Color of each state. Defaults to white (#ffffff).
declare -A COLORS=( [up]="#7cfc00" [down]="#ff0000" )
# Leave empty to show all tags
SHOWN_TAGS=()
function build_url {
url=$CHECK_ENDPOINT
next_sep="?"
for tag in "${SHOWN_TAGS[@]}"; do
url+="${next_sep}tag=${tag}"
next_sep="&"
done
echo "$url"
}
response=$(curl --silent --header "X-Api-Key: ${API_KEY}" "$(build_url)")
declare -A stati
for status in "up" "down"; do
stati[$status]=0
done
for status in $(echo "$response" | jq -r '.checks[].status'); do
stati[$status]=$((stati[$status] + 1))
done
output=""
for status in "${STATES[@]}"; do
count=${stati[$status]}
if [ ${COLORS[$status]+_} ]; then
color=${COLORS[$status]}
else
color="#ffffff"
fi
output+="|%{F${color}}${count}%{F-}"
done
echo "${output:1}"

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

View File

@ -0,0 +1,15 @@
# Script: info-hexdate
Print the current date in a hex format.
![info-hexdate](screenshots/1.png)
## Module
```ini
[module/info-hexdate]
type = custom/script
exec = ~/polybar-scripts/info-hexdate.sh
interval = 60
```

View File

@ -0,0 +1,11 @@
#!/bin/sh
day=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f3)
month=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f2)
year=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f1)
day=$(echo "obase=16; $day" | bc)
month=$(echo "obase=16; $month" | bc)
year=$(echo "obase=16; $year" | bc)
echo "$day-$month-$year"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,27 @@
# Script: info-hlwm-workspaces
Displays all herbstluftwm workspaces with support for all workspace states (`focused`, `visible`, `occupied`, `empty`, `urgent`).
![info-hlwm-workspaces](screenshots/1.png)
## Dependencies
* `herbstluftwm` running as your WM
## Configuration
On its own the script is pretty plain as there are no colors. There are a bunch of <kbd>TODO</kbd> comments where you can `echo` [Formatting Tags](https://github.com/jaagr/polybar/wiki/Formatting#format-tags) for certain workspace state to make it more colorful and help you actually distinguish the different states.
## Module
```ini
[module/info-hlwm-workspaces]
type = custom/script
exec = ~/polybar-scripts/info-hlwm-workspaces.sh
tail = true
scroll-up = herbstclient use_index -1 --skip-visible &
scroll-down = herbstclient use_index +1 --skip-visible &
```

View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
# Multi monitor support. Needs MONITOR environment variable to be set for each instance of polybar
# If MONITOR environment variable is not set this will default to monitor 0
# Check https://github.com/polybar/polybar/issues/763
MON_IDX="0"
mapfile -t MONITOR_LIST < <(polybar --list-monitors | cut -d":" -f1)
for (( i=0; i<$((${#MONITOR_LIST[@]})); i++ )); do
[[ ${MONITOR_LIST[${i}]} == "$MONITOR" ]] && MON_IDX="$i"
done;
herbstclient --idle "tag_*" 2>/dev/null | {
while true; do
# Read tags into $tags as array
IFS=$'\t' read -ra tags <<< "$(herbstclient tag_status "${MON_IDX}")"
{
for i in "${tags[@]}" ; do
# Read the prefix from each tag and render them according to that prefix
case ${i:0:1} in
'.')
# the tag is empty
# TODO Add your formatting tags
;;
':')
# the tag is not empty
# TODO Add your formatting tags
;;
'+')
# the tag is viewed on the specified MONITOR, but this monitor is not focused.
# TODO Add your formatting tags
;;
'#')
# the tag is viewed on the specified MONITOR and it is focused.
# TODO Add your formatting tags
;;
'-')
# the tag is viewed on a different MONITOR, but this monitor is not focused.
# TODO Add your formatting tags
;;
'%')
# the tag is viewed on a different MONITOR and it is focused.
# TODO Add your formatting tags
;;
'!')
# the tag contains an urgent window
# TODO Add your formatting tags
;;
esac
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
done
# reset foreground and background color to default
echo "%{F-}%{B-}"
} | tr -d "\n"
echo
# wait for next event from herbstclient --idle
read -r || break
done
} 2>/dev/null

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,13 @@
# Script: info-kernel
A script that shows the running kernel version.
## Module
```ini
[module/info-kernel]
type = custom/script
exec = uname -r
interval = 1024
```

View File

@ -0,0 +1,17 @@
# Script: info-pingrtt
A script that displays a ping result. It also shows a colored icon.
![info-pingrtt](screenshots/1.png)
![info-pingrtt](screenshots/2.png)
![info-pingrtt](screenshots/3.png)
## Module
```ini
[module/info-pingrtt]
type = custom/script
exec = ~/polybar-scripts/info-pingrtt.sh
interval = 10
```

View File

@ -0,0 +1,19 @@
#!/bin/sh
HOST=127.43.12.64
if ! ping=$(ping -n -c 1 -W 1 $HOST); then
echo "# ping failed"
else
rtt=$(echo "$ping" | sed -rn 's/.*time=([0-9]{1,})\.?[0-9]{0,} ms.*/\1/p')
if [ "$rtt" -lt 50 ]; then
icon="%{F#3cb703}#%{F-}"
elif [ "$rtt" -lt 150 ]; then
icon="%{F#f9dd04}#%{F-}"
else
icon="%{F#d60606}#%{F-}"
fi
echo "$icon $rtt ms"
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

View File

@ -0,0 +1,19 @@
# Script: info-podman
Shows the number of Podman containers in one of the states: `created`, `exited`, `paused`, `running`, `unknown`
![info-podman](screenshots/1.png)
## Dependencies
* [`podman`](https://github.com/containers/podman)
## Module
```ini
[module/info-podman]
type = custom/script
exec = ~/polybar-scripts/info-podman.sh
interval = 60
```

View File

@ -0,0 +1,9 @@
#!/bin/sh
STATUS="created exited paused running unknown"
for stat in $STATUS; do
output="$output $(podman ps -qf status="$stat" | wc -l) |"
done
echo "|$output"

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

View File

@ -0,0 +1,15 @@
# Script: info-projecthamster
This script displays Hamster Time Tracker information.
![info-projecthamster](screenshots/1.png)
## Module
```ini
[module/info-projecthamster]
type = custom/script
exec = ~/polybar-scripts/info-projecthamster.sh
interval = 5
```

View File

@ -0,0 +1,9 @@
#!/bin/sh
activity=$(hamster current 2> /dev/null | cut -d " " -f 3- | sed 's/@.* / - /')
if [ -n "$activity" ]; then
echo "$activity"
else
echo "No Activity"
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,15 @@
# Script: info-redshift-temp
This script displays the current color temperature.
![info-redshift](screenshots/1.png)
## Module
```ini
[module/info-redshift-temp]
type = custom/script
exec = ~/polybar-scripts/info-redshift-temp.sh
interval = 5
```

View File

@ -0,0 +1,15 @@
#!/bin/sh
if [ "$(pgrep -x redshift)" ]; then
temp=$(redshift -p 2> /dev/null | grep temp | cut -d ":" -f 2 | tr -dc "[:digit:]")
if [ -z "$temp" ]; then
echo "%{F#65737E} #"
elif [ "$temp" -ge 5000 ]; then
echo "%{F#8FA1B3} #"
elif [ "$temp" -ge 4000 ]; then
echo "%{F#EBCB8B} #"
else
echo "%{F#D08770} #"
fi
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

View File

@ -0,0 +1,25 @@
# Script: info-softwarecounter
A script that counts the number of specified running software including GUIs and processes.
Options to only monitor GUI applications or only processes exist. Users can add their own applications or processes they wish to watch simply by updating the existing dictionaries at the start of the script.
Arbitrary program counts can be combined, for example, the vim/nvim or chrome/chromium counts can be added together and the total displayed.
![info-softwarecounter](screenshots/1.png)
## Dependencies
* `wmctrl`
* `pgrep`
## Module
```
[module/info-softwarecounter]
type = custom/script
exec = ~/polybar-scripts/info-softwarecounter.py
interval = 10
```

View File

@ -0,0 +1,223 @@
#!/usr/bin/env python3
import subprocess
from collections import Counter, OrderedDict
import logging
# update GUIs
GUI = True
# update processes
PROCESS = True
# Debugging feature
DEBUG = False
logger = logging.getLogger(__name__)
if DEBUG:
FORMAT = '%(asctime)s - %(levelname)s - %(funcName)s:%(lineno)d - %(message)s'
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler(
filename='./info-softwarecounter.log',
encoding='utf-8'
)
fh.setLevel(logging.DEBUG)
fh.setFormatter(logging.Formatter(FORMAT))
logger.addHandler(fh)
# _____ _ _ _____
# / ____| | | |_ _|
# | | __| | | | | |
# | | |_ | | | | | |
# | |__| | |__| |_| |_
# \_____|\____/|_____|
# program/process names and corresponding gylphs
guis = OrderedDict({
'terminals': '#',
'chromes': '#',
'firefox': '#',
'skypeforlinux': '#',
'filemanager': '#',
'remote-desktop': '#',
'pdfviewer': '#',
'image': '#',
})
# combine counts of program/process names in the tuple
# the resulting glpyh used will be that of the corresponding key
combine_guis = {
'terminals': ('gnome-terminal-server', 'xfce4-terminal', 'alacritty', 'termite', 'terminator', 'urxvt'),
'chromes': ('chromium', 'chrome'),
'filemanager': ('nemo', 'thunar', 'dolphin', 'nautilus', 'pcmanfm'),
'remote-desktop': ('TeamViewer', ),
'pdfviewer': ('evince', 'okular', 'zathura'),
'image': ('gthumb', 'shotwell', 'deepin-image-vi', 'eog', 'gimp-2.10'),
}
def get(cmd):
return subprocess.check_output(cmd).decode("utf-8").strip()
# def check_wtype(w_id):
# # check the type of window, only list "NORMAL" windows
# return "_NET_WM_WINDOW_TYPE_NORMAL" in get(["xprop", "-id", w_id])
def get_process(w_id):
# get the name of the process, owning the window
proc = get(["ps", "-p", w_id, "-o", "cmd="])
return proc.split()[0].split("/")[-1]
def get_running_guis():
wlist = [
line.split() for line in subprocess.check_output(
["wmctrl", "-lp"]
).decode("utf-8").splitlines()
]
logger.debug("wlist after LC:")
logger.debug("---------")
for i in wlist:
logger.debug(i)
logger.debug("---------")
validprocs = [
get_process(w[2]) for w in wlist if w[2] != '0' # and check_wtype(w[0])
]
logger.debug(f"validprocs -> {validprocs}")
return validprocs
def GUI(gui_output=''):
# get list of running GUI programs
gui_counts = Counter(get_running_guis())
logger.debug(f"gui_counts -> {gui_counts}")
logger.debug("combine_guis items:")
logger.debug("---------")
# combine programs in program combine list
for k, lst in combine_guis.items():
logger.debug(f"{k} -> {lst}")
count = 0
for i in lst:
try:
count += gui_counts.pop(i)
except KeyError:
pass
if count:
gui_counts[k] += count
logger.debug("---------")
logger.debug(f"gui_counts after for loop -> {gui_counts}")
logger.debug("guis items:")
logger.debug("---------")
# generate program output
for k, v in guis.items():
logger.debug(f"{k} -> {v}")
try:
logger.debug(f"k, gui_counts[k] -> {k}, {gui_counts[k]}")
c = gui_counts[k]
if c:
gui_output += '%s %i ' % (v, c)
except Exception:
pass
logger.debug("---------")
logger.debug(f"gui_output -> {gui_output}")
return gui_output
# _____ _____ ____ _____ ______ _____ _____
# | __ \| __ \ / __ \ / ____| ____|/ ____/ ____|
# | |__) | |__) | | | | | | |__ | (___| (___
# | ___/| _ /| | | | | | __| \___ \\___ \
# | | | | \ \| |__| | |____| |____ ____) |___) |
# |_| |_| \_\\____/ \_____|______|_____/_____/
processes = OrderedDict({
'vims': '#',
'ssh': '#',
'updater': '#',
})
combine_proccesses = {
'vims': ('nvim', 'vim', 'atom'),
'updater': ('pacman', 'yay', 'trizen', 'yaourt', 'makepkg', 'auracle'),
}
def get_running_proc(process_name_list):
counts = [None] * len(process_name_list)
for i, p in enumerate(process_name_list):
try:
count = int(
subprocess.check_output(
['pgrep', '-c', '-x', p]
).decode('utf-8')
)
except subprocess.CalledProcessError:
count = 0
counts[i] = (p, count)
return dict(counts)
def PROCESS(process_output=''):
# count running proccesses
process_counts = get_running_proc(processes.keys())
combine_counts = get_running_proc(
list(sum(combine_proccesses.values(), ())))
process_counts.update(combine_counts)
# combine processes in process combine list
for k, lst in combine_proccesses.items():
count = 0
for i in lst:
try:
count += process_counts.pop(i)
except KeyError:
pass
if count:
process_counts[k] += count
# generate process output
for k, v in processes.items():
try:
c = process_counts[k]
if c:
process_output += '%s %i ' % (v, c)
except Exception:
pass
logger.debug(f"process_output -> {process_output}")
return process_output
def main():
if GUI:
gui_output = GUI()
if PROCESS:
process_output = PROCESS()
print(gui_output + process_output)
if __name__ == "__main__":
logger.debug("------------ Script runs ------------")
main()
logger.debug("------------ Script stops ------------\n")

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,20 @@
# Script: info-ssh-sessions
A script that displays the count of current ssh sessions as well as the public IP address of the fist session.
![info-ssh-sessions](screenshots/1.png)
## Dependencies
* `lsof`
## Module
```ini
[module/info-ssh-sessions]
type = custom/script
exec = ~/polybar-scripts/info-ssh-sessions.sh
interval = 5
```

View File

@ -0,0 +1,10 @@
#!/bin/sh
sessions="$(lsof -Pi | grep ":22")"
if [ -n "$sessions" ]; then
count=$(echo "$sessions" | wc -l)
echo "# ($count): $(echo "$sessions" | cut -d ">" -f 2 | cut -d " " -f 1 | cut -d ":" -f 1 | tail -n 1)"
else
echo "# (0)"
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,28 @@
# Script: info-taskspooler
A small script that displays the number of queues/runtimes for one or more task spooler servers.
![info-taskspooler](screenshots/1.png)
## Dependencies
* `task-spooler`
## Configuration
By default the script will output the count of the default task-spooler server.
Arguments can be passed to show custom task-spooler servers by using the `TS_SOCKET variable`. These custom servers will need to use a socket filename format like /tmp/ts-socket.SOCK_NAME or the script will be unable to find the server. Arguments are passed as `name,sock_name` with sock_name being optional, e.g. `default yt,youtube p,podcast`.
## Module
```ini
[module/info-taskspooler]
type = custom/script
exec = ~/polybar-scripts/info-task-spooler/info-taskspooler.sh
# exec = ~/polybar-scripts/info-taskspooler/info-taskspooler.sh default yt,youtube p,podcast
interval = 5
```

View File

@ -0,0 +1,27 @@
#!/bin/sh
# USAGE:
# No arguments: prints the job running/queued job count of the default tsp server
# Arguments: name,sock_name - one or more arguments, e.g. tsp yt,youtube p,podcasts
# sock_name is optional, will default to default tsp socket
# custom socket names will be generated as /tmp/ts-socket.SOCK_NAME, your TS_SOCKET will need to match
get_tsp_count() {
sock=/tmp/socket-ts.${1:-$(id -u)}
tsp_count=$(TS_SOCKET=$sock tsp|grep -E -c 'running|queued')
echo "${tsp_count:-0}"
}
# without argument, just show count of default socket
if [ $# -lt 1 ]; then
get_tsp_count
else
for t in "$@"; do
IFS=, read -r name sock_name <<- EOF
${t}
EOF
echo "${name} $(get_tsp_count "${sock_name}")"
done|sed 'N;s/\n/ /'
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,16 @@
# Script: info-timew
This script displays the daily tracked time. You can click it, to start tracking, using timew.
You can use the `--weekday` toggle, to view daily or weekly time spend. (may take the `interval` time to update)
## Module
```ini
[module/info-timew]
type = custom/script
exec = ~/polybar-scripts/info-timew.sh
interval = 10
click-left = ~/polybar-scripts/info-timew.sh --toggle
click-right = ~/polybar-scripts/info-timew.sh --weekday
```

View File

@ -0,0 +1,40 @@
#!/bin/sh
MODE_FILE="$HOME/.config/polybar/info-timew.mode"
if [ ! -f "${MODE_FILE}" ]; then
touch "${MODE_FILE}"
echo "d" > "${MODE_FILE}"
fi
ACTUAL_MODE=$(cat "${MODE_FILE}")
if timew > /dev/null 2>&1; then
if [ "$ACTUAL_MODE" = "w" ]; then
printf '%s/week' "$(timew summary :week | awk '{print $NF}' | tail -2 | head -1)"
else
printf '%s/day' "$(timew summary :day | awk '{print $NF}' | tail -2 | head -1)"
fi
else
printf "no tracking"
fi
if [ "${1}" = "--weekday" ]; then
if [ "$ACTUAL_MODE" = "w" ]; then
echo "d" > "${MODE_FILE}"
else
echo "w" > "${MODE_FILE}"
fi
fi
if [ "${1}" = "--toggle" ]; then
if timew; then
timew stop;
else
timew start;
fi
fi

View File

@ -0,0 +1,16 @@
# Script: info-timezone
A custom polybar script to switch the timezone of the date displayed.
![info-timezone](screenshots/1.gif)
## Module
```ini
[module/info-timezone]
type = custom/script
exec = ~/polybar-scripts/info-timezone.sh
tail = true
click-left = kill -USR1 %pid%
```

View File

@ -0,0 +1,35 @@
#!/bin/sh
# Change format here. see `man date` for format controls.
FORMAT="%I:%M %p"
# Add the timezones of your choice. see `timedatectl list-timezones`.
set -- "UTC-0" "Australia/Sydney" "Asia/Kolkata" "America/Chicago"
TIMEZONES_LENGTH=$#
current_idx=1
print_date() {
TZ=${current_timezone:?} date +"${FORMAT}" | echo "${current_timezone:?}: $(cat -)"
}
update_current_timezone() {
current_idx=$(($((current_idx+1)) % $(("$TIMEZONES_LENGTH"+1))))
if [ $current_idx -lt 1 ]; then
current_idx=1
fi
}
click() {
update_current_timezone
print_date
}
trap "click" USR1
while true; do
eval "current_timezone=\${$current_idx}"
print_date current_timezone
sleep 5 &
wait
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,16 @@
# Script: info-tmux-sessions
A simple script to show tmux sessions.
![info-tmux-sessions](screenshots/1.png)
![info-tmux-sessions](screenshots/2.png)
## Module
```ini
[module/info-tmux-sessions]
type = custom/script
exec = ~/polybar-scripts/info-tmux-sessions.sh
interval = 5
```

View File

@ -0,0 +1,21 @@
#! /bin/sh
if sessionlist=$(tmux ls 2>/dev/null); then
printf "# "
echo "$sessionlist" | while read -r line; do
session=$(echo "$line" | cut -d ':' -f 1)
if echo "$line" | grep -q "(attached)"; then
status="(a)"
else
status=""
fi
printf "%s%s " "$session" "$status"
done
printf "\n"
else
printf "# none\n"
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Some files were not shown because too many files have changed in this diff Show More