From 0f0409e3ffef48bd20b3aa31d03cb1ac6e35f385 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 13 Jun 2020 11:52:33 -0400 Subject: cleanup, updated locking/autolocking --- 6cord.sh | 2 - autolocker.sh | 10 ++ gen_meme.sh | 12 --- i3blocks-message.sh | 0 innernet.sh | 4 + locker.sh | 2 +- mounter.sh | 20 ---- mutt-open.sh | 3 - sleeper.sh | 3 + toggle-docked.sh | 4 + unmounter.sh | 21 ----- wpg | 12 --- wpg-install.sh | 262 ---------------------------------------------------- yt.sh | 4 +- 14 files changed, 24 insertions(+), 335 deletions(-) delete mode 100755 6cord.sh create mode 100755 autolocker.sh delete mode 100755 gen_meme.sh mode change 100644 => 100755 i3blocks-message.sh delete mode 100755 mounter.sh delete mode 100755 mutt-open.sh create mode 100755 sleeper.sh delete mode 100755 unmounter.sh delete mode 100755 wpg delete mode 100755 wpg-install.sh diff --git a/6cord.sh b/6cord.sh deleted file mode 100755 index 49fbb24..0000000 --- a/6cord.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -6cord -t "$(cat ~/.config/6cord/token)" diff --git a/autolocker.sh b/autolocker.sh new file mode 100755 index 0000000..5c79e23 --- /dev/null +++ b/autolocker.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +notifier="notify-send -t=10000 '10 seconds to lock...'" +locker="xautolock -notify 10 -time 10 -locker locker.sh" + +if [ "$1" = "-d" ]; then + $locker -notifier "$notifier" +else + $locker -detectsleep -killtime 10 -killer "sleeper.sh" -notifier "$notifier" +fi diff --git a/gen_meme.sh b/gen_meme.sh deleted file mode 100755 index 258dba8..0000000 --- a/gen_meme.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Construct a memebot query from a list of memes and entered text. - -meme=$(dmenu -l 10 -p "Which meme?" < ~/.local/bin/.memes) -echo Top text? -read top -echo Bottom text? -read bottom -echo "$top,$bottom | $meme" | xclip -i -echo Copied. - diff --git a/i3blocks-message.sh b/i3blocks-message.sh old mode 100644 new mode 100755 diff --git a/innernet.sh b/innernet.sh index 786505b..38e1310 100755 --- a/innernet.sh +++ b/innernet.sh @@ -1,5 +1,9 @@ #!/bin/sh +# Destroy existing interfaces +ifconfig lagg0 destroy +ifconfig wlan0 destroy + # Ethernet up ifconfig em0 up diff --git a/locker.sh b/locker.sh index 89549fe..6bd868b 100755 --- a/locker.sh +++ b/locker.sh @@ -1,6 +1,6 @@ #!/bin/sh -## Alternative, use the vignette wallpaper set by themer sript. +## Alternative, use the vignette wallpaper set by themer script. i3lock -n -f -c 000000 -i $HOME/.local/share/wallpapers/lock.png; sleep 0.2 diff --git a/mounter.sh b/mounter.sh deleted file mode 100755 index 98f0c13..0000000 --- a/mounter.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Get list of possible partitions to mount. Only select partitions that have -# not been mounted and display their name and size as dmenu options. -parts=$( - lsblk -nlpo NAME,SIZE,TYPE,MOUNTPOINT | grep "part $" | cut -f 1,4 -d' ' -) -[[ -z $parts ]] && exit 1 - -# Prompt for partition to mount. -choice=$( - echo "$parts" | dmenu -i -p "Mount which partition?" | cut -f 1 -d' ' -) -[[ -z $choice ]] && exit 1 - -# Create a mount directory if none exists. Use UUID for unique name. -mntdir="/mnt/$(lsblk -n "$choice" -o UUID | cut -f 1 -d' ')" -sudo mkdir -p "$mntdir" -sudo mount "$choice" "$mntdir" - diff --git a/mutt-open.sh b/mutt-open.sh deleted file mode 100755 index 162c4cf..0000000 --- a/mutt-open.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -exec urxvt -e mutt -F ~/.muttrc "$@" - diff --git a/sleeper.sh b/sleeper.sh new file mode 100755 index 0000000..c52ef27 --- /dev/null +++ b/sleeper.sh @@ -0,0 +1,3 @@ +#!/bin/sh +acpiconf -s3 + diff --git a/toggle-docked.sh b/toggle-docked.sh index 4e2cb89..beb0965 100755 --- a/toggle-docked.sh +++ b/toggle-docked.sh @@ -2,6 +2,8 @@ hasVGA=$(xrandr | grep VGA-0 | cut -w -f2) if [ "$hasVGA" = "connected" ]; then + killall xautolock + autolocker.sh -d & xrandr \ --output VGA-0 \ --mode 1024x768 \ @@ -23,6 +25,8 @@ if [ "$hasVGA" = "connected" ]; then --output DP-4 \ --off else + killall xautolock + autolocker.sh & xrandr \ --output VGA-0 \ --off \ diff --git a/unmounter.sh b/unmounter.sh deleted file mode 100755 index 3c1822f..0000000 --- a/unmounter.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# Get list of possible partitions to unmount. Only select partitions that have -# been mounted and display their name and size as dmenu options. -parts=$( - lsblk -nlpo NAME,SIZE,TYPE,MOUNTPOINT | grep "part .+$" | cut -f 1,4 -d' ' -) -[[ -z $parts ]] && exit 1 -exit - -# Prompt for partition to mount. -choice=$( - echo "$parts" | dmenu -i -p "Mount which partition?" | cut -f 1 -d' ' -) -[[ -z $choice ]] && exit 1 - -# Create a mount directory if none exists. Use UUID for unique name. -mntdir="/mnt/$(lsblk -n "$choice" -o UUID | cut -f 1 -d' ')" -sudo mkdir -p "$mntdir" -sudo mount "$choice" "$mntdir" - diff --git a/wpg b/wpg deleted file mode 100755 index 693a550..0000000 --- a/wpg +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/local/bin/python3.7 -# EASY-INSTALL-ENTRY-SCRIPT: 'wpgtk==6.1.0','console_scripts','wpg' -__requires__ = 'wpgtk==6.1.0' -import re -import sys -from pkg_resources import load_entry_point - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit( - load_entry_point('wpgtk==6.1.0', 'console_scripts', 'wpg')() - ) diff --git a/wpg-install.sh b/wpg-install.sh deleted file mode 100755 index 9cf076e..0000000 --- a/wpg-install.sh +++ /dev/null @@ -1,262 +0,0 @@ -#!/usr/bin/env bash - -__ScriptVersion="0.1.5"; - -if [ -n "${XDG_CONFIG_HOME}" ]; then - CONFIG="${XDG_CONFIG_HOME}" -else - CONFIG="${HOME}/.config" -fi - -if [ -n "${XDG_DATA_HOME}" ]; then - LOCAL="${XDG_DATA_HOME}" -else - LOCAL="${HOME}/.local/share" -fi - -THEMES_DIR="${HOME}/.themes"; -SRC_DIR="${PWD}/wpgtk-templates"; -TEMPLATE_DIR="${CONFIG}/wpg/templates"; - -#=== FUNCTION ================================================================ -# NAME: wpg-install.sh -# DESCRIPTION: Installs various wpgtk themes. -#=============================================================================== -usage() -{ - echo "Usage : $0 [options] [--] - - Options: - -h Display this message - -v Display script version - -o Install openbox templates - -t Install tint2 template - -g Install gtk template - -i Install icon-set - -r Install rofi template - -I Install i3 template - -p Install polybar template - -b Install bspwm template - -d Install dunst template - -H Specify hash of wpgtk-templates repository to use - " -} - -checkprogram() -{ - command -v $1 >/dev/null 2>&1; - if [[ $? -eq 1 ]]; then - echo "Please install $1 before proceeding"; - exit 1; - fi -} - -getfiles() -{ - checkprogram 'git'; - checkprogram 'wpg'; - mkdir -p "${LOCAL}/themes/color_other"; - mkdir -p "${LOCAL}/icons"; - git clone https://github.com/deviantfero/wpgtk-templates "$SRC_DIR"; - if [[ $? -eq 0 ]]; then - cd "$SRC_DIR"; - [[ ! -z "$commit" ]] && git checkout $commit; - return 0; - else - exit 1; - fi -} - -install_tint2() -{ - echo -n "This might override your tint2 config, Continue?[Y/n]: "; - read -r response; - if [[ ! "$response" == "n" ]]; then - echo "Installing tint2 config"; - echo ":: backing up current tint2 conf in tint2rc.old.bak"; - cp "${CONFIG}/tint2/tint2rc" "${CONFIG}/tint2/tint2rc.old.bak" 2>/dev/null; - cp --remove-destination ./tint2/tint2rc "${CONFIG}/tint2/tint2rc" && \ - cp --remove-destination ./tint2/tint2rc.base "${TEMPLATE_DIR}" && \ - ln -sf "${CONFIG}/tint2/tint2rc" "${TEMPLATE_DIR}/tint2rc" && \ - echo ":: tint2 template install done." - return 0; - fi - echo ":: tint2 template not installed"; -} - -install_rofi() -{ - echo -n "This might override your rofi config, Continue?[Y/n]: "; - read -r response; - if [[ ! "$response" == "n" ]]; then - echo "Installing rofi config"; - echo ":: backing up current rofi conf in rofi.bak"; - cp "${CONFIG}/rofi/config" "${CONFIG}/rofi/config.bak" 2>/dev/null; - cp --remove-destination ./rofi/config "${CONFIG}/rofi/config" && \ - cp --remove-destination ./rofi/rofi.base "${TEMPLATE_DIR}" && \ - ln -sf "${CONFIG}/rofi/config" "${TEMPLATE_DIR}/rofi" && \ - echo ":: rofi template install done." - return 0; - fi - echo ":: rofi template not installed"; -} - -install_i3() -{ - echo -n "This might override your i3 config, Continue?[Y/n]: "; - read -r response; - if [[ ! "$response" == "n" ]]; then - echo "Installing i3 config"; - echo ":: backing up current i3 conf in config.bak"; - cp "${CONFIG}/i3/config" "${CONFIG}/i3/config.bak" 2>/dev/null; - cp --remove-destination ./i3/config "${CONFIG}/i3/config" && \ - cp --remove-destination ./i3/i3.base "${TEMPLATE_DIR}" && \ - ln -sf "${CONFIG}/i3/config" "${TEMPLATE_DIR}/i3" && \ - echo ":: i3 template install done." - return 0; - fi - echo ":: i3 template not installed"; -} - -install_polybar() -{ - echo -n "This might override your polybar config, Continue?[Y/n]: "; - read -r response; - if [[ ! "$response" == "n" ]]; then - echo "Installing polybar config"; - echo ":: backing up current polybar conf in config.bak"; - cp "${CONFIG}/polybar/config" "${CONFIG}/polybar/config.bak" 2>/dev/null; - cp --remove-destination ./polybar/config "${CONFIG}/polybar/config" && \ - cp --remove-destination ./polybar/polybar.base "${TEMPLATE_DIR}" && \ - ln -sf "${CONFIG}/polybar/config" "${TEMPLATE_DIR}/polybar" && \ - echo ":: polybar template install done." - return 0; - fi - echo ":: polybar template not installed"; -} - -install_gtk() -{ - echo "Installing gtk themes"; - cp -r ./FlatColor "${LOCAL}/themes/" && \ - - cp --remove-destination ./FlatColor/gtk-2.0/gtkrc.base "${TEMPLATE_DIR}/gtk2.base" && \ - ln -sf "${LOCAL}/themes/FlatColor/gtk-2.0/gtkrc" "${TEMPLATE_DIR}/gtk2" && \ - ln -sf "${LOCAL}/themes/FlatColor" "${THEMES_DIR}/FlatColor" && \ - echo ":: gtk2 theme done" "${TEMPLATE_DIR}/gtk2"; - - cp --remove-destination ./FlatColor/gtk-3.0/gtk.css.base "${TEMPLATE_DIR}/gtk3.0.base" && \ - ln -sf "${LOCAL}/themes/FlatColor/gtk-3.0/gtk.css" "${TEMPLATE_DIR}/gtk3.0" && \ - echo ":: gtk3.0 theme done" - - cp --remove-destination ./FlatColor/gtk-3.20/gtk.css.base "${TEMPLATE_DIR}/gtk3.20.base" && \ - ln -sf "${LOCAL}/themes/FlatColor/gtk-3.20/gtk.css" "${TEMPLATE_DIR}/gtk3.20" && \ - echo ":: gtk3.20 theme done" - - echo ":: FlatColor gtk themes install done." -} - -install_icons() -{ - echo "Installing icon pack"; - cp -r flattrcolor "${LOCAL}/icons/" && \ - cp -r flattrcolor-dark "${LOCAL}/icons/" && \ - echo ":: flattr icons install done." -} - -install_openbox() -{ - echo "Installing openbox themes"; - cp --remove-destination -r ./openbox/colorbamboo/* "${LOCAL}/themes/colorbamboo" - - if [[ $? -eq 0 ]]; then - mv "${LOCAL}/themes/colorbamboo/openbox-3/themerc.base" "${TEMPLATE_DIR}/ob_colorbamboo.base" && \ - ln -sf "${LOCAL}/themes/colorbamboo/openbox-3/themerc" "${TEMPLATE_DIR}/ob_colorbamboo" && \ - ln -sf "${LOCAL}/themes/colorbamboo" "${THEMES_DIR}/colorbamboo" && \ - echo ":: colorbamboo openbox themes install done."; - fi -} - -install_bspwm() -{ - echo "Installing bspwm colors"; - mv "./bspwm/bspwm_colors.base" "${TEMPLATE_DIR}/bspwm_colors.base"; - mv "./bspwm/bspwm_colors" "${TEMPLATE_DIR}/bspwm_colors"; - ln -sf "${CONFIG}/bspwm/bspwm_colors.sh" "${TEMPLATE_DIR}/bspwm_colors" && \ - printf 'bash %s/bspwm/bspwm_colors.sh &' ${CONFIG} >> "${CONFIG}/bspwm/bspwmrc"; - echo ":: bspwm colors install done."; -} - -install_dunst() -{ - echo "Installing dunst colors"; - echo ":: backing up current dunst conf in dunstrc.bak"; - cp "${CONFIG}/dunst/dunstrc" "${CONFIG}/dunst/dunstrc.bak" 2>/dev/null; - - mv "./dunst/dunstrc.base" "${TEMPLATE_DIR}/dunstrc.base"; - mv "./dunst/dunstrc" "${TEMPLATE_DIR}/dunstrc"; - ln -sf "${CONFIG}/dunst/dunstrc" "${TEMPLATE_DIR}/dunstrc" && \ - echo ":: dunst colors install done."; -} - -clean_up() -{ - rm -rf "$SRC_DIR"; -} - - -#----------------------------------------------------------------------- -# Handle command line arguments -#----------------------------------------------------------------------- - -getargs() -{ - while getopts "H:bhvotgiIprd" opt - do - case $opt in - h) - usage; - exit 0 - ;; - v) - echo "$0 -- Version $__ScriptVersion"; - exit 0; - ;; - o) openbox="true" ;; - i) icons="true" ;; - g) gtk="true" ;; - t) tint2="true" ;; - r) rofi="true" ;; - I) i3="true" ;; - p) polybar="true" ;; - b) bspwm="true" ;; - d) dunst="true" ;; - H) commit="${OPTARG}" ;; - *) - echo -e "\n Option does not exist : $OPTARG\n" - usage; - exit 1 - ;; - - esac - done - shift "$((OPTIND - 1))" -} - -main() -{ - getargs "$@"; - getfiles; - [[ "$openbox" == "true" ]] && install_openbox; - [[ "$tint2" == "true" ]] && install_tint2; - [[ "$rofi" == "true" ]] && install_rofi; - [[ "$gtk" == "true" ]] && install_gtk; - [[ "$icons" == "true" ]] && install_icons; - [[ "$polybar" == "true" ]] && install_polybar; - [[ "$i3" == "true" ]] && install_i3; - [[ "$bspwm" == "true" ]] && install_bspwm; - [[ "$dunst" == "true" ]] && install_dunst; - clean_up; -} - -main "$@" diff --git a/yt.sh b/yt.sh index a1c8261..d422a66 100755 --- a/yt.sh +++ b/yt.sh @@ -109,7 +109,7 @@ download_audio() { play_video() { url="$1" notify-send "Playing video..." "$(get_info $url)" & - mpv --no-terminal --geometry=25%-10-40 --title=yt.sh $url & + mpv --no-terminal --geometry=25%-10-40 --title="Streaming from YouTube" $url & } @@ -117,7 +117,7 @@ play_video() { play_audio() { url="$1" notify-send "Playing audio..." "$(get_info $url)" & - $TERMINAL -t yt.sh -e mpv --no-video $url & + $TERMINAL -t "Streaming from YouTube" -e mpv --no-video $url & } -- cgit v1.2.3