Added my lemonbar config files.
This commit is contained in:
parent
c397442f3d
commit
f40c5304b8
4
killlemonade
Executable file
4
killlemonade
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
killall lemonbar
|
||||
killall panel-top
|
8
launchlemonade
Executable file
8
launchlemonade
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
pkill lemonbar
|
||||
sleep 0.1
|
||||
pkill panel-top
|
||||
sleep 0.1
|
||||
|
||||
panel-top
|
35
lemoncpu
Executable file
35
lemoncpu
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
|
||||
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
|
||||
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
|
||||
#
|
||||
# Licensed under the terms of the GNU GPL v3, or any later version.
|
||||
|
||||
use strict;
|
||||
use utf8;
|
||||
use Getopt::Long;
|
||||
|
||||
# default values
|
||||
my $cpu_usage = -1;
|
||||
my $decimals = $ENV{DECIMALS} // 2;
|
||||
my $label ="C ";
|
||||
|
||||
# Get CPU usage
|
||||
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
|
||||
open (MPSTAT, 'mpstat 1 1 |') or die;
|
||||
while (<MPSTAT>) {
|
||||
if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
|
||||
$cpu_usage = 100 - $1; # 100% - %idle
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(MPSTAT);
|
||||
|
||||
$cpu_usage eq -1 and die 'Can\'t find CPU information';
|
||||
|
||||
# Print short_text, full_text
|
||||
printf "${label}";
|
||||
printf "%.${decimals}f%%\n", $cpu_usage;
|
||||
|
||||
exit 0;
|
3
lemoncpu-notify
Executable file
3
lemoncpu-notify
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
notify-send "Biggest cpu hogs:
|
||||
$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)"
|
5
lemonlight
Executable file
5
lemonlight
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
lightness=$(light -G | sed 's/\.[0-9]*//')
|
||||
|
||||
printf "%s\n" "L $lightness%"
|
3
lemonram-notify
Executable file
3
lemonram-notify
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
notify-send "Biggest memory hogs:
|
||||
$(ps axch -o cmd:15,%mem --sort=-%mem | head)"
|
10
lemonsong-status
Executable file
10
lemonsong-status
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
status=$(mpc status | sed -n '/playing/p' | cut -c2-8 | sed 's/^[ \t]*//')
|
||||
|
||||
if [ "$status" = "playing" ]; then # If song is playing
|
||||
printf "%s\n" "S契"
|
||||
else
|
||||
printf "%s\n" "S"
|
||||
fi
|
||||
|
14
lemonvol
Executable file
14
lemonvol
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
vol=$(pamixer --get-volume)
|
||||
mute=$(pamixer --get-volume-human)
|
||||
|
||||
icon=$(echo "奔")
|
||||
|
||||
if [ "$mute" = "muted" ]; then
|
||||
label=$(printf "mute \n")
|
||||
else
|
||||
label=$vol%
|
||||
fi
|
||||
|
||||
printf "%s\n" "V奔 $vol"
|
30
lemonvol.py
Executable file
30
lemonvol.py
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
from pulsectl import Pulse, PulseLoopStop
|
||||
import sys
|
||||
|
||||
# Adapt to your use-case
|
||||
sink_id = 0
|
||||
|
||||
with Pulse() as pulse:
|
||||
def callback(ev):
|
||||
if ev.index == sink_id:
|
||||
raise PulseLoopStop
|
||||
try:
|
||||
pulse.event_mask_set('sink')
|
||||
pulse.event_callback_set(callback)
|
||||
last_value = round(pulse.sink_list()[sink_id].volume.value_flat * 100)
|
||||
last_mute = pulse.sink_list()[sink_id].mute == 1
|
||||
while True:
|
||||
pulse.event_listen()
|
||||
value = round(pulse.sink_list()[sink_id].volume.value_flat * 100)
|
||||
mute = pulse.sink_list()[sink_id].mute == 1
|
||||
if value != last_value or mute != last_mute:
|
||||
if mute:
|
||||
print('mute')
|
||||
else:
|
||||
print(value)
|
||||
last_value = value
|
||||
last_mute = mute
|
||||
sys.stdout.flush()
|
||||
except:
|
||||
pass
|
122
panel-top
Executable file
122
panel-top
Executable file
@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
|
||||
PANEL_FIFO=/tmp/panel-top-fifo
|
||||
PANEL_HEIGHT=18
|
||||
|
||||
PANEL_FONT_FAMILY="JetBrains Mono Medium"
|
||||
ICON_FONT2="IPAGothic"
|
||||
ICON_FONT="SauceCodePro Nerd Font Mono"
|
||||
|
||||
# setup
|
||||
if [ $(pgrep -cx panel-top) -gt 1 ] ; then
|
||||
printf "%s\n" "The panel is already running." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
||||
|
||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
||||
mkfifo "$PANEL_FIFO"
|
||||
|
||||
bspc subscribe report > "$PANEL_FIFO" &
|
||||
# find out how to make this scroll
|
||||
xtitle -sf 'X%s\n\n' -t 30 > "$PANEL_FIFO" &
|
||||
|
||||
# time and date
|
||||
while true;
|
||||
do
|
||||
echo "D$(date '+%d.%m.%Y %H:%M:%S')"
|
||||
sleep 1
|
||||
done > "$PANEL_FIFO" &
|
||||
|
||||
# battery
|
||||
while true;
|
||||
do
|
||||
for battery in /sys/class/power_supply/BAT?
|
||||
do
|
||||
mode=$(cat "$battery"/status)
|
||||
percent=$(cat "$battery"/capacity)
|
||||
symbol=""
|
||||
|
||||
if [ "$mode" = "Discharging" ]; then
|
||||
symbol=''
|
||||
elif [ "$mode" = "Charging" ]; then
|
||||
symbol=''
|
||||
else
|
||||
symbol=''
|
||||
fi
|
||||
|
||||
echo "B$symbol $percent%"
|
||||
done
|
||||
sleep 10
|
||||
done > "$PANEL_FIFO" &
|
||||
|
||||
# backlight
|
||||
lemonlight > "$PANEL_FIFO" &
|
||||
|
||||
# cpu temp
|
||||
while true;
|
||||
do
|
||||
temp=$(sensors | awk '/^Tdie:/ {print $2}')
|
||||
echo "T $temp"
|
||||
sleep 10
|
||||
done > "$PANEL_FIFO" &
|
||||
|
||||
# wifi
|
||||
while true;
|
||||
do
|
||||
for wifi in /sys/class/net/w*
|
||||
do
|
||||
state=$(cat "$wifi"/operstate)
|
||||
|
||||
if [ "$state" = "up" ]; then # if connected
|
||||
echo "N直 "
|
||||
else
|
||||
echo "N睊 "
|
||||
fi
|
||||
done
|
||||
sleep 5
|
||||
done > "$PANEL_FIFO" &
|
||||
|
||||
# volume
|
||||
# initial volume
|
||||
lemonvol > "$PANEL_FIFO" &
|
||||
# python volume watcher
|
||||
lemonvol.py > "$PANEL_FIFO" &
|
||||
|
||||
# ram
|
||||
while true;
|
||||
do
|
||||
mem=$(free -h --mega | awk '/^Mem:/ {print $3 "/" $2}')
|
||||
|
||||
printf "%s\n" "R $mem"
|
||||
sleep 10
|
||||
done > "$PANEL_FIFO" &
|
||||
|
||||
# cpu
|
||||
while true;
|
||||
do
|
||||
lemoncpu > "$PANEL_FIFO"
|
||||
sleep 5
|
||||
done > "$PANEL_FIFO" &
|
||||
|
||||
# mpc song status
|
||||
lemonsong-status > "$PANEL_FIFO" &
|
||||
|
||||
# mpc playing song
|
||||
while true
|
||||
do
|
||||
song=$(mpc current)
|
||||
printf "%s\n" "M $song" > "$PANEL_FIFO"
|
||||
mpc idle player > /dev/null 2>&1
|
||||
done &
|
||||
|
||||
. panel_colors
|
||||
|
||||
cat "$PANEL_FIFO" | panel_bar-top | lemonbar -g x$PANEL_HEIGHT -o -1 -f "$PANEL_FONT_FAMILY"-8 -f "$ICON_FONT"-9 -f "$ICON_FONT2"-7 -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -u 2 | sh &
|
||||
|
||||
sleep 1
|
||||
xdo above -t $(xdo id -n root) $(xdo id -n lemonbar)
|
||||
|
||||
wait
|
||||
|
106
panel_bar-top
Executable file
106
panel_bar-top
Executable file
@ -0,0 +1,106 @@
|
||||
#!/bin/sh
|
||||
|
||||
. panel_colors
|
||||
|
||||
num_mon=$(bspc query -M | wc -l)
|
||||
PADDING=" "
|
||||
SEP="|"
|
||||
|
||||
while read -r line ; do
|
||||
case $line in
|
||||
R*)
|
||||
#ram output
|
||||
ram="%{U$COLOR_UNDERLINE}%{+u}%{A:lemonram-notify:}${line#?}%{A}%{-u}$PADDING"
|
||||
;;
|
||||
C*)
|
||||
#cpu output
|
||||
cpu="%{U$COLOR_UNDERLINE}%{+u}%{A:lemoncpu-notify:}${line#?}%{A}%{-u}$PADDING"
|
||||
;;
|
||||
S*)
|
||||
# mpc song status
|
||||
state="%{F$COLOR_OCCUPIED_UNDERLINE}${line#?}%{F-}$PADDING"
|
||||
;;
|
||||
M*)
|
||||
# mpc current song
|
||||
song="%{F$COLOR_OCCUPIED_UNDERLINE}${line#?}%{F-}$PADDING"
|
||||
;;
|
||||
X*)
|
||||
# xtitle output
|
||||
title="$PADDING%{F$COLOR_TITLE}${line#?}%{F-}"
|
||||
;;
|
||||
D*)
|
||||
#time and date output
|
||||
date="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}"
|
||||
;;
|
||||
B*)
|
||||
# battery output
|
||||
batt="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}$PADDING"
|
||||
;;
|
||||
L*)
|
||||
# backlight output
|
||||
light="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}$PADDING"
|
||||
;;
|
||||
T*)
|
||||
# cpu temperature
|
||||
temp="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}$PADDING"
|
||||
;;
|
||||
N*)
|
||||
# wifi output
|
||||
wifi="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}$PADDING"
|
||||
;;
|
||||
V*)
|
||||
# volume output
|
||||
vol="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}$PADDING"
|
||||
;;
|
||||
W*)
|
||||
# bspwm internal state
|
||||
wm_infos=""
|
||||
IFS=':'
|
||||
set -- ${line#?}
|
||||
while [ $# -gt 0 ] ; do
|
||||
item=$1
|
||||
name=${item#?}
|
||||
case $item in
|
||||
M*)
|
||||
# active monitor
|
||||
if [ $num_mon -gt 1 ] ; then
|
||||
wm_infos="$wm_infos $SEP%{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_FOCUSED_OCCUPIED_FG}$PADDING${name}$PADDING%{B-}%{F-} "
|
||||
fi
|
||||
;;
|
||||
m*)
|
||||
# inactive monitor
|
||||
if [ $num_mon -gt 1 ] ; then
|
||||
wm_infos="$wm_infos $SEP%{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG}$PADDING${name}$PADDING%{B-}%{F-} "
|
||||
fi
|
||||
;;
|
||||
O*)
|
||||
# focused occupied desktop
|
||||
wm_infos="${wm_infos}$SEP%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_UNDERLINE}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}"
|
||||
;;
|
||||
F*)
|
||||
# focused free desktop
|
||||
wm_infos="${wm_infos}$SEP%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_UNDERLINE}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}"
|
||||
;;
|
||||
U*)
|
||||
# focused urgent desktop
|
||||
wm_infos="${wm_infos}$SEP%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_UNDERLINE}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}"
|
||||
;;
|
||||
o*)
|
||||
# occupied desktop
|
||||
wm_infos="${wm_infos}$SEP%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}%{A:bspc desktop -f ${name}:}%{U$COLOR_OCCUPIED_UNDERLINE}%{+u}$PADDING${name}$PADDING%{-u}%{A}%{B-}%{F-}"
|
||||
;;
|
||||
f*)
|
||||
# free desktop
|
||||
wm_infos="${wm_infos}$SEP%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG}%{A:bspc desktop -f ${name}:}$PADDING${name}$PADDING%{A}%{B-}%{F-}"
|
||||
;;
|
||||
u*)
|
||||
# urgent desktop
|
||||
wm_infos="${wm_infos}$SEP%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG}$PADDING${name}$PADDING%{B-}%{F-}"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
;;
|
||||
esac
|
||||
printf "%s\n" "%{l}${wm_infos}${SEP}${title}%{c}${song}${state}%{r}${temp}${cpu}${ram}${wifi}${vol}${light}${batt}${date}"
|
||||
done
|
25
panel_colors
Executable file
25
panel_colors
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
COLOR_FOREGROUND="#d8dee9"
|
||||
COLOR_BACKGROUND="#2e3440"
|
||||
COLOR_FOCUSED_OCCUPIED_BG="#3b4252"
|
||||
COLOR_FOCUSED_OCCUPIED_FG="#d8dee9"
|
||||
COLOR_ACTIVE_MONITOR_FG="#d8dee9"
|
||||
COLOR_ACTIVE_MONITOR_BG="#3b4252"
|
||||
COLOR_INACTIVE_MONITOR_FG="#d8dee9"
|
||||
COLOR_INACTIVE_MONITOR_BG="#2e3440"
|
||||
COLOR_FOCUSED_OCCUPIED_FG="#d8dee9"
|
||||
COLOR_FOCUSED_OCCUPIED_BG="#3b4252"
|
||||
COLOR_FOCUSED_FREE_FG="#d8dee9"
|
||||
COLOR_FOCUSED_FREE_BG="#3b4252"
|
||||
COLOR_FOCUSED_URGENT_FG="#2e3440"
|
||||
COLOR_FOCUSED_URGENT_BG="#bf616a"
|
||||
COLOR_OCCUPIED_FG="#d8dee9"
|
||||
COLOR_OCCUPIED_BG="#2e3440"
|
||||
COLOR_FREE_FG="#d8dee9"
|
||||
COLOR_FREE_BG="#2e3440"
|
||||
COLOR_URGENT_FG="#3b4252"
|
||||
COLOR_URGENT_BG="#bf616a"
|
||||
COLOR_UNDERLINE="#a3be8c"
|
||||
COLOR_TITLE="#ebcb8b"
|
||||
COLOR_OCCUPIED_UNDERLINE="#88c0d0"
|
Loading…
Reference in New Issue
Block a user