hi
This commit is contained in:
parent
9ec09f9238
commit
2ca5c136da
93
config
93
config
@ -11,9 +11,33 @@ SCRIPT_DIR=/home/arco/.config/i3blocks/scripts
|
||||
separator=true
|
||||
separator_block_width=30
|
||||
|
||||
[mediaplayer]
|
||||
command=$SCRIPT_DIR/mediaplayer
|
||||
#[mediaplayer2]
|
||||
#command=$SCRIPT_DIR/mediaplayer2
|
||||
#label=[ ♪ ]
|
||||
#CONCISE=false
|
||||
#interval=1
|
||||
#color=#ebdbb2
|
||||
|
||||
#[mediaplayer]
|
||||
#command=$SCRIPT_DIR/mediaplayer
|
||||
#label=[♪]
|
||||
#interval=1
|
||||
#color=#ebdbb2
|
||||
|
||||
[check-security-key]
|
||||
command=$SCRIPT_DIR/check_security_key
|
||||
interval=1
|
||||
color=#ebdbb2
|
||||
|
||||
#[rofi-wttr]
|
||||
#command=$SCRIPT_DIR/rofi-wttr
|
||||
#interval=3600
|
||||
#BAR_POSITION=top
|
||||
#FONT=Monospace 10
|
||||
#LABEL=🌡️
|
||||
#LOCATION=Washington_DC
|
||||
#ROFI_CONFIG_FILE=/dev/null
|
||||
#color=#ebdbb2
|
||||
|
||||
#[documentation]
|
||||
#full_text=Documentation
|
||||
@ -28,69 +52,86 @@ interval=1
|
||||
|
||||
[volume]
|
||||
command=$SCRIPT_DIR/volume
|
||||
LABEL=♪
|
||||
#LABEL=VOL
|
||||
LABEL=[ 🕪 ]
|
||||
interval=once
|
||||
signal=10
|
||||
STEP=5%
|
||||
MIXER=pulse
|
||||
#SCONTROL=[determined automatically]
|
||||
#NATURAL_MAPPING=0
|
||||
NATURAL_MAPPING=0
|
||||
color=#ebdbb2
|
||||
|
||||
[dunst]
|
||||
command=$SCRIPT_DIR/dunst
|
||||
interval=once
|
||||
format=json
|
||||
markup=pango
|
||||
#min_width=50
|
||||
min_width=50
|
||||
align=center
|
||||
|
||||
[disk]
|
||||
command=$SCRIPT_DIR/disk
|
||||
DIR=/
|
||||
LABEL=🖴
|
||||
LABEL=[ 🖴 ]
|
||||
interval=30
|
||||
color=#ebdbb2
|
||||
|
||||
[batterybar]
|
||||
command=$SCRIPT_DIR/batterybar
|
||||
label=⏻
|
||||
label=[ 🗲 ]
|
||||
interval=5
|
||||
markup=pango
|
||||
min_width=bat: ■■■■■
|
||||
# Discharging colors low to high
|
||||
C1=#FF0027
|
||||
C2=#FF3B05
|
||||
C3=#FFB923
|
||||
C4=#FFD000
|
||||
C5=#E4FF00
|
||||
C6=#ADFF00
|
||||
C7=#6DFF00
|
||||
C8=#10BA00
|
||||
CHARGING_COLOR=#00AFE3
|
||||
FULL_COLOR=#FFFFFF
|
||||
C1=#cc241d
|
||||
C2=#d65d0e
|
||||
C3=#d79921
|
||||
C4=#fabd2f
|
||||
C5=#8ec07c
|
||||
C6=#689d6a
|
||||
C7=#b8bb26
|
||||
C8=#98971a
|
||||
CHARGING_COLOR=#458588
|
||||
FULL_COLOR=#ebdbb2
|
||||
AC_COLOR=#535353
|
||||
color=#ebdbb2
|
||||
|
||||
[time]
|
||||
label=[ 🕰 ]
|
||||
command=date '+%m/%d/%Y %H:%M'
|
||||
interval=15
|
||||
color=#ebdbb2
|
||||
|
||||
[shutdown_menu]
|
||||
full_text= ⏻ Power Menu
|
||||
#[laptop_mode]
|
||||
#full_text= ↺ Laptop Mode
|
||||
#command=$SCRIPT_DIR/laptopmode
|
||||
#background=#458588
|
||||
#color=#282828
|
||||
|
||||
#[tablet_mode]
|
||||
#full_text= ↺ Tablet Mode
|
||||
#command=$SCRIPT_DIR/tabletmode
|
||||
#background=#98971a
|
||||
#color=#282828
|
||||
|
||||
#[shutdown_menu]
|
||||
#full_text= ⏻ Power Menu
|
||||
# If you are using FontAwesome, we recommend the power-off icon:
|
||||
# http://fontawesome.io/icon/power-off/
|
||||
command=$SCRIPT_DIR/shutdown_menu
|
||||
#command=$SCRIPT_DIR/shutdown_menu
|
||||
#FG_COLOR=#bbbbbb
|
||||
#BG_COLOR=#111111
|
||||
#HLFG_COLOR=#111111
|
||||
#HLBG_COLOR=#bbbbbb
|
||||
#BORDER_COLOR=#222222
|
||||
ROFI_TEXT=⏻
|
||||
ROFI_OPTIONS=-width 11 -location 0 -hide-scrollbar -bw 2
|
||||
#ROFI_TEXT=⏻
|
||||
#ROFI_OPTIONS=-width 11 -location 0 -hide-scrollbar -bw 2
|
||||
#ZENITY_TITLE=Menu
|
||||
#ZENITY_TEXT=Action:
|
||||
#ZENITY_OPTIONS=--column= --hide-header
|
||||
#ENABLE_CONFIRMATIONS=true (must be true or false)
|
||||
#LAUNCHER=rofi #(must be rofi or zenity)
|
||||
LOCKSCRIPT=betterlockscreen -u "/home/arco/Wallpapers/platform.jpg" -l
|
||||
background=#d79921
|
||||
color=#282828
|
||||
#LOCKSCRIPT=betterlockscreen -u "/home/arco/Wallpapers/platform.jpg" -l
|
||||
#background=#d79921
|
||||
#color=#282828
|
||||
|
||||
|
106
scripts/battery2
Executable file
106
scripts/battery2
Executable file
@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2016 James Murphy
|
||||
# Licensed under the GPL version 2 only
|
||||
#
|
||||
# A battery indicator blocklet script for i3blocks
|
||||
|
||||
from subprocess import check_output
|
||||
import os
|
||||
import re
|
||||
|
||||
config = dict(os.environ)
|
||||
status = check_output(['acpi'], universal_newlines=True)
|
||||
|
||||
if not status:
|
||||
# stands for no battery found
|
||||
color = config.get("color_10", "red")
|
||||
fulltext = "<span color='{}'><span font='FontAwesome'>\uf00d \uf240</span></span>".format(color)
|
||||
percentleft = 100
|
||||
else:
|
||||
# if there is more than one battery in one laptop, the percentage left is
|
||||
# available for each battery separately, although state and remaining
|
||||
# time for overall block is shown in the status of the first battery
|
||||
batteries = status.split("\n")
|
||||
state_batteries=[]
|
||||
commasplitstatus_batteries=[]
|
||||
percentleft_batteries=[]
|
||||
time = ""
|
||||
for battery in batteries:
|
||||
if battery!='':
|
||||
state_batteries.append(battery.split(": ")[1].split(", ")[0])
|
||||
commasplitstatus = battery.split(", ")
|
||||
if not time:
|
||||
time = commasplitstatus[-1].strip()
|
||||
# check if it matches a time
|
||||
time = re.match(r"(\d+):(\d+)", time)
|
||||
if time:
|
||||
time = ":".join(time.groups())
|
||||
timeleft = " ({})".format(time)
|
||||
else:
|
||||
timeleft = ""
|
||||
|
||||
p = int(commasplitstatus[1].rstrip("%\n"))
|
||||
if p>0:
|
||||
percentleft_batteries.append(p)
|
||||
commasplitstatus_batteries.append(commasplitstatus)
|
||||
state = state_batteries[0]
|
||||
commasplitstatus = commasplitstatus_batteries[0]
|
||||
if percentleft_batteries:
|
||||
percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries))
|
||||
else:
|
||||
percentleft = 0
|
||||
|
||||
# stands for charging
|
||||
color = config.get("color_charging", "yellow")
|
||||
FA_LIGHTNING = "<span color='{}'><span font='FontAwesome'>\uf0e7</span></span>".format(color)
|
||||
|
||||
# stands for plugged in
|
||||
FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
|
||||
|
||||
# stands for using battery
|
||||
FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
|
||||
|
||||
# stands for unknown status of battery
|
||||
FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
|
||||
|
||||
|
||||
if state == "Discharging":
|
||||
fulltext = FA_BATTERY + " "
|
||||
elif state == "Full":
|
||||
fulltext = FA_PLUG + " "
|
||||
timeleft = ""
|
||||
elif state == "Unknown":
|
||||
fulltext = FA_QUESTION + " " + FA_BATTERY + " "
|
||||
timeleft = ""
|
||||
else:
|
||||
fulltext = FA_LIGHTNING + " " + FA_PLUG + " "
|
||||
|
||||
def color(percent):
|
||||
if percent < 10:
|
||||
# exit code 33 will turn background red
|
||||
return config.get("color_10", "#FFFFFF")
|
||||
if percent < 20:
|
||||
return config.get("color_20", "#FF3300")
|
||||
if percent < 30:
|
||||
return config.get("color_30", "#FF6600")
|
||||
if percent < 40:
|
||||
return config.get("color_40", "#FF9900")
|
||||
if percent < 50:
|
||||
return config.get("color_50", "#FFCC00")
|
||||
if percent < 60:
|
||||
return config.get("color_60", "#FFFF00")
|
||||
if percent < 70:
|
||||
return config.get("color_70", "#FFFF33")
|
||||
if percent < 80:
|
||||
return config.get("color_80", "#FFFF66")
|
||||
return config.get("color_full", "#FFFFFF")
|
||||
|
||||
form = '<span color="{}">{}%</span>'
|
||||
fulltext += form.format(color(percentleft), percentleft)
|
||||
fulltext += timeleft
|
||||
|
||||
print(fulltext)
|
||||
print(fulltext)
|
||||
if percentleft < 10:
|
||||
exit(33)
|
12
scripts/check_security_key
Executable file
12
scripts/check_security_key
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
msg_connected="✓ Security key connected"
|
||||
msg_disconnected="𐄂 Security key not connected\n"
|
||||
|
||||
lsusb | grep Lexar > /dev/null
|
||||
|
||||
if [ "$?" == 0 ]; then
|
||||
printf "[✓] Security key connected.\n"
|
||||
else
|
||||
printf "[𐄂] Security key disconnected.\n"
|
||||
fi
|
5
scripts/laptopmode
Executable file
5
scripts/laptopmode
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
xinput enable 12
|
||||
xinput reattach 13 3
|
||||
TABLET_MODE_ENABLED=1
|
15
scripts/mediaplayer2
Executable file
15
scripts/mediaplayer2
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
TRACK=$(playerctl metadata title) # Command to get track
|
||||
ARTIST=$(playerctl metadata artist) # Command to get artist
|
||||
ALBUM=$(playerctl metadata album) # Command to get album
|
||||
|
||||
MAXCHAR="128" # Maximum characters allowed in string
|
||||
|
||||
if [ ${CONCISE} == "false" ]; then
|
||||
printf "%.${MAXCHAR}s\n" "${TRACK} - by ${ARTIST} - on ${ALBUM}"
|
||||
elif [ ${CONCISE} == "true" ]; then
|
||||
printf "%.${MAXCHAR}s\n" "${ARTIST} - ${TRACK}"
|
||||
else
|
||||
printf "error: 'CONCISE' must be defined in i3blocks config\n"
|
||||
fi
|
75
scripts/rofi-wttr
Executable file
75
scripts/rofi-wttr
Executable file
@ -0,0 +1,75 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
###### Variables ######
|
||||
LABEL="${LABEL:- }"
|
||||
LOCATION="${LOCATION:- }"
|
||||
FONT="${FONT:-Monospace 10}"
|
||||
ROFI_CONFIG_FILE="${ROFI_CONFIG_FILE:-/dev/null}"
|
||||
BAR_POSITION="${BAR_POSITION:-bottom}"
|
||||
|
||||
###### Variables ######
|
||||
|
||||
|
||||
###### Functions ######
|
||||
# print the full weather
|
||||
# see https://github.com/chubin/wttr.in#usage for full configuration options
|
||||
print_weather_report() {
|
||||
if [[ $LOCATION != " " ]]; then
|
||||
curl https://wttr.in/$LOCATION?T
|
||||
else
|
||||
curl https://wttr.in/?T
|
||||
fi
|
||||
}
|
||||
|
||||
# print the one line weather
|
||||
# see https://github.com/chubin/wttr.in#one-line-output for formatting options
|
||||
print_weather_line() {
|
||||
if [[ $LOCATION != " " ]]; then
|
||||
curl -s https://wttr.in/${LOCATION}?u\&format="%C+%c+%t+(%f)+%w" | tr -d \"
|
||||
else
|
||||
curl -s 'https://wttr.in/?u\&format="%C+%c+%t+(%f)+%w"' | tr -d \"
|
||||
fi
|
||||
}
|
||||
|
||||
###### Functions ######
|
||||
|
||||
|
||||
###### Main body ######
|
||||
|
||||
# handle any click
|
||||
# rofi pop up
|
||||
case "$BLOCK_BUTTON" in
|
||||
1|2|3)
|
||||
IFS=
|
||||
weather_report=$(print_weather_report)
|
||||
|
||||
# check bar position and adjust anchor accordingly
|
||||
if [[ $BAR_POSITION = "top" ]]; then
|
||||
anchor="northwest"
|
||||
else
|
||||
anchor="southwest"
|
||||
fi
|
||||
|
||||
# open rofi
|
||||
# (add the following option to rofi command with proper config file, if needed)
|
||||
echo $weather_report \
|
||||
| rofi \
|
||||
-dmenu \
|
||||
-markup-rows \
|
||||
-font $FONT \
|
||||
-m -3 \
|
||||
-theme-str 'window {width: 53%; anchor: '"$anchor"'; location: northwest;}' \
|
||||
-theme-str 'listview {lines: '"$(echo $weather_report | wc -l)"' ;scrollbar: false;}' \
|
||||
-theme $ROFI_CONFIG_FILE \
|
||||
-p "Detailed weather report"
|
||||
esac
|
||||
|
||||
# print blocklet text
|
||||
|
||||
if [[ $LABEL != " " ]]; then
|
||||
echo $LABEL$(print_weather_line)
|
||||
else
|
||||
echo $(print_weather_line)
|
||||
fi
|
||||
|
||||
###### Main body ######
|
5
scripts/tabletmode
Executable file
5
scripts/tabletmode
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
xinput disable 12
|
||||
xinput float 13
|
||||
TABLET_MODE_ENABLED=0
|
3
scripts/tabletmode_status
Executable file
3
scripts/tabletmode_status
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
return ${TABLET_MODE_ENABLED}
|
30
scripts/toggle
Executable file
30
scripts/toggle
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z ${COMMAND_ON} || -z ${COMMAND_OFF} || -z ${COMMAND_STATUS} ]]; then
|
||||
echo "All of COMMAND_ON, COMMAND_OFF, and COMMAND_STATUS are required" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
on_cmd=${COMMAND_ON}
|
||||
off_cmd=${COMMAND_OFF}
|
||||
status_cmd=${COMMAND_STATUS}
|
||||
|
||||
if (( ${BLOCK_BUTTON:-0} == 1 )); then
|
||||
eval $status_cmd 2>&1 >/dev/null
|
||||
if (( $? == 0 )); then
|
||||
eval $off_cmd 2>&1 >/dev/null
|
||||
else
|
||||
eval $on_cmd 2>&1 >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
eval $status_cmd 2>&1 >/dev/null
|
||||
if (( $? == 0 )); then
|
||||
COLOR=${COLOR_ON}
|
||||
else
|
||||
COLOR=${COLOR_OFF:-#555555}
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
echo $COLOR
|
Loading…
Reference in New Issue
Block a user