diff options
author | NeodarZ <neodarz@neodarz.ovh> | 2016-11-03 23:32:29 +0100 |
---|---|---|
committer | NeodarZ <neodarz@neodarz.ovh> | 2016-11-03 23:32:29 +0100 |
commit | 85869af083741e8230cf66d1acc4a3b2da21dbd5 (patch) | |
tree | f84efd1622d327039e0c0876a39b948469c42388 /i3 | |
parent | 146b416466cda8fdb6151bf73f99fa65a483fc09 (diff) | |
download | dotfiles-85869af083741e8230cf66d1acc4a3b2da21dbd5.tar.xz dotfiles-85869af083741e8230cf66d1acc4a3b2da21dbd5.zip |
Add the new i3 configuration
Diffstat (limited to '')
42 files changed, 123 insertions, 1500 deletions
diff --git a/i3/.i3blocks.conf b/i3/.i3blocks.conf deleted file mode 100644 index 2be3871..0000000 --- a/i3/.i3blocks.conf +++ /dev/null @@ -1,159 +0,0 @@ -# i3blocks config file -# -# Please see man i3blocks for a complete reference! -# The man page is also hosted at http://vivien.github.io/i3blocks -# -# List of valid properties: -# -# align -# color -# command -# full_text -# instance -# interval -# label -# min_width -# name -# separator -# separator_block_width -# short_text -# signal -# urgent - -# Global properties -# -# The top properties below are applied to every block, but can be overridden. -# Each block command defaults to the script name to avoid boilerplate. -command=/usr/lib/i3blocks/$BLOCK_NAME -separator_block_width=15 -markup=none - -[cmus] -command=~/.i3-blocks/blocks/cmus -label= -markup=pango -interval=repeat - -# Volume indicator -# -# The first parameter sets the step (and units to display) -# The second parameter overrides the mixer selection -# See the script for details. -[volume] -label= -#label=♪ -instance=Master -#instance=PCM -interval=once -signal=10 - -# Memory usage -# -# The type defaults to "mem" if the instance is not specified. -[memory] -label=MEM -separator=false -interval=30 - -#[memory] -#label=SWAP -#instance=swap -#separator=false -#interval=30 - -# Disk usage -# -# The directory defaults to $HOME if the instance is not specified. -# The script may be called with a optional argument to set the alert -# (defaults to 10 for 10%). -[disk] -label=HOME -#instance=/mnt/data -interval=30 - -# Network interface monitoring -# -# If the instance is not specified, use the interface used for default route. -# The address can be forced to IPv4 or IPv6 with -4 or -6 switches. -[iface] -#instance=wlan0 -color=#00FF00 -interval=10 -separator=false - -[wifi] -#instance=wlp3s0 -interval=10 -separator=false - -[bandwidth] -#instance=eth0 -interval=5 - -# CPU usage -# -# The script may be called with -w and -c switches to specify thresholds, -# see the script for details. -[cpu_usage] -label=CPU -interval=10 -min_width=CPU: 100.00% -#separator=false - -#[load_average] -#interval=10 - -# Battery indicator -# -# The battery instance defaults to 0. -#[battery] -#label=BAT -#label=⚡ -#instance=1 -#interval=30 - -# Date Time -# -[time] -command=date '+%Y-%m-%d %H:%M:%S' -interval=1 - -# Generic media player support -# -# This displays "ARTIST - SONG" if a music is playing. -# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others. -#[mediaplayer] -#instance=spotify -#interval=5 -#signal=10 - -# OpenVPN support -# -# Support multiple VPN, with colors. -#[openvpn] -#interval=20 - -# Temperature -# -# Support multiple chips, though lm-sensors. -# The script may be called with -w and -c switches to specify thresholds, -# see the script for details. -#[temperature] -#label=TEMP -#interval=10 - -# Key indicators -# -# Add the following bindings to i3 config file: -# -# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks -# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks -#[keyindicator] -#instance=CAPS -#interval=once -#signal=11 - -#[keyindicator] -#instance=NUM -#interval=once -#signal=11 diff --git a/i3/blocks/audio b/i3/blocks/audio deleted file mode 100755 index c401c68..0000000 --- a/i3/blocks/audio +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - amixer -q sset Master 5%+ -# Middle click -elif [[ "${BLOCK_BUTTON}" -eq 2 ]]; then - amixer -q sset Master toggle -# Right click -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - amixer -q sset Master 5%- -fi - -statusLine=$(amixer get Master | tail -n 1) -status=$(echo "${statusLine}" | grep -wo "on") -volume=$(echo "${statusLine}" | awk -F ' ' '{print $5}' | tr -d '[]%') - -if [[ "${status}" == "on" ]]; then - echo "${volume}%" - echo "${volume}%" - echo "" -else - echo "off" - echo "off" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/bandwidth b/i3/blocks/bandwidth deleted file mode 100755 index f0b18cf..0000000 --- a/i3/blocks/bandwidth +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# Source: http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html - -INSTANCE="${BLOCK_INSTANCE}" - -if [[ "${INSTANCE}" = "" ]]; then - INSTANCE="wlp3s0;both" -fi - -DISPLAY=$(echo "${INSTANCE}" | awk -F ';' '{print $2}') -INSTANCE=$(echo "${INSTANCE}" | awk -F ';' '{print $1}') - -if [[ "${DISPLAY}" = "" ]]; then - DISPLAY="both" -fi - -ONE_KB=1024 -ONE_MB=$(echo "${ONE_KB}*1024" | bc -l) -TEN_MB=$(echo "${ONE_MB}*10" | bc -l) -OHD_MB=$(echo "${TEN_MB}*10" | bc -l) - -URGENT_VALUE="${ONE_MB}" - -PREV_IN=0 -PREV_OUT=0 - -PREV_FILE="/tmp/.bandwidth" - -if [[ -f "${PREV_FILE}" ]]; then - PREV_CONT=$(cat "${PREV_FILE}") - PREV_IN=$(echo "${PREV_CONT}" | head -n 1) - PREV_OUT=$(echo "${PREV_CONT}" | tail -n 1) -fi - -BANDWIDTH=$(grep "${INSTANCE}" /proc/net/dev | awk -F: '{print $2}' | awk '{print $1" "$9}') - -if [[ "${BANDWIDTH}" = "" ]]; then - exit -fi - -BYTES_IN=$(echo "${BANDWIDTH}" | awk -F ' ' '{print $1}') -BYTES_OUT=$(echo "${BANDWIDTH}" | awk -F ' ' '{print $2}') - -function FormatNumber() { - if [[ "${1}" -ge "${OHD_MB}" ]]; then - echo $(echo "scale=0;${1}/${ONE_MB}" | bc -l)"mb" - elif [[ "${1}" -ge "${TEN_MB}" ]]; then - echo $(echo "scale=1;${1}/${ONE_MB}" | bc -l)"mb" - elif [[ "${1}" -ge "${ONE_MB}" ]]; then - echo $(echo "scale=2;${1}/${ONE_MB}" | bc -l)"mb" - elif [[ "${1}" -ge "${ONE_KB}" ]]; then - echo $(echo "scale=0;${1}/${ONE_KB}" | bc -l)"kb" - else - echo "${1}""b" - fi -} - -if [[ "${PREV_IN}" != "" ]] && [[ "${PREV_OUT}" != "" ]]; then - # Calculate the CPU usage since we last checked. - DIFF_IN=$(echo "scale=0;${BYTES_IN} - ${PREV_IN}" | bc -l) - DIFF_OUT=$(echo "scale=0;${BYTES_OUT} - ${PREV_OUT}" | bc -l) - DIFF_TOTAL=0 - - USAGE_IN=$(FormatNumber "${DIFF_IN}") - USAGE_OUT=$(FormatNumber "${DIFF_OUT}") - - if [[ "${DISPLAY}" = "both" ]]; then - echo "${USAGE_IN} : ${USAGE_OUT}" - echo "${USAGE_IN} : ${USAGE_OUT}" - echo "" - DIFF_TOTAL=$((DIFF_TOTAL+DIFF_IN)) - DIFF_TOTAL=$((DIFF_TOTAL+DIFF_OUT)) - elif [[ "${DISPLAY}" = "in" ]]; then - echo "${USAGE_IN}" - echo "${USAGE_IN}" - echo "" - DIFF_TOTAL=$((DIFF_TOTAL+DIFF_IN)) - elif [[ "${DISPLAY}" = "out" ]]; then - echo "${USAGE_OUT}" - echo "${USAGE_OUT}" - echo "" - DIFF_TOTAL=$((DIFF_TOTAL+DIFF_OUT)) - fi -else - echo "?" - echo "?" - echo "" -fi - -# Remember the total and idle CPU times for the next check. -echo "${BYTES_IN}" > "${PREV_FILE}" -echo "${BYTES_OUT}" >> "${PREV_FILE}" - -if [[ "${DIFF_TOTAL}" -ge "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/battery b/i3/blocks/battery deleted file mode 100755 index 3058f36..0000000 --- a/i3/blocks/battery +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -BATTERY=0 -BATTERY_INFO=$(acpi -b | grep "Battery ${BATTERY}") -BATTERY_STATE=$(echo "${BATTERY_INFO}" | grep -wo "Full\|Charging\|Discharging") -BATTERY_POWER=$(echo "${BATTERY_INFO}" | grep -o '[0-9]\+%' | tr -d '%') - -URGENT_VALUE=10 - -if [[ "${BATTERY_STATE}" = "Charging" ]]; then - echo "${BATTERY_POWER}%+" - echo "${BATTERY_POWER}%+" - echo "" -elif [[ "${BATTERY_STATE}" = "Discharging" ]]; then - echo "${BATTERY_POWER}%-" - echo "${BATTERY_POWER}%-" - echo "" -else - echo "${BATTERY_POWER}%" - echo "${BATTERY_POWER}%" - echo "" -fi - -if [[ "${BATTERY_POWER}" -le "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/bluetooth b/i3/blocks/bluetooth deleted file mode 100755 index c9673a5..0000000 --- a/i3/blocks/bluetooth +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - sudo bluetooth on -# Middle click -elif [[ "${BLOCK_BUTTON}" -eq 2 ]]; then - sudo bluetooth toggle -# Right click -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - sudo bluetooth off -fi - -STATUS=$(bluetooth | grep -wo 'on') - -if [[ "${STATUS}" = "on" ]]; then - echo "on" - echo "on" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/brightness b/i3/blocks/brightness deleted file mode 100755 index f6294e4..0000000 --- a/i3/blocks/brightness +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# One of the following: xrandr, xbacklight, kernel -METHOD="xbacklight" - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - xbacklight -inc 5 -# Right click -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - xbacklight -dec 5 -fi - -URGENT_VALUE=10 - -if [[ "${METHOD}" = "xrandr" ]]; then - device="${BLOCK_INSTANCE:-primary}" - xrandrOutput=$(xrandr --verbose) - - if [[ "${device}" = "primary" ]]; then - device=$(echo "${xrandrOutput}" | grep 'primary' | head -n 1 | awk -F ' ' '{print $1}') - fi - - curBrightness=$(echo "${xrandrOutput}" | grep "${device}" -A 5 | grep -i "Brightness" | awk -F ':' '{print $2}') -elif [[ "${METHOD}" = "kernel" ]]; then - device="${BLOCK_INSTANCE:-intel_backlight}" - maxBrightness=$(cat /sys/class/backlight/${device}/max_brightness) - curBrightness=$(cat /sys/class/backlight/${device}/brightness) -elif [[ "${METHOD}" = "xbacklight" ]]; then - curBrightness=$(xbacklight -get) -fi - -if [[ "${curBrightness}" -le 0 ]]; then - exit -fi - -if [[ "${METHOD}" = "xrandr" ]]; then - percent=$(echo "scale=0;${curBrightness} * 100" | bc -l) -elif [[ "${METHOD}" = "kernel" ]]; then - percent=$(echo "scale=0;${curBrightness} / ${maxBrightness} * 100" | bc -l) -elif [[ "${METHOD}" = "xbacklight" ]]; then - percent=$(echo "scale=0;${curBrightness}" | bc -l) -fi - -percent=${percent%.*} - -if [[ "${percent}" -le 0 ]]; then - exit -fi - -echo "${percent}%" -echo "${percent}%" -echo "" - -if [[ "${percent}" -le "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/cmus b/i3/blocks/cmus deleted file mode 100755 index f4d15b3..0000000 --- a/i3/blocks/cmus +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -INFO_CMUS=$(cmus-remote -Q 2>/dev/null) -if [[ $? -eq 0 ]]; then - INFO_TITLE=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*title//p' | head -n 1) - INFO_ALBUM=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*album//p' | head -n 1) - INFO_ARTIST=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*artist//p' | head -n 1) -else - exit -fi - -if [[ "${INFO_ARTIST}" ]] && [[ "${INFO_TITLE}" ]]; then - OUT_TEXT=$(echo "${INFO_ARTIST} - ${INFO_TITLE}" | xargs) -elif [[ "${INFO_TITLE}" ]]; then - OUT_TEXT=$(echo "${INFO_TITLE}" | xargs) -fi - -echo "${OUT_TEXT}" -echo "${OUT_TEXT}" -exit
\ No newline at end of file diff --git a/i3/blocks/countdown b/i3/blocks/countdown deleted file mode 100755 index 311a3b7..0000000 --- a/i3/blocks/countdown +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -END_DATE="${BLOCK_INSTANCE}" - -URGENT_VALUE=86400 - -if [[ "${END_DATE}" = "" ]]; then - END_DATE=$(date --date "next Friday" "+%m/%d/%Y %H:%M:%S") -fi - -END_DATE=$(date --date="${END_DATE}" '+%s') -CUR_DATE=$(date "+%s") -DIFF_DATE=$((END_DATE - CUR_DATE)) -DIFF="" - -if [[ "${DIFF_DATE}" -le 0 ]]; then - echo "${END_DATE}" - echo "${END_DATE}" - echo "" - exit 33 -fi - -if [[ "${DIFF_DATE}" -ge 86400 ]]; then - DIFF="[$((DIFF_DATE / 86400))] " - #DIFF_DATE=$((DIFF_DATE % 86400)) -fi - -DIFF+=$(date -u -d "@${DIFF_DATE}" +"%H:%M:%S") - -echo "${DIFF}" -echo "${DIFF}" -echo "" - -if [[ "${DIFF_DATE}" -le "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/cpu b/i3/blocks/cpu deleted file mode 100755 index 2cb27ad..0000000 --- a/i3/blocks/cpu +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Source: http://askubuntu.com/a/450136 - -URGENT_VALUE=90 - -PREV_TOTAL=0 -PREV_IDLE=0 - -cpuFile="/tmp/.cpu" - -if [[ -f "${cpuFile}" ]]; then - fileCont=$(cat "${cpuFile}") - PREV_TOTAL=$(echo "${fileCont}" | head -n 1) - PREV_IDLE=$(echo "${fileCont}" | tail -n 1) -fi - -CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics. -unset CPU[0] # Discard the "cpu" prefix. -IDLE=${CPU[4]} # Get the idle CPU time. - -# Calculate the total CPU time. -TOTAL=0 - -for VALUE in "${CPU[@]:0:4}"; do - let "TOTAL=$TOTAL+$VALUE" -done - -if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then - # Calculate the CPU usage since we last checked. - let "DIFF_IDLE=$IDLE-$PREV_IDLE" - let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL" - let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10" - echo "${DIFF_USAGE}%" - echo "${DIFF_USAGE}%" - echo "" -else - echo "?" - echo "?" - echo "" -fi - -# Remember the total and idle CPU times for the next check. -echo "${TOTAL}" > "${cpuFile}" -echo "${IDLE}" >> "${cpuFile}" - -if [[ "${DIFF_USAGE}" -gt 0 ]] && [[ "${DIFF_USAGE}" -gt "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/datetime b/i3/blocks/datetime deleted file mode 100755 index 178073f..0000000 --- a/i3/blocks/datetime +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -FORMAT="${BLOCK_INSTANCE:-%H:%M}" -DATETIME=$(date "+${FORMAT}") - -echo "${DATETIME}" -echo "${DATETIME}" -echo ""
\ No newline at end of file diff --git a/i3/blocks/display b/i3/blocks/display deleted file mode 100755 index 9071900..0000000 --- a/i3/blocks/display +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -xrandrOut=$(xrandr) - -hdmiName=$(echo "${xrandrOut}" | grep -i 'HDMI' | awk '{print $1}') -vgaName=$(echo "${xrandrOut}" | grep -i 'VGA' | awk '{print $1}') -edpName=$(echo "${xrandrOut}" | grep -i 'EDP' | awk '{print $1}') - -activeDisplays=$(echo "${xrandrOut}" | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/" | tr -s '\n' ' ') -displayFile='/tmp/.displays' - -if [[ -f "${displayFile}" ]]; then - oldDisplays=$(cat "${displayFile}") -else - oldDisplays="" -fi - -if [[ "${oldDisplays}" != "${activeDisplays}" ]]; then - change="yes" -else - change="no" -fi - -# External, HDMI + VGA -if [[ "$activeDisplays" =~ "${hdmiName}" && "$activeDisplays" =~ "${vgaName}" ]]; then - if [[ "${change}" = "yes" ]]; then - $(xrandr --output "${edpName}" --off) - $(xrandr --output "${vgaName}" --auto) - $(xrandr --output "${hdmiName}" --primary --auto) - fi - echo "VGA1 & HDMI" - echo "VGA1 & HDMI" - echo "" -# External, HDMI -elif [[ "$activeDisplays" =~ "${hdmiName}" ]]; then - if [[ "${change}" = "yes" ]]; then - $(xrandr --output "${edpName}" --off) - $(xrandr --output "${vgaName}" --off) - $(xrandr --output "${hdmiName}" --primary --auto) - fi - echo "HDMI" - echo "HDMI" - echo "" -# External, VGA -elif [[ "$activeDisplays" =~ "${vgaName}" ]]; then - if [[ "${change}" = "yes" ]]; then - $(xrandr --output "${edpName}" --off) - $(xrandr --output "${vgaName}" --primary --auto) - $(xrandr --output "${hdmiName}" --off) - fi - echo "VGA" - echo "VGA" - echo -# Only one internal -elif [[ "$activeDisplays" =~ "${edpName}" ]]; then - if [[ "${change}" = "yes" ]]; then - $(xrandr --output "${edpName}" --primary --auto) - $(xrandr --output "${vgaName}" --off) - $(xrandr --output "${hdmiName}" --off) - fi - echo "eDP" - echo "eDP" - echo "" -fi - -if [[ "${change}" = "yes" ]]; then - echo "${activeDisplays}" > "${displayFile}" -fi
\ No newline at end of file diff --git a/i3/blocks/feed b/i3/blocks/feed deleted file mode 100755 index 0030939..0000000 --- a/i3/blocks/feed +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# WARNING: This has a LIMIT of 32 characters for now! -# If your URL is longer you should use an URL shortener -# Caused by https://github.com/vivien/i3blocks/blob/01a4f4a9ca1e3d0b3c95d1d62000ad8506bdff1a/include/block.h#L50 -# Example: https://goo.gl/ -FEED_URL="${BLOCK_INSTANCE:-https://www.archlinux.org/feeds/news/}" - -if [[ "${FEED_URL}" = "" ]]; then - exit -fi - -# Follows redirects! -FEED_CONTENT=$(curl ${FEED_URL} -s -L) -FEED_TITLE=$(echo "${FEED_CONTENT}" | grep -v "xmlns:atom" | grep -o '<title>.*</title>' | head -n 1 | sed 's/\(<title>\|<\/title>\)//g') -FEED_LINK=$(echo "${FEED_CONTENT}" | grep -v "xmlns:atom" | grep -o '<link>.*</link>' | head -n 1 | sed 's/\(<link>\|<\/link>\)//g') - -if [[ "${FEED_TITLE}" = *404* ]]; then - echo "${FEED_URL}" - echo "${FEED_URL}" - echo "" - exit 33 -fi - -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - xdg-open "${FEED_LINK}" -fi - -echo "${FEED_TITLE}" -echo "${FEED_TITLE}" -echo ""
\ No newline at end of file diff --git a/i3/blocks/firewall b/i3/blocks/firewall deleted file mode 100755 index 6fe26f6..0000000 --- a/i3/blocks/firewall +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - sudo ufw enable -# Middle click -elif [[ "${BLOCK_BUTTON}" -eq 2 ]]; then - sudo ufw reload -# Right click -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - sudo ufw disable -fi - -status=$(sudo ufw status 2>/dev/null) - -if [[ $? -gt 0 ]]; then - exit -fi - -if [[ "${status}" != *inactive* ]]; then - echo "on" - echo "on" - echo "" -else - echo "off" - echo "off" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/ip-address b/i3/blocks/ip-address deleted file mode 100755 index d91ab56..0000000 --- a/i3/blocks/ip-address +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -IP_ADDRESS=$(ip route get 1 | awk '{print $NF;exit}') - -if [[ "${IP_ADDRESS}" != "" ]]; then - echo "${IP_ADDRESS}" - echo "${IP_ADDRESS}" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/keymap b/i3/blocks/keymap deleted file mode 100755 index f25ee98..0000000 --- a/i3/blocks/keymap +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -KEYMAP_DIRECTORY='/usr/share/kbd/keymaps' - -# Aprrently localectl status does not update on keymap change. However, setxkbmap does. -XKB_OUTPUT=$(setxkbmap -query) -VC_KEYMAP=$(echo "${XKB_OUTPUT}" | grep "layout" | awk -F ':' '{print $2}' | tr -d ' ') -VC_VARIANT=$(echo "${XKB_OUTPUT}" | grep "variant" | awk -F ':' '{print $2}' | tr -d ' ') - -# Keymap has not been specific, so it's not configured properly -if [[ "${VC_KEYMAP}" == "" ]]; then - exit 1 -fi - -KEYMAP_FILE="${VC_KEYMAP}*" - -if [[ "${VC_VARIANT}" != "" ]]; then - KEYMAP_FILE="${KEYMAP_FILE}${VC_VARIANT}*" -fi - -KEYMAP_NAME=$(basename $(dirname $(find ${KEYMAP_DIRECTORY} -name "${KEYMAP_FILE}"))) - -if [[ "${KEYMAP_NAME}" ]]; then - echo "${KEYMAP_NAME}" - echo "${KEYMAP_NAME}" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/keystate b/i3/blocks/keystate deleted file mode 100755 index e1543d7..0000000 --- a/i3/blocks/keystate +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -TYPE="${BLOCK_INSTANCE:-caps}" - -lockLine=$(xset -q | grep "Num Lock") - -capsLock=$(echo "${lockLine}" | awk -F ' ' '{print $4}') -numLock=$(echo "${lockLine}" | awk -F ' ' '{print $8}') -scrollLock=$(echo "${lockLine}" | awk -F ' ' '{print $12}') - -if [[ "${TYPE}" == "caps" ]]; then - checkLock="${capsLock}" -elif [[ "${TYPE}" == "num" ]]; then - checkLock="${numLock}" -elif [[ "${TYPE}" == "scroll" ]]; then - checkLock="${scrollLock}" -else - exit -fi - -if [[ "${checkLock}" == "on" ]]; then - echo "on" - echo "on" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/launcher b/i3/blocks/launcher deleted file mode 100755 index 1e39432..0000000 --- a/i3/blocks/launcher +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CONFIG_FILE="${BLOCK_INSTANCE:-~/.config/i3/config}" -CONFIG_FILE=${CONFIG_FILE/\~/$HOME} - -LAUNCH_CMD=$(cat "${CONFIG_FILE}" | grep -v "^#" | grep -wi 'rofi\|dmenu' | awk -F 'exec ' '{print $2}') -LAUNCH_NAME=$(echo "${LAUNCH_CMD}" | awk -F ' ' '{print $1}') - -VARIABLES=$(cat "${CONFIG_FILE}" | grep -E 'set\ \$' | awk -F ' ' '{$1 = "";print $0}') - -while read varPair; do - varName=$(echo "${varPair}" | awk -F ' ' '{print $1}') - varValue=$(echo "${varPair}" | awk -F ' ' '{print $2}') - #echo "Replacing ${varName} with ${varValue}" - LAUNCH_CMD=$(echo ${LAUNCH_CMD} | sed "s|$varName|$varValue|g") -done <<< "$(echo -e "$VARIABLES")" - -#echo "${LAUNCH_CMD}" && exit - -echo "${LAUNCH_NAME}" -echo "${LAUNCH_NAME}" -echo "" - -if [[ "${BLOCK_BUTTON}" -gt 0 ]]; then - eval ${LAUNCH_CMD} & -fi
\ No newline at end of file diff --git a/i3/blocks/load b/i3/blocks/load deleted file mode 100755 index 448876f..0000000 --- a/i3/blocks/load +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -INSTANCE="${BLOCK_INSTANCE:-1}" - -URGENT_VALUE=90 - -LOAD=$(cat /proc/loadavg | awk -F ' ' '{print $'"${INSTANCE}"'}') -if [[ "${LOAD}" != "" ]]; then - LOAD_PERC=$(echo "scale=0; ${LOAD} * 100" | bc -l) - LOAD_PERC=${LOAD_PERC%.*} - - echo "${LOAD}" - echo "${LOAD}" - echo "" - - if [[ "${LOAD_PERC}" -ge "${URGENT_VALUE}" ]]; then - exit 33 - fi -fi
\ No newline at end of file diff --git a/i3/blocks/locale b/i3/blocks/locale deleted file mode 100755 index e517c44..0000000 --- a/i3/blocks/locale +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -LOCALE_INFO=$(localectl) -LOCALE_NAME=$(echo "${LOCALE_INFO}" | grep "System Locale" | awk -F '=' '{print $2}' | cut -c 1-2) - -if [[ "${LOCALE_NAME}" ]]; then - echo "${LOCALE_NAME}" - echo "${LOCALE_NAME}" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/mail b/i3/blocks/mail deleted file mode 100755 index 66b1d0a..0000000 --- a/i3/blocks/mail +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -# Requires https://www.google.com/settings/security/lesssecureapps for gmail. - -CONFIG_FILE="${BLOCK_INSTANCE}" -CONFIG_FILE=${CONFIG_FILE/\~/$HOME} - -# Config file needs the following settings: -#MAIL_SERVER="imap.domain.tld:993" -#MAIL_USER="user@domain.tld" -#MAIL_PASSWORD="secret" -#MAIL_FOLDER="INBOX" - -if [[ ! -f "${CONFIG_FILE}" ]]; then - echo "${CONFIG_FILE}" - exit 33 -fi - -source "${CONFIG_FILE}" - -MAIN_DOMAIN=$(expr match "${MAIL_SERVER}" '.*\.\(.*\..*\)' | awk -F ':' '{print $1}') - -# Add https so xdg knows that it's a website -if [[ "${MAIN_DOMAIN}" != http* ]]; then - MAIN_DOMAIN="https://${MAIN_DOMAIN}" -fi - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - xdg-open "${MAIN_DOMAIN}" -fi - -MAIL_FILE="/tmp/.mail" -URGENT_VALUE="100" - -GET_UNREAD=$(cat<<EOF -? LOGIN "${MAIL_USER}" "${MAIL_PASSWORD}" -? STATUS "${MAIL_FOLDER}" (unseen) -? LOGOUT -EOF -) - -echo "${GET_UNREAD}" | openssl s_client -connect "${MAIL_SERVER}" -crlf -ign_eof > "${MAIL_FILE}" 2>/dev/null -UNREAD_COUNT=$(cat "${MAIL_FILE}" | grep -i "UNSEEN" | grep -oE "[0-9]*" | head -n 1) - -# For security reasons -rm "${MAIL_FILE}" - -if [[ "${UNREAD_COUNT}" = "" ]]; then - exit -fi - -echo "${UNREAD_COUNT}" -echo "${UNREAD_COUNT}" -echo "" - -if [[ "${UNREAD_COUNT}" -ge URGENT_VALUE ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/memory b/i3/blocks/memory deleted file mode 100755 index 866e7c3..0000000 --- a/i3/blocks/memory +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# First argument is source (mem/swap), second is output value -# Check /proc/meminfo for possible instances -INSTANCE="${BLOCK_INSTANCE:-mem;free}" - -SOURCE=$(echo "${INSTANCE}" | awk -F ';' '{print $1}') -DISPLAY=$(echo "${INSTANCE}" | awk -F ';' '{print $2}') - -if [[ "${SOURCE}" = "mem" ]]; then - URGENT_VALUE=90 -elif [[ "${SOURCE}" = "swap" ]]; then - URGENT_VALUE=50 -fi - -if [[ "${DISPLAY}" = "" ]]; then - DISPLAY="free" -fi - -ONE_KB=1024 -ONE_MB=$(echo "${ONE_KB}*1024" | bc -l) -ONE_GB=$(echo "${ONE_MB}*1024" | bc -l) -ONE_TB=$(echo "${ONE_GB}*1024" | bc -l) - -# Grep the value and remove KB so we can calculate with it later -#MEMINFO=$(cat /proc/meminfo | grep "${INSTANCE}" | awk -F ':' '{print $2}' | tr -d ' kB') -MEMORY_INFOS=$(cat /proc/meminfo) -SOURCE_TOTAL=$(echo "${MEMORY_INFOS}" | grep -i "${SOURCE}total" | awk -F ':' '{print $2}' | tr -d ' kB') - -if [[ "${SOURCE_TOTAL}" -le 0 ]]; then - exit -fi - -SOURCE_FREE=$(echo "${MEMORY_INFOS}" | grep -i "${SOURCE}available" | awk -F ':' '{print $2}' | tr -d ' kB') -SOURCE_USED=$(echo "scale=0; ${SOURCE_TOTAL}-${SOURCE_FREE}" | bc -l) -SOURCE_PERC=$(echo "scale=0; (${SOURCE_USED}*100)/${SOURCE_TOTAL}" | bc -l) - -if [[ "${DISPLAY}" = "free" ]]; then - MEMINFO="${SOURCE_FREE}" -elif [[ "${DISPLAY}" = "used" ]]; then - MEMINFO="${SOURCE_USED}" -elif [[ "${DISPLAY}" = "total" ]]; then - MEMINFO="${SOURCE_TOTAL}" -elif [[ "${DISPLAY}" = "perc" ]]; then - MEMINFO="${SOURCE_PERC}%" -fi - -if [[ "${DISPLAY}" != "perc" ]]; then - # Convert KB meminfo to bytes - MEMINFO=$(echo "${MEMINFO}*${ONE_KB}" | bc -l) - - if [[ "${MEMINFO}" -ge "${ONE_TB}" ]]; then - MEMINFO=$(echo "scale=3;${MEMINFO}/${ONE_TB}" | bc -l)"tb" - elif [[ "${MEMINFO}" -ge "${ONE_GB}" ]]; then - MEMINFO=$(echo "scale=2;${MEMINFO}/${ONE_GB}" | bc -l)"gb" - elif [[ "${MEMINFO}" -ge "${ONE_MB}" ]]; then - MEMINFO=$(echo "scale=1;${MEMINFO}/${ONE_MB}" | bc -l)"mb" - else - MEMINFO=$(echo "scale=0;${MEMINFO}/${ONE_KB}" | bc -l)"kb" - fi -fi - -echo "${MEMINFO}" -echo "${MEMINFO}" -echo "" - -if [[ "${SOURCE_PERC}" -gt "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/microphone b/i3/blocks/microphone deleted file mode 100755 index 76ff3f9..0000000 --- a/i3/blocks/microphone +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - amixer -q sset Capture 5%+ -# Middle click -elif [[ "${BLOCK_BUTTON}" -eq 2 ]]; then - amixer -q sset Capture toggle -# Right click -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - amixer -q sset Capture 5%- -fi - -statusLine=$(amixer get Capture | tail -n 1) -status=$(echo "${statusLine}" | grep -wo "on") -volume=$(echo "${statusLine}" | awk -F ' ' '{print $5}' | tr -d '[]%') - -if [[ "${status}" == "on" ]]; then - echo "${volume}%" - echo "${volume}%" - echo "" -else - echo "off" - echo "off" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/network b/i3/blocks/network deleted file mode 100755 index cb06e87..0000000 --- a/i3/blocks/network +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -device="${BLOCK_INSTANCE:-wlan0}" -status=$(cat /sys/class/net/${device}/operstate) - -URGENT_VALUE=20 - -if [[ "${status}" == "up" ]]; then - if [[ -d "/sys/class/net/${device}/wireless" ]]; then - quality=$(grep ${device} /proc/net/wireless | awk '{ print int($3 * 100 / 70) }') - echo "${quality}%" - echo "${quality}%" - echo "" - - if [[ "${quality}" -le "${URGENT_VALUE}" ]]; then - exit 33 - fi - else - echo "on" - echo "on" - echo "" - fi -fi
\ No newline at end of file diff --git a/i3/blocks/notifier b/i3/blocks/notifier deleted file mode 100755 index 35c94f1..0000000 --- a/i3/blocks/notifier +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/bash -# IMPORTANT: -# To make this block work, you have to edit your block-command. -# It should point to this file. For best performance, only use it on blocks -# you want to monitor. -# -# Example: -# command=~/.i3-blocks/blocks/notifier $BLOCK_NAME - -BLOCK_NAME="${1}" - -if [[ "${BLOCK_NAME}" == "" ]] || [[ "${BLOCK_NAME}" == "notifier" ]]; then - exit 1 -fi - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -BLOCK_PATH="${SCRIPT_DIR}/${BLOCK_NAME}" - -if [[ ! -f "${BLOCK_PATH}" ]]; then - exit 1 -fi - -BLOCK_OUT=$(bash "${BLOCK_PATH}") -BLOCK_URGENT=$? - -# Nothing to display. -if [[ "${BLOCK_OUT}" == "" ]]; then - exit "${BLOCK_URGENT}" -fi - -NOTIFY=0 - -NOTIFY_CHANGES="weather display" -NOTIFY_ALWAYS="" -NOTIFY_NEVER="launcher playerctl scroll" - -if [[ "${NOTIFY_NEVER}" != *${BLOCK_NAME}* ]]; then - BLOCK_UCFIRST=$(echo "${BLOCK_NAME}" | head -c 1 | tr [a-z] [A-Z]; echo "${BLOCK_NAME}" | tail -c +2) - - CHECK_SUM=$(echo "${BLOCK_NAME}-${BLOCK_INSTANCE}" | md5sum | awk '{print $1}') - CACHE_FILE="/tmp/.notify-cache-${CHECK_SUM}" - - BLOCK_DESC=$(echo "${BLOCK_OUT}" | head -n 1) - BLOCK_VALUE=$(echo "${BLOCK_OUT}" | tail -n 1) - BLOCK_ICON="" - - if [[ "${NOTIFY_ALWAYS}" == *${BLOCK_NAME}* ]]; then - NOTIFY=1 - elif [[ "${BLOCK_URGENT}" -gt 0 ]]; then - NOTIFY=1 - fi - - VALUE_CHANGED=0 - HAS_CACHEFILE=0 - if [[ -f "${CACHE_FILE}" ]]; then - HAS_CACHEFILE=1 - CACHED_VALUE=$(cat "${CACHE_FILE}") - #MODIFIED_TIME=$(stat -c '%Y' "${CACHE_FILE}") - #CURRENT_TIME=$(date +%s) - #ELAPSED_TIME=$((MODIFIED_TIME - CURRENT_TIME)) - if [[ "${BLOCK_VALUE}" != "${CACHED_VALUE}" ]]; then - VALUE_CHANGED=1 - if [[ "${NOTIFY_CHANGES}" == *${BLOCK_NAME}* ]]; then - NOTIFY=1 - fi - fi - elif [[ "${NOTIFY_CHANGES}" == *${BLOCK_NAME}* ]]; then - NOTIFY=1 - fi - - if [[ "${NOTIFY}" -eq 1 ]]; then - if [[ "${BLOCK_NAME}" == "audio" ]]; then - BLOCK_MESSAGE="Audio level changed to ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "bandwidth" ]]; then - BLOCK_MESSAGE="Traffic went to ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "battery" ]]; then - BLOCK_MESSAGE="Energy changed to ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "countdown" ]]; then - BLOCK_MESSAGE="Remaining time is now ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "cpu" ]]; then - BLOCK_MESSAGE="CPU utilization is now ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "feed" ]]; then - BLOCK_MESSAGE="Newest article is ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "mail" ]]; then - BLOCK_MESSAGE="Unread emails went to ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "memory" ]]; then - BLOCK_MESSAGE="Memory utilization is now ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "packages" ]]; then - BLOCK_MESSAGE="${BLOCK_VALUE} packages are now ready to update." - elif [[ "${BLOCK_NAME}" == "space" ]]; then - BLOCK_MESSAGE="Space utilization is now ${BLOCK_INSTANCE}." - elif [[ "${BLOCK_NAME}" == "ssid" ]]; then - BLOCK_MESSAGE="SSID changed to ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "temperature" ]]; then - BLOCK_MESSAGE="Sensor temperature changed to ${BLOCK_VALUE}." - elif [[ "${BLOCK_NAME}" == "trash" ]]; then - BLOCK_MESSAGE="${BLOCK_VALUE} items are now in the trash." - else - BLOCK_MESSAGE="${BLOCK_UCFIRST} is now ${BLOCK_VALUE}." - fi - - if [[ "${BLOCK_NAME}" == "audio" ]]; then - BLOCK_ICON="audio-volume-high-symbolic" - elif [[ "${BLOCK_NAME}" == "bandwidth" ]]; then - BLOCK_ICON="network-wireless-acquiring-symbolic" - elif [[ "${BLOCK_NAME}" == "battery" ]]; then - BLOCK_ICON="battery-symbolic" - elif [[ "${BLOCK_NAME}" == "bluetooth" ]]; then - BLOCK_ICON="bluetooth-active-symbolic" - elif [[ "${BLOCK_NAME}" == "brightness" ]]; then - BLOCK_ICON="display-brightness-symbolic" - elif [[ "${BLOCK_NAME}" == "cmus" ]]; then - BLOCK_ICON="emblem-music-symbolic" - elif [[ "${BLOCK_NAME}" == "countdown" ]]; then - BLOCK_ICON="document-open-recent-symbolic" - elif [[ "${BLOCK_NAME}" == "cpu" ]]; then - BLOCK_ICON="indicator-cpufreq" - elif [[ "${BLOCK_NAME}" == "datetime" ]]; then - BLOCK_ICON="system-run-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "device" ]]; then - BLOCK_ICON="system-run-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "display" ]]; then - BLOCK_ICON="video-display-symbolic" - elif [[ "${BLOCK_NAME}" == "feed" ]]; then - BLOCK_ICON="folder-documents-symbolic" - elif [[ "${BLOCK_NAME}" == "firewall" ]]; then - BLOCK_ICON="changes-prevent-symbolic.svg" # TODO - elif [[ "${BLOCK_NAME}" == "ip-address" ]]; then - BLOCK_ICON="avatar-default-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "keystate" ]]; then - BLOCK_ICON="format-text-underline-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "launcher" ]]; then - BLOCK_ICON="system-run-symbolic" - elif [[ "${BLOCK_NAME}" == "load" ]]; then - BLOCK_ICON="indicator-cpufreq" # TODO - elif [[ "${BLOCK_NAME}" == "locale" ]]; then - BLOCK_ICON="format-text-larger-symbolic" - elif [[ "${BLOCK_NAME}" == "mail" ]]; then - BLOCK_ICON="mail-send-symbolic" - elif [[ "${BLOCK_NAME}" == "memory" ]]; then - BLOCK_ICON="drive-harddisk-solidstate-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "microphone" ]]; then - BLOCK_ICON="audio-input-microphone-symbolic" - elif [[ "${BLOCK_NAME}" == "network" ]]; then - BLOCK_ICON="network-wireless-connected-symbolic" - elif [[ "${BLOCK_NAME}" == "packages" ]]; then - BLOCK_ICON="view-refresh-symbolic" - elif [[ "${BLOCK_NAME}" == "playerctl" ]]; then - BLOCK_ICON="emblem-music-symbolic" - elif [[ "${BLOCK_NAME}" == "process" ]]; then - BLOCK_ICON="process-stop-symbolic" - elif [[ "${BLOCK_NAME}" == "space" ]]; then - BLOCK_ICON="drive-harddisk-solidstate-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "ssid" ]]; then - BLOCK_ICON="system-users-symbolic" - elif [[ "${BLOCK_NAME}" == "temperature" ]]; then - BLOCK_ICON="object-inverse" # TODO - elif [[ "${BLOCK_NAME}" == "trash" ]]; then - BLOCK_ICON="user-trash-symbolic" - elif [[ "${BLOCK_NAME}" == "usb" ]]; then - BLOCK_ICON="drive-removable-media-usb-symbolic-1" - elif [[ "${BLOCK_NAME}" == "vpn" ]]; then - BLOCK_ICON="dialog-password-symbolic" # TODO - elif [[ "${BLOCK_NAME}" == "weather" ]]; then - BLOCK_ICON="weather-few-clouds-symbolic" - elif [[ "${BLOCK_NAME}" == "webcam" ]]; then - BLOCK_ICON="camera-web-symbolic" - elif [[ "${BLOCK_NAME}" == "window" ]]; then - BLOCK_ICON="view-dual-symbolic" # TODO - fi - - if [[ "${BLOCK_URGENT}" -gt 0 ]]; then - notify-send -u critical -t 5000 -i "${BLOCK_ICON}" -a "i3block-${BLOCK_NAME}" "${BLOCK_UCFIRST}" "${BLOCK_MESSAGE}" - else - notify-send -u normal -t 3500 -i "${BLOCK_ICON}" -a "i3block-${BLOCK_NAME}" "${BLOCK_UCFIRST}" "${BLOCK_MESSAGE}" - fi - fi - - if [[ "${VALUE_CHANGED}" -eq 1 ]] || [[ "${HAS_CACHEFILE}" -eq 0 ]]; then - echo "${BLOCK_VALUE}" > "${CACHE_FILE}" - fi -fi - -echo "${BLOCK_OUT}" -exit "${BLOCK_URGENT}"
\ No newline at end of file diff --git a/i3/blocks/packages b/i3/blocks/packages deleted file mode 100755 index 923d479..0000000 --- a/i3/blocks/packages +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/bash - -PACKAGES=$(pacman -Qu) - -URGENT_VALUE=25 - -if [[ $? -gt 0 ]]; then - return -fi - -PACKAGE_COUNT=$(echo "${PACKAGES}" | wc -l) - -if [[ "${PACKAGE_COUNT}" -gt 0 ]]; then - echo "${PACKAGE_COUNT}" # full-text - echo "${PACKAGE_COUNT}" # short-text - echo "" - if [[ "${PACKAGE_COUNT}" -gt "${URGENT_VALUE}" ]]; then - exit 33 - fi -fi
\ No newline at end of file diff --git a/i3/blocks/playerctl b/i3/blocks/playerctl deleted file mode 100755 index 6d613ed..0000000 --- a/i3/blocks/playerctl +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# Based on https://aur.archlinux.org/packages/playerctl/ - -INSTANCE="${BLOCK_INSTANCE}" - -if [[ "${INSTANCE}" != "" ]]; then - ARGUMENTS="--player ${INSTANCE}" -fi - -ICON_PLAY="➤" -ICON_PAUSE="Ⅱ" -ICON_STOP="≠" -CUR_ICON="" - -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - $(playerctl ${ARGUMENTS} previous) -elif [[ "${BLOCK_BUTTON}" -eq 2 ]]; then - $(playerctl ${ARGUMENTS} play-pause) -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - $(playerctl ${ARGUMENTS} next) -fi - -PLAYER_STATUS=$(playerctl ${ARGUMENTS} status) -INFO_TITLE=$(playerctl ${ARGUMENTS} metadata title) -INFO_ALBUM=$(playerctl ${ARGUMENTS} metadata album) -INFO_ARTIST=$(playerctl ${ARGUMENTS} metadata artist) - -if [[ "${PLAYER_STATUS}" = "Paused" ]]; then - CUR_ICON="${ICON_PAUSE}" -elif [[ "${PLAYER_STATUS}" = "Playing" ]]; then - CUR_ICON="${ICON_PLAY}" -else - CUR_ICON="${ICON_STOP}" -fi - -if [[ "${INFO_TITLE}" != "" ]] && [[ "${INFO_ARTIST}" != "" ]]; then - echo "${INFO_ARTIST} - ${INFO_TITLE} ${CUR_ICON}" - echo "${INFO_ARTIST} - ${INFO_TITLE} ${CUR_ICON}" -fi
\ No newline at end of file diff --git a/i3/blocks/process b/i3/blocks/process deleted file mode 100755 index 078a241..0000000 --- a/i3/blocks/process +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -PROG="${BLOCK_INSTANCE:-i3}" - -PROG_REGEX="["$(echo "${PROG}" | cut -c 1)"]"$(echo "${PROG}" | cut -c 2-)" " -PROCESS=$(ps -eo pid,cmd | grep -w ${PROG_REGEX}) - -if [[ "${PROCESS}" ]]; then - echo "ok" - echo "ok" - echo "" -else - echo "na" - echo "na" - echo "" - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/scroll b/i3/blocks/scroll deleted file mode 100755 index 677a7fc..0000000 --- a/i3/blocks/scroll +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# IMPORTANT: -# To make this block work, you have to edit your block-command. -# It should point to this file. For best performance, only use it on blocks -# which are wide and that you need to scroll. -# -# Example: -# command=~/.i3-blocks/blocks/scroll $BLOCK_NAME -# markup=pango -# interval=repeat - -PROG="${1}" - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -BLOCK_PATH="${SCRIPT_DIR}/${PROG}" - -INTERVAL=0.17 -MAX_LENGTH=25 -ADD_STR=" | " -ADD_LENGTH=${#ADD_STR} - -if [[ -f "${BLOCK_PATH}" ]]; then - BLOCK_OUT=$(bash "${BLOCK_PATH}") - OUT_TEXT=$(echo "${BLOCK_OUT}" | tail -n 1) -elif [[ "${PROG}" != "" ]]; then - OUT_TEXT=$(${PROG}) - if [[ $? -ne 0 ]]; then - sleep 1 - echo "${PROG}" - echo "${PROG}" - exit 33 - fi -fi - -if [[ "${OUT_TEXT}" ]]; then - CHECK_SUM=$(echo "${PROG}-${BLOCK_INSTANCE}" | md5sum | awk '{print $1}') - - TMP_FILE="/tmp/.scroll-${CHECK_SUM}" - - if [[ -f "${TMP_FILE}" ]]; then - SCROLL_POS=$(cat "${TMP_FILE}") - else - SCROLL_POS=0 - fi - - TEXT_LENGTH=${#OUT_TEXT} - MAX_OFFSET=$((TEXT_LENGTH +ADD_LENGTH -1)) - - if [[ "${TEXT_LENGTH}" -lt "${MAX_LENGTH}" ]]; then - MAX_LENGTH="${TEXT_LENGTH}" - fi - - if [[ "${SCROLL_POS}" -gt "${MAX_OFFSET}" ]]; then - SCROLL_POS=0 - fi - - TEXT_LINE="${OUT_TEXT}${ADD_STR}${OUT_TEXT}${ADD_STR}${OUT_TEXT}" - TEXT_LINE=${TEXT_LINE:$SCROLL_POS:$MAX_LENGTH} - - echo "<span font_family='monospace'>${TEXT_LINE}</span>" - echo "<span font_family='monospace'>${TEXT_LINE}</span>" - - SCROLL_POS=$((SCROLL_POS +1)) - - echo "${SCROLL_POS}" > "${TMP_FILE}" - sleep "${INTERVAL}" -else - sleep 1 -fi diff --git a/i3/blocks/space b/i3/blocks/space deleted file mode 100755 index 6e78d19..0000000 --- a/i3/blocks/space +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -INSTANCE="${BLOCK_INSTANCE}" -URGENT_VALUE=90 - -if [[ "${INSTANCE}" = "" ]]; then - INSTANCE="$HOME;free" -fi - -DISPLAY=$(echo "${INSTANCE}" | awk -F ';' '{print $2}') -INSTANCE=$(echo "${INSTANCE}" | awk -F ';' '{print $1}') - -if [[ "${DISPLAY}" = "" ]]; then - DISPLAY="free" -fi - -SPACE_VARS=$(df -h "${INSTANCE}" | tail -n 1 | awk '{$1="";$6="";print $0}') -PERC_SPACE=$(echo "${SPACE_VARS}" | awk -F ' ' '{print $4}' | tr -d '%') - -if [[ "${DISPLAY}" = "max" ]]; then - VALUE=$(echo "${SPACE_VARS}" | awk -F ' ' '{print $1}') -elif [[ "${DISPLAY}" = "used" ]]; then - VALUE=$(echo "${SPACE_VARS}" | awk -F ' ' '{print $2}') -elif [[ "${DISPLAY}" = "free" ]]; then - VALUE=$(echo "${SPACE_VARS}" | awk -F ' ' '{print $3}') -elif [[ "${DISPLAY}" = "perc" ]]; then - VALUE="${PERC_SPACE}%" -fi - -if [[ "${VALUE}" ]]; then - echo "${VALUE}" - echo "${VALUE}" - echo "" -fi - -if [[ "${PERC_SPACE}" -gt "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/ssid b/i3/blocks/ssid deleted file mode 100755 index d95c721..0000000 --- a/i3/blocks/ssid +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -SSID_NAME=$(iwgetid -r) - -# You can put any urgent name so the block will give warning -# if a network with this name is used, like public wifi or alike. -# You can separate multiple values with \| -URGENT_VALUE="" - -if [[ "${SSID_NAME}" != "" ]]; then - echo "${SSID_NAME}" - echo "${SSID_NAME}" - echo "" - - if [[ "${URGENT_VALUE}" != "" ]] && [[ $(echo "${SSID_NAME}" | grep -we "${URGENT_VALUE}") != "" ]]; then - exit 33 - fi -fi
\ No newline at end of file diff --git a/i3/blocks/temperature b/i3/blocks/temperature deleted file mode 100755 index 0c4b858..0000000 --- a/i3/blocks/temperature +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -TEMP_DEVICE="${BLOCK_INSTANCE:-Core}" -TEMP_OUTPUT=$(sensors | grep "${TEMP_DEVICE}") - -IS_URGENT=0 - -TOTAL_TEMP=0 -TOTAL_COUNT=0 -while read RESULT_LINE; do - TOTAL_COUNT=$((TOTAL_COUNT +1)) - CURRENT_TEMP=$(echo "${RESULT_LINE}" | grep -o -E "[\+\-]?[0-9]*.[0-9]*°C" | sed -n '1p' | tr -d '+°C') - URGENT_VALUE=$(echo "${RESULT_LINE}" | grep -o -E "[\+\-]?[0-9]*.[0-9]*°C" | sed -n '2p' | tr -d '+°C') - - TOTAL_TEMP=$(echo "scale=2;${TOTAL_TEMP}+${CURRENT_TEMP}" | bc -l) - IS_CRITICAL=$(echo "scale=0;${CURRENT_TEMP}-${URGENT_VALUE} >= 0" | bc -l) - - if [[ "${IS_CRITICAL}" -eq 1 ]]; then - IS_URGENT=1 - fi -done <<< "$(echo -e "$TEMP_OUTPUT")" - -AVERAGE_TEMP=$(echo "scale=0;${TOTAL_TEMP}/${TOTAL_COUNT}" | bc -l) - -if [[ "${TOTAL_COUNT}" -gt 1 ]]; then - AVERAGE_TEMP="~ ${AVERAGE_TEMP}" -fi - -echo "${AVERAGE_TEMP}°C" -echo "${AVERAGE_TEMP}°C" -echo "" - -if [[ "${IS_URGENT}" -eq 1 ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/trash b/i3/blocks/trash deleted file mode 100755 index b567a54..0000000 --- a/i3/blocks/trash +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -TRASH_DIRECTORY="${BLOCK_INSTANCE}" - -if [[ "${TRASH_DIRECTORY}" = "" ]]; then - TRASH_DIRECTORY="${XDG_DATA_HOME:-${HOME}/.local/share}/Trash" -fi - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - xdg-open "${TRASH_DIRECTORY}/files" -# Right click -elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then - # Delete all files permanently (unlink them) - rm -r "${TRASH_DIRECTORY}/files" - rm -r "${TRASH_DIRECTORY}/info" - # Create new directory - mkdir "${TRASH_DIRECTORY}/files" - mkdir "${TRASH_DIRECTORY}/info" -fi - -TRASH_COUNT=$(ls -U -1 "${TRASH_DIRECTORY}/files" | wc -l) - -URGENT_VALUE=100 - -echo "${TRASH_COUNT}" -echo "${TRASH_COUNT}" -echo "" - -if [[ "${TRASH_COUNT}" -ge "${URGENT_VALUE}" ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/usb b/i3/blocks/usb deleted file mode 100755 index e294e7d..0000000 --- a/i3/blocks/usb +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -DEVICE_NAME="${BLOCK_INSTANCE:-Keyboard}" - -DEVICE_INFO=$(lsusb | grep -i "${DEVICE_NAME}") - -if [[ "${DEVICE_INFO}" != "" ]]; then - echo "on" - echo "on" - echo "" -else - echo "na" - echo "na" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/user b/i3/blocks/user deleted file mode 100755 index f9391ad..0000000 --- a/i3/blocks/user +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/bash - -echo "${USER}" -echo "${USER}" -echo "" - -if [[ $(id -u) -eq 0 ]]; then - exit 33 -fi
\ No newline at end of file diff --git a/i3/blocks/vpn b/i3/blocks/vpn deleted file mode 100755 index 8e54938..0000000 --- a/i3/blocks/vpn +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -VPNC_FILE='/var/run/vpnc.pid' - -if [[ -e "${VPNC_FILE}" ]]; then - echo "on" - echo "on" - echo "" -fi
\ No newline at end of file diff --git a/i3/blocks/weather b/i3/blocks/weather deleted file mode 100755 index 4eb3efe..0000000 --- a/i3/blocks/weather +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Based on http://openweathermap.org/current - -API_KEY="44db6a862fba0b067b1930da0d769e98" - -# Check on http://openweathermap.org/find -CITY_ID="${BLOCK_INSTANCE}" - -URGENT_LOWER=0 -URGENT_HIGHER=30 - -ICON_SUNNY="" -ICON_CLOUDY="" -ICON_RAINY="" -ICON_STORM="" -ICON_SNOW="" -ICON_FOG="" - -SYMBOL_CELSIUS="℃" - -WEATHER_URL="http://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&appid=${API_KEY}&units=metric" - -WEATHER_INFO=$(wget -qO- "${WEATHER_URL}") -WEATHER_MAIN=$(echo "${WEATHER_INFO}" | grep -o -e '\"main\":\"[a-Z]*\"' | awk -F ':' '{print $2}' | tr -d '"') -WEATHER_TEMP=$(echo "${WEATHER_INFO}" | grep -o -e '\"temp\":\-\?[0-9]*' | awk -F ':' '{print $2}' | tr -d '"') - -if [[ "${WEATHER_MAIN}" = *Snow* ]]; then - echo "${ICON_SNOW} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "${ICON_SNOW} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "" -elif [[ "${WEATHER_MAIN}" = *Rain* ]] || [[ "${WEATHER_MAIN}" = *Drizzle* ]]; then - echo "${ICON_RAINY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "${ICON_RAINY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "" -elif [[ "${WEATHER_MAIN}" = *Cloud* ]]; then - echo "${ICON_CLOUDY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "${ICON_CLOUDY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "" -elif [[ "${WEATHER_MAIN}" = *Clear* ]]; then - echo "${ICON_SUNNY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "${ICON_SUNNY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "" -elif [[ "${WEATHER_MAIN}" = *Fog* ]] || [[ "${WEATHER_MAIN}" = *Mist* ]]; then - echo "${ICON_FOG} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "${ICON_FOG} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "" -else - echo "${WEATHER_MAIN} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "${WEATHER_MAIN} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" - echo "" -fi - -if [[ "${WEATHER_TEMP}" -lt "${URGENT_LOWER}" ]] || [[ "${WEATHER_TEMP}" -gt "${URGENT_HIGHER}" ]]; then - exit 33 -fi diff --git a/i3/blocks/webcam b/i3/blocks/webcam deleted file mode 100755 index 3c8eae9..0000000 --- a/i3/blocks/webcam +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -if [[ -c /dev/video0 ]]; then - if [[ "$(fuser /dev/video0)" != "" ]]; then - echo "rec" - echo "rec" - echo "" - else - echo "on" - echo "on" - echo "" - else - echo "off" - echo "off" - echo "" - fi -fi
\ No newline at end of file diff --git a/i3/blocks/window b/i3/blocks/window deleted file mode 100644 index 9ef155a..0000000 --- a/i3/blocks/window +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -ACTIVE_WINDOW=$(xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) WM_NAME | cut -d '"' -f 2) - -if [[ "${ACTIVE_WINDOW}" != "" ]]; then - echo "${ACTIVE_WINDOW}" - echo "${ACTIVE_WINDOW}" - echo "" -fi
\ No newline at end of file @@ -1,4 +1,5 @@ exec /home/neodarz/.back.sh +exec evolution # This file has been auto-generated by i3-config-wiizard(1). # It will not be overwritten, so edit it as you like. # @@ -71,6 +72,23 @@ font pango:monospace 8 # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod +# Sreen brightness controls +bindsym XF86MonBrightnessUp exec xbacklight -inc 1 # increase screen brightness +bindsym XF86MonBrightnessDown exec xbacklight -dec 1 # decrease screen brightness + +bindsym XF86AudioMute exec amixer set Master toggle + +bindsym XF86AudioLowerVolume exec amixer -q sset Master 1%- +bindsym XF86AudioRaiseVolume exec amixer -q sset Master 1%+ + +# Microphone control => amixer set Capture toggle +bindsym $mod+control+m exec amixer set Capture toggle + + +# CAPS & NUM status +bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks +bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks + # App bindsym --release $mod+o exec scrot ~/screenshots/%b\ %d-%H:%M:%S.png bindsym $mod+Shift+F1 exec terminator -x ranger @@ -81,7 +99,7 @@ bindsym $mod+Shift+F5 exec firefox bindsym $mod+Shift+F6 exec terminator -x vim bindsym $mod+Shift+F7 exec terminator -x ncmpcpp bindsym $mod+Shift+v move morkspace to output right - +bindsym $mod+control+l exec i3lock -g # start a terminal bindsym $mod+Return exec terminator @@ -205,5 +223,6 @@ bindsym $mod+r mode "resize" # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) bar { - status_command i3blocks + #status_command i3blocks + status_command python ~/.config/i3pystatus/conf.py } diff --git a/i3/myconf.sh b/i3/myconf.sh deleted file mode 100755 index 4a0f519..0000000 --- a/i3/myconf.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -i3block | while : -do - read line - music=`sh who.sh` - echo "$music | $line" || exit 1 -done diff --git a/i3/who.sh b/i3/who.sh deleted file mode 100755 index f91abb3..0000000 --- a/i3/who.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -title=$(cmus-remote -Q | grep title | cut -c11-) - -artist=$(cmus-remote -Q | grep artist | cut -c12-) - -echo "$artist - $title" diff --git a/i3pystatus/conf.py b/i3pystatus/conf.py new file mode 100644 index 0000000..b7d55c0 --- /dev/null +++ b/i3pystatus/conf.py @@ -0,0 +1,102 @@ +import logging +from i3pystatus import Status + +status = Status(logfile='/home/neodarz/i3pystatus.log') + +status.register("keyboard_locks", + color="#008000", + format="{caps} {num}", + caps_off="", + num_off="",) + +# Displays clock like this: +# Tue 30 Jul 11:59:46 PM KW31 +# ^-- calendar week +status.register("clock", + format=" %a %-d %b %X",) + +# Shows the average load of the last minute and the last 5 minutes +# (the default value for format is used) +#status.register("load") + +# Shows your CPU temperature, if you have a Intel CPU +status.register("temp", + format=" {temp:.0f}°C",) + +# The battery monitor has many formatting options, see README for details + +# This would look like this, when discharging (or charging) +# ↓14.22W 56.15% [77.81%] 2h:41m +# And like this if full: +# =14.22W 100.0% [91.21%] +# +# This would also display a desktop notification (via D-Bus) if the percentage +# goes below 5 percent while discharging. The block will also color RED. +# If you don't have a desktop notification demon yet, take a look at dunst: +# http://www.knopwob.org/dunst/ +status.register("battery", + format="{status} {percentage:.2f}% [{percentage_design:.2f}%] {remaining:%E%hh:%Mm}", + alert=True, + alert_percentage=5, + status={ + "DIS": "↓", + "CHR": "↑", + "FULL": "=", + },) + + +# Displays whether a DHCP client is running +status.register("runwatch", + name="DHCP", + path="/var/run/dhclient*.pid",) + +# Shows the address and up/down state of eth0. If it is up the address is shown in +# green (the default value of color_up) and the CIDR-address is shown +# (i.e. 10.10.10.42/24). +# If it's down just the interface name (eth0) will be displayed in red +# (defaults of format_down and color_down) +# +# Note: the network module requires PyPI package netifaces +status.register("network", + interface="enp3s0", + format_up=" {v4cidr}", + format_down="") + +# Note: requires both netifaces and basiciw (for essid and quality) +status.register("network", + interface="wlp2s0", + format_up=" {essid} {quality:03.0f}%", + format_down="") + +# Shows disk usage of / +# Format: +# 42/128G [86G] +status.register("disk", + path="/", + format=" {avail}G",) + +# Shows pulseaudio default sink volume +# +# Note: requires libpulseaudio from PyPI +status.register("pulseaudio", + format="{volume}",format_muted="") + +#status.register("backlight", +# format="{brightness}",) + +status.register("shell", + command="~/.i3-blocks/blocks/brightness",) + +# Shows mpd status +# Format: +# Cloud connected▶Reroute to Remain +status.register("cmus", + format="{status} {song_elapsed}/{song_length} {artist} - {title}", + status={ + "stopped": "◾", + "playing": "▶", + "paused": "▷", + },format_not_running="",) + +status.run() + |