From 30c680db3fd3bd0e5cbd36e5b9f3c7347fd497b2 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Wed, 14 Feb 2018 18:52:26 +0000 Subject: [PATCH 1/8] Fix volume desync with xbindkeys --- .config/i3/config | 4 ++-- .xbindkeysrc | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 8bdbc63..61f41cc 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -175,8 +175,8 @@ bindsym XF86AudioPause exec --no-startup-id mpc pause bindsym XF86AudioStop exec --no-startup-id mpc stop bindsym XF86AudioNext exec --no-startup-id mpc next bindsym XF86AudioPrev exec --no-startup-id mpc previous -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% && pkill -RTMIN+10 i3blocks -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% && pkill -RTMIN+10 i3blocks +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1000 && pkill -RTMIN+10 i3blocks +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1000 && pkill -RTMIN+10 i3blocks bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+10 i3blocks exec --no-startup-id "ip monitor | while read line; do pkill -RTMIN+15 i3blocks; done" diff --git a/.xbindkeysrc b/.xbindkeysrc index 9e4f8b0..44a9751 100644 --- a/.xbindkeysrc +++ b/.xbindkeysrc @@ -1,15 +1,15 @@ -# thumb wheel up => increase volume and unmute -"amixer -D pulse set Master 1000+ unmute ; pkill -RTMIN+10 i3blocks" - b:6 - -# thumb wheel down => lower volume -"amixer -D pulse set Master 1000- ; pkill -RTMIN+10 i3blocks" - b:7 - -# backward button => previous song -"xte 'key XF86AudioPrev'" - b:8 - -# forward button => next song -"xte 'key XF86AudioNext'" +# thumb wheel up => increase volume and unmute +"xdotool key --clearmodifiers XF86AudioRaiseVolume" + b:6 + +# thumb wheel down => lower volume +"xdotool key --clearmodifiers XF86AudioLowerVolume" + b:7 + +# backward button => previous song +"xte 'key XF86AudioPrev'" + b:8 + +# forward button => next song +"xte 'key XF86AudioNext'" b:9 From 2268a03a8a53983e6ec62d28ae763ca4f0ac04ae Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 12:43:25 +0000 Subject: [PATCH 2/8] Use persistent volume block Modified from https://github.com/vivien/i3blocks-contrib/tree/master/volume-pulseaudio --- .config/i3/blocks/config | 3 +- .config/i3/blocks/volume | 249 ++++++++++++++++++++++++++------------- .config/i3/config | 10 +- 3 files changed, 176 insertions(+), 86 deletions(-) diff --git a/.config/i3/blocks/config b/.config/i3/blocks/config index aa1c814..0487ca5 100644 --- a/.config/i3/blocks/config +++ b/.config/i3/blocks/config @@ -41,8 +41,7 @@ separator_block_width=12 #interval=persist [volume] -instance=Master -interval=10 +interval=persist signal=10 [separator] diff --git a/.config/i3/blocks/volume b/.config/i3/blocks/volume index f33b059..b8594e1 100755 --- a/.config/i3/blocks/volume +++ b/.config/i3/blocks/volume @@ -1,93 +1,182 @@ #!/bin/bash -# Copyright (C) 2014 Julien Bonjean -# Copyright (C) 2014 Alexander Keller +# Displays the default device, volume, and mute status for i3blocks -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +AUDIO_HIGH_SYMBOL=' ' -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +AUDIO_MED_THRESH=59 +AUDIO_MED_SYMBOL=' ' -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +AUDIO_LOW_THRESH=0 +AUDIO_LOW_SYMBOL=' ' -#------------------------------------------------------------------------ +AUDIO_MUTED_SYMBOL='X' -# The second parameter overrides the mixer selection -# For PulseAudio users, use "pulse" -# For Jack/Jack2 users, use "jackplug" -# For ALSA users, you may use "default" for your primary card -# or you may use hw:# where # is the number of the card desired -MIXER="default" -[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse" -[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug" -MIXER="${2:-$MIXER}" +AUDIO_INTERVAL=5 -# The instance option sets the control to report and configure -# This defaults to the first control of your selected mixer -# For a list of the available, use `amixer -D $Your_Mixer scontrols` -SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols | - sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" | - head -n1 - )}" +DEFAULT_COLOR="#ffffff" +MUTED_COLOR="#a0a0a0" -# The first parameter sets the step to change the volume by (and units to display) -# This may be in in % or dB (eg. 5% or 3dB) -STEP="${1:-2%}" +LONG_FORMAT=0 +SHORT_FORMAT=3 +USE_PERCENT=0 +USE_ALSA_NAME=0 +USE_DESCRIPTION=0 +SUBSCRIBE=1 -#------------------------------------------------------------------------ +while getopts F:Sf:padH:M:L:X:T:t:C:c:i:m:s:h opt; do + case "$opt" in + S) SUBSCRIBE=1 ;; + F) LONG_FORMAT="$OPTARG" ;; + f) SHORT_FORMAT="$OPTARG" ;; + p) USE_PERCENT=0 ;; + a) USE_ALSA_NAME=1 ;; + d) USE_DESCRIPTION=1 ;; + H) AUDIO_HIGH_SYMBOL="$OPTARG" ;; + M) AUDIO_MED_SYMBOL="$OPTARG" ;; + L) AUDIO_LOW_SYMBOL="$OPTARG" ;; + X) AUDIO_MUTED_SYMBOL="$OPTARG" ;; + T) AUDIO_MED_THRESH="$OPTARG" ;; + t) AUDIO_LOW_THRESH="$OPTARG" ;; + C) DEFAULT_COLOR="$OPTARG" ;; + c) MUTED_COLOR="$OPTARG" ;; + i) AUDIO_INTERVAL="$OPTARG" ;; + m) MIXER="$OPTARG" ;; + s) SCONTROL="$OPTARG" ;; + h) printf \ +"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb] + [-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter] + [-m mixer] [-s scontrol] [-h] +Options: +-F, -f\tOutput format (-F long format, -f short format) to use, amongst: +\t0\t symb vol [index:name]\t (default long) +\t1\t symb vol [name] +\t2\t symb vol [index]\t (default short) +\t3\t symb vol +-S\tSubscribe to volume events (requires persistent block, always uses long format) +-p\tOmit the percent sign (%%) in volume +-a\tUse ALSA name if possible +-d\tUse device description instead of name if possible +-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL' +-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL' +-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL' +-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL' +-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH +-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH +-C\tColor for non-muted audio. Default: $DEFAULT_COLOR +-c\tColor for muted audio. Default: $MUTED_COLOR +-i\tInterval size of volume increase/decrease. Default: $AUDIO_INTERVAL +-m\tUse the given mixer. +-s\tUse the given scontrol. +-h\tShow this help text +" && exit 0;; + esac +done -capability() { # Return "Capture" if the device is a capture device - amixer -D $MIXER get $SCONTROL | - sed -n "s/ Capabilities:.*cvolume.*/Capture/p" -} - -volume() { - amixer -D $MIXER get $SCONTROL $(capability) -} - -format() { - perl_filter='if (/.*\[(\d+)%\] (\[(-?\d+.\d+)dB\] )?\[(on|off)\]/)' - perl_filter+='{CORE::say $4 eq "off" ? "-1" : "' - perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1') - perl_filter+='"; exit}' - perl -ne "$perl_filter" -} - -#------------------------------------------------------------------------ - -case $BLOCK_BUTTON in - 1) pavucontrol &>/dev/null &;; - 2) ~/.config/i3/cycleaudio.py;; - 3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute - 4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase - 5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease -esac - -#------------------------------------------------------------------------ - -VOL=$(volume | format) - -ACTIVE=$(pacmd list-sinks | grep '* index' | awk -F": " '{print $2}') - -if pactl list short sinks | grep -q \^$ACTIVE".*Yeti"; then - printf "" -elif pactl list short sinks | grep -q \^$ACTIVE".*bluez"; then - printf " " -elif [ "$VOL" -eq -1 ]; then - printf "X" - exit 0 -elif [ "$VOL" -eq 0 ]; then - printf "" -elif [ "$VOL" -gt 59 ]; then - printf "" -else - printf "" +if [[ -z "$MIXER" ]] ; then + MIXER="default" + if amixer -D pulse info >/dev/null 2>&1 ; then + MIXER="pulse" + fi fi -printf " $VOL" +if [[ -z "$SCONTROL" ]] ; then + SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1) +fi + +CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p") + + +function move_sinks_to_new_default { + DEFAULT_SINK=$1 + pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK + do + pacmd move-sink-input $SINK $DEFAULT_SINK + done +} + +function set_default_playback_device_next { + inc=${1:-1} + num_devices=$(pacmd list-sinks | grep -c index:) + sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+')) + default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 )) + default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices )) + default_sink=${sink_arr[$default_sink_index]} + pacmd set-default-sink $default_sink + move_sinks_to_new_default $default_sink +} + +case "$BLOCK_BUTTON" in + 1) set_default_playback_device_next ;; + 2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;; + 3) set_default_playback_device_next -1 ;; + 4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%+ ;; + 5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%- ;; +esac + +function print_format { + PERCENT="%" + [[ $USE_PERCENT == 0 ]] && PERCENT="" + case "$1" in + 1) echo "$SYMBOL$VOL$PERCENT [$NAME]" ;; + 2) echo "$SYMBOL$VOL$PERCENT [$INDEX]";; + 3) echo "$SYMBOL$VOL$PERCENT" ;; + *) echo "$SYMBOL$VOL$PERCENT [$INDEX:$NAME]" ;; + esac +} + +function print_block { + for name in INDEX NAME VOL MUTED; do + read $name + done < <(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*') + INDEX=$(echo "$INDEX" | grep -o '[0-9]\+') + VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 ) + VOL="${VOL%?}" + + NAME=$(echo "$NAME" | sed \ +'s/.*<.*\.\(.*\)>.*/\1/; t;'\ +'s/.*<\(.*\)>.*/\1/; t;'\ +'s/.*/unknown/') + + if [[ $USE_ALSA_NAME == 1 ]] ; then + ALSA_NAME=$(pacmd list-sinks |\ +awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\ +grep "alsa.name\|alsa.mixer_name" |\ +head -n1 |\ +sed 's/.*= "\(.*\)".*/\1/') + NAME=${ALSA_NAME:-$NAME} + elif [[ $USE_DESCRIPTION == 1 ]] ; then + DESCRIPTION=$(pacmd list-sinks |\ +awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\ +grep "device.description" |\ +head -n1 |\ +sed 's/.*= "\(.*\)".*/\1/') + NAME=${DESCRIPTION:-$NAME} + fi + + if [[ $MUTED =~ "no" ]] ; then + SYMBOL=$AUDIO_HIGH_SYMBOL + [[ $VOL -le $AUDIO_MED_THRESH ]] && SYMBOL=$AUDIO_MED_SYMBOL + [[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMBOL=$AUDIO_LOW_SYMBOL + COLOR=$DEFAULT_COLOR + else + SYMBOL=$AUDIO_MUTED_SYMBOL + COLOR=$MUTED_COLOR + VOL="" + fi + +# if [[ $SUBSCRIBE == 1 ]] ; then +# print_format "$LONG_FORMAT" +# else +# print_format "$LONG_FORMAT" + print_format "$SHORT_FORMAT" +# echo "$COLOR" +# fi +} + +print_block +if [[ $SUBSCRIBE == 1 ]] ; then + while read -r EVENT; do + print_block + done < <(pactl subscribe | stdbuf -oL grep change) +fi diff --git a/.config/i3/config b/.config/i3/config index 61f41cc..977dc06 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -175,10 +175,12 @@ bindsym XF86AudioPause exec --no-startup-id mpc pause bindsym XF86AudioStop exec --no-startup-id mpc stop bindsym XF86AudioNext exec --no-startup-id mpc next bindsym XF86AudioPrev exec --no-startup-id mpc previous -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1000 && pkill -RTMIN+10 i3blocks -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1000 && pkill -RTMIN+10 i3blocks -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+10 i3blocks -exec --no-startup-id "ip monitor | while read line; do pkill -RTMIN+15 i3blocks; done" +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1000 +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1000 +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle +bindsym XF86MonBrightnessUp exec xbacklight -inc 5 && pkill -RTMIN+12 i3blocks +bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3blocks +exec --no-startup-id "ip monitor | while read; do pkill -RTMIN+15 i3blocks; done" # app launch shortcuts exec --no-startup-id ~/.fehbg From 885cc62671614753fee3218ae357028d6f6bf880 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 12:44:00 +0000 Subject: [PATCH 3/8] compton: don't blur onboard/slop(maim) background --- .config/compton.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/compton.conf b/.config/compton.conf index ddd55ef..fc2c69d 100644 --- a/.config/compton.conf +++ b/.config/compton.conf @@ -29,7 +29,7 @@ alpha-step = 0.06; # XRender backend: Step size for alpha pictures. Increasin #inactive-dim-fixed = true; # Do not let dimness adjust based on window opacity. inactive-opacity-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ]; blur-background = true; # Blur background of transparent windows. -blur-background-exclude = [ "class_g = 'Peek'" ]; +blur-background-exclude = [ "class_g = 'Peek'", "class_g = 'Onboard'", "class_g = 'slop'" ]; blur-background-frame = false; # Blur background of opaque windows with transparent # frames as well. blur-background-fixed = true; # Do not let blur radius adjust based on window opacity. From 3890246f83ae61f965ffd7dd7c13def762dcedba Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 12:44:50 +0000 Subject: [PATCH 4/8] maim: replace scrot with maim for screenshots --- .config/i3/lock.sh | 19 +++++++++---------- .config/imgur-screenshot/settings.conf | 6 +++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.config/i3/lock.sh b/.config/i3/lock.sh index 53217ca..43c383c 100755 --- a/.config/i3/lock.sh +++ b/.config/i3/lock.sh @@ -5,9 +5,6 @@ tmpbg='/tmp/screen.png' (( $# )) && { icon=$1; } -# screenshot -scrot "$tmpbg" - PX=0 PY=0 # lockscreen image info @@ -25,17 +22,19 @@ SROY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 3) # y offset PX=$(($SROX + $SRX/2 - $RX/2)) PY=$(($SROY + $SRY/2 - $RY/2)) +# screenshot, pixelise and overlay +maim | convert - -scale 5% -scale 2000% $icon -geometry +$PX+$PY -composite -matte $tmpbg -# pixelize and add lock icon -convert $tmpbg -scale 5% -scale 2000% $tmpbg -convert $tmpbg $icon -geometry +$PX+$PY -composite -matte $tmpbg - -playing=$(mpc status | grep playing | wc -l) -[[ $playing == 1 ]] && mpc pause +if command mpc 2>&1 1>/dev/null; then + playing=$(mpc status | grep playing | wc -l) + [[ $playing == 1 ]] && mpc pause +fi i3lock -i "$tmpbg" -n -e -[[ $playing == 1 ]] && mpc play +if command mpc 2>&1 1>/dev/null; then + [[ $playing == 1 ]] && mpc play +fi rm "$tmpbg" diff --git a/.config/imgur-screenshot/settings.conf b/.config/imgur-screenshot/settings.conf index 1eeddc4..301164f 100644 --- a/.config/imgur-screenshot/settings.conf +++ b/.config/imgur-screenshot/settings.conf @@ -4,10 +4,10 @@ imgur_secret="" login="false" log_file="$HOME/.config/imgur-screenshot/imgur-screenshot.log" credentials_file="$HOME/.config/imgur-screenshot/credentials.conf" -file_name_format="scrot-%Y-%m-%d--%H:%M:%S.png" # when using scrot, must end with .png! +file_name_format="screenshot-%Y-%m-%d-%H%M%S.png" # when using scrot, must end with .png! file_dir="$HOME/pictures/screenshots" -screenshot_select_command="scrot -q 0 -s %img" -screenshot_window_command="scrot -q 0 -b %img" +screenshot_select_command="maim -m 10 -us %img" +screenshot_window_command="maim -m 10 -uw %img" edit_command="gimp %img" edit="false" exit_on_selection_fail="true" From 74b9523476ff27bbcac2aa60d6010249db9f92fc Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 13:03:01 +0000 Subject: [PATCH 5/8] Use persistent CPU usage block --- .config/i3/blocks/config | 2 +- .config/i3/blocks/cpu_usage | 72 +++++++++++++------------------------ 2 files changed, 26 insertions(+), 48 deletions(-) diff --git a/.config/i3/blocks/config b/.config/i3/blocks/config index 0487ca5..5b764ee 100644 --- a/.config/i3/blocks/config +++ b/.config/i3/blocks/config @@ -62,7 +62,7 @@ signal=5 [cpu_usage] label= -interval=2 +interval=persist [separator] diff --git a/.config/i3/blocks/cpu_usage b/.config/i3/blocks/cpu_usage index c0d659a..1703296 100755 --- a/.config/i3/blocks/cpu_usage +++ b/.config/i3/blocks/cpu_usage @@ -1,53 +1,31 @@ -#!/usr/bin/perl -# -# Copyright 2014 Pierre Mavro -# Copyright 2014 Vivien Didelot -# Copyright 2014 Andreas Guldstrand -# -# Licensed under the terms of the GNU GPL v3, or any later version. +#!/bin/bash +# by Paul Colby (http://colby.id.au), no rights reserved ;) +# https://github.com/Leo-G/DevopsWiki/wiki/How-Linux-CPU-Usage-Time-and-Percentage-is-calculated -use strict; -use warnings; -use utf8; -use Getopt::Long; +PREV_TOTAL=0 +PREV_IDLE=0 -# default values -my $t_warn = 50; -my $t_crit = 80; -my $cpu_usage = -1; +while true; do + # Get the total CPU statistics, discarding the 'cpu ' prefix. + CPU=(`sed -n 's/^cpu\s//p' /proc/stat`) + IDLE=${CPU[3]} # Just the idle CPU time. -sub help { - print "Usage: cpu_usage [-w ] [-c ]\n"; - print "-w : warning threshold to become yellow\n"; - print "-c : critical threshold to become red\n"; - exit 0; -} + # Calculate the total CPU time. + TOTAL=0 + for VALUE in "${CPU[@]}"; do + let "TOTAL=$TOTAL+$VALUE" + done -GetOptions("help|h" => \&help, - "w=i" => \$t_warn, - "c=i" => \$t_crit); + # 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 -e "$DIFF_USAGE%\n$DIFF_USAGE%" -# 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 'Cannot run mpstat'; -while () { - if (/^.*\s+(\d+\.\d+)\s+$/) { - $cpu_usage = 100 - $1; # 100% - %idle - last; - } -} -close(MPSTAT); + # Remember the total and idle CPU times for the next check. + PREV_TOTAL="$TOTAL" + PREV_IDLE="$IDLE" -#$cpu_usage eq -1 and die 'Can\'t find CPU information'; - -# Print short_text, full_text -printf "%.0f%%\n"x2, $cpu_usage; - -# Print color, if needed -if ($cpu_usage >= $t_crit) { - print "#FF0000\n"; -} elsif ($cpu_usage >= $t_warn) { - print "#FFCB00\n"; -} - -exit 0; + # Wait before checking again. + sleep 1 +done From 3faad3df4b18968bf7c02b498bf52634dc85dc16 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 13:03:37 +0000 Subject: [PATCH 6/8] Add/improve various shell aliases --- aliases | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/aliases b/aliases index 32460c8..c97eea2 100644 --- a/aliases +++ b/aliases @@ -11,16 +11,15 @@ alias ..ll="cd..;ll" alias ..l="..ll" alias l=ll -alias ll="ls -lFh" -alias la="ls -lAFh" -alias lat='la -t' +alias ll="ls -lFh --group-directories-first" +alias la="ls -lAFh --group-directories-first" +alias lt='ls -lAFh --sort=time' alias al=la # No, I don't need the Mono Assembly Linker alias md="mkdir -p" alias rd="rmdir -p" -mcd(){ - mkdir -p $1 && cd $1 -} +mcd(){ mkdir -p $@ && cd $@; } +alias -- -='cd -' alias cdt='cd `mktemp -d`' alias grep='grep --color' alias -g H='| head' @@ -53,6 +52,7 @@ alias cp='cp -ir' alias pacman='pacman --color=always' alias pacaur='pacaur --color=always' alias tree='tree --dirsfirst -C -F' +alias make="make -j$(nproc)" alias dd='dd status=progress' alias env='env | sort' alias ssh="ssh -tt" @@ -132,6 +132,7 @@ gd() { fi } alias gds="git diff --staged --color-words" +alias gsh="git show --color-words" alias glg="git log --stat --color" alias glog="git log --oneline --decorate --color --graph" @@ -148,7 +149,7 @@ alias grro="grr origin" alias gsta='git stash' alias gstd='gsta drop' -alias gstl='gsta list' +alias gstl='gsta list --stat --color' alias gstp='gsta pop' alias gstv="gsta show -p stash@{0}" From eba5e15cf862ebbd3a3fc89b9b0502410f888587 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 13:21:08 +0000 Subject: [PATCH 7/8] Add cmake build directories to global gitignore --- .config/git/gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/git/gitignore b/.config/git/gitignore index 9f11b75..4ce3357 100644 --- a/.config/git/gitignore +++ b/.config/git/gitignore @@ -1 +1,2 @@ .idea/ +cmake-build-*/ From 8ab712c37e510e4477f4901e1430dcf6aeaaaf0c Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Thu, 22 Feb 2018 13:24:11 +0000 Subject: [PATCH 8/8] Print decrypted GPG messages into a terminal --- .config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index 977dc06..7e92a8d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -166,7 +166,7 @@ bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3 bindsym --release Print exec imgur-screenshot bindsym --release $mod+Print exec imgur-screenshot -f bindsym $mod+Mod1+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks -bindsym $mod+numbersign exec notify-send "$(xclip -o | gpg --decrypt 2>&1)" +bindsym $mod+numbersign exec "termite -e 'sh -c xclip\ -o\ |\ gpg\ --decrypt\ 2>&1\ &&\ read'" bindsym $mod+g exec "LINK=$(gist -PRpc); notify-send -c transfer \\"$LINK\\"" # Media player controls