Misc changes

This commit is contained in:
Ivan Malison 2021-08-02 00:27:54 -06:00
parent 2de9e2388e
commit f0458e61b5
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
9 changed files with 59 additions and 17 deletions

View File

@ -1,3 +0,0 @@
#!/usr/bin/env zsh
volnoti-show $(sudo macbook_brightness.py -c "$@" -p)

View File

@ -1,8 +1,8 @@
#!/usr/bin/env zsh
#!/usr/bin/env sh
dbus-send --session \
dbus-send --session \
--dest=$1 \
--type=method_call \
--print-reply \
$2 \
--type=method_call \
--print-reply \
$2 \
org.freedesktop.DBus.Introspectable.Introspect | tail -n +2 | sed -e "s/^ *string//"

View File

@ -1,4 +1,3 @@
#!/usr/bin/env zsh
#!/usr/bin/env sh
get_sink_input_info.hs | jq 'select(.application_process_id == "'"$thePID"'")'

View File

@ -1,3 +1,3 @@
#!/usr/bin/env sh
XDG_CURRENT_DESKTOP='Unity' $@
XDG_CURRENT_DESKTOP='Unity' "$@"

View File

@ -270,3 +270,29 @@ function all_after_char {
echo ${line##*$1}
done;
}
function pasink {
pacmd stat | awk -F": " '/^Default sink name: /{print $2}'
}
function pavolume {
pacmd list-sinks |
awk '/^\s+name: /{indefault = $2 == "<'"$(pasink)"'>"}
/^\s+volume: / && indefault {print $5; exit}' | grep -Eo "[0-9]*"
}
function paismuted {
pactl list sinks | grep "$(pasink)" -A 10 | grep Mute | grep -q yes
}
function pashowvolume {
if paismuted; then
volnoti-show -m
else
volnoti-show "$(min $(pavolume) 100)"
fi
}
function pashowinputbypid {
get_sink_input_info.hs | jq 'select(.application_process_id == "'"$1"'")'
}

View File

@ -1 +1 @@
source ~/.lib/login.sh

View File

@ -1 +1 @@
source ~/.lib/shellenv.sh

View File

@ -1,6 +1,27 @@
# This is necessary for tramp.
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
source ~/.lib/shellrc.sh
source ~/.lib/zsh.sh
test -r ~/.custom.sh && source ~/.custom.sh
source_if_exists ~/.this-machine.sh
function emacs_ansi_term_support {
echo -e "\033AnSiTu" "$LOGNAME" # $LOGNAME is more portable than using whoami.
echo -e "\033AnSiTc" "$(pwd)"
if [ $(uname) = "SunOS" ]; then
# The -f option does something else on SunOS and is not needed anyway.
hostname_options="";
else
hostname_options="-f";
fi
# XXX/TODO: This disables correct setting of the current directory
# when in an sshed shell when inside of emacs
# echo -e "\033AnSiTh" "$(hostname $hostname_options)" # Using the -f option can #
# cause problems on some OSes.
}
if environment_variable_exists INSIDE_EMACS; then
if [[ $INSIDE_EMACS == *"term"* ]]
then
add-zsh-hook precmd emacs_ansi_term_support
fi
fi

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
export THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export DOTFILES_DIR="$(readlink -f $THIS_DIR/dotfiles)"