Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
colonelpanic8 committed Aug 2, 2021
1 parent 2de9e23 commit f0458e6
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 17 deletions.
3 changes: 0 additions & 3 deletions dotfiles/lib/bin/brightness.sh

This file was deleted.

10 changes: 5 additions & 5 deletions dotfiles/lib/bin/dbus-introspect.sh
Original file line number Diff line number Diff line change
@@ -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//"
3 changes: 1 addition & 2 deletions dotfiles/lib/bin/get_sink_input_by_pid.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env zsh

#!/usr/bin/env sh

get_sink_input_info.hs | jq 'select(.application_process_id == "'"$thePID"'")'
2 changes: 1 addition & 1 deletion dotfiles/lib/bin/run_unity.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh

XDG_CURRENT_DESKTOP='Unity' $@
XDG_CURRENT_DESKTOP='Unity' "$@"
26 changes: 26 additions & 0 deletions dotfiles/lib/shellenv/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"'")'
}
2 changes: 1 addition & 1 deletion dotfiles/zprofile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
source ~/.lib/login.sh

2 changes: 1 addition & 1 deletion dotfiles/zshenv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
source ~/.lib/shellenv.sh

25 changes: 23 additions & 2 deletions dotfiles/zshrc
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions rcm-link.sh
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down

0 comments on commit f0458e6

Please sign in to comment.