scripts

Utilitity scripts
git clone git://gtms.dev/scripts.git
Log | Files | Refs

commit 849241ac77808642a243bee6ae804b2ada9874c8
parent 78548087a2c3d3217a3035b2248e7ce339761784
Author: Tomas Nemec <nemi@skaut.cz>
Date:   Mon,  9 Aug 2021 23:24:00 +0200

cleanup

Diffstat:
Daudio | 7-------
Dbar-update | 3---
Dbmadd | 21---------------------
Dbmls | 35-----------------------------------
Dbmmenu | 45---------------------------------------------
Dbmrm | 54------------------------------------------------------
Mchcol | 2++
Ddmenu_pass | 17-----------------
Ddunst-reload | 4----
Dexternal_rules | 12------------
Rpassmenu_section -> passmenu-section | 0
Dplayerctl-custom.sh | 5-----
Rmdev -> tmux-dev | 0
13 files changed, 2 insertions(+), 203 deletions(-)

diff --git a/audio b/audio @@ -1,7 +0,0 @@ -#!/bin/sh - -pulseaudio-control \ - --sink-blacklist "alsa_output.pci-0000_29_00.1.hdmi-stereo-extra5" \ - --sink-nickname "alsa_output.pci-0000_2b_00.4.analog-stereo:Repro" \ - --sink-nickname "alsa_output.usb-C-Media_Electronics_Inc___Trust_GXT_363_headset-00.analog-stereo:Headset" \ - --format="\${VOL_LEVEL}% \$SINK_NICKNAME" $@ diff --git a/bar-update b/bar-update @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "$1" > $TMSBAR_PIPE diff --git a/bmadd b/bmadd @@ -1,21 +0,0 @@ -#!/usr/bin/env zsh - -usage="usage: <name> <url> [<tags>]" - -if [[ ! -f ${BOOKMARK} ]]; then - echo "BOOKMARK env is not set or not a file" >&2 - exit 1 -fi - -function add() { - name=$1 - url=$2 - tags=$3 - if [[ -z "$name" || -z "$url" ]]; then - echo $usage >&2 - exit 1 - fi - printf "[%s](%s)%s\n" $name $url $tags >&1 >> $BOOKMARK -} - -add "$@" diff --git a/bmls b/bmls @@ -1,35 +0,0 @@ -#!/usr/bin/env zsh - -usage="usage: [<name> <url>]" - -if [[ ! -f ${BOOKMARK} ]]; then - echo "BOOKMARK env is not set or not a file" >&2 - exit 1 -fi - -function list() { - name=$1 - url=$2 - - # Format search string - if [[ -n $name ]]; then - search_string="\[.*${name}.*\]" - fi - if [[ -n $url ]]; then - search_string+="(.*${url}.*)" - fi - - if [[ -z $search_string ]]; then # List bookmarks - cat $BOOKMARK - exit 0 - else # Search bookmarks - g=$(grep -i "$search_string" < $BOOKMARK) - if [[ -z $g ]];then - echo "Not found" >&2 - exit 0 - fi - echo $g - fi -} - -list "$@" diff --git a/bmmenu b/bmmenu @@ -1,45 +0,0 @@ -#!/usr/bin/env zsh - -if [[ ! -f ${BOOKMARK} ]]; then - echo "BOOKMARK env is not set or not a file" >&2 - exit 1 -fi - -key="templates" -newwin="" -while test $# -gt 0; do - case "$1" in - --new-window) - newwin="--new-window" - shift - ;; - *) - break - ;; - esac -done - -[[ $DEBUG == 1 ]] && echo "newwin=$newwin" - -function open() { - bmark=$1 - [[ -n $bmark ]] || return - - title="$(awk 'BEGIN{FS=" "} {print $1}' <<< $bmark)" - url="$(awk 'BEGIN{FS=" "} {print $2}' <<< $bmark)" - tags="$(awk 'BEGIN{FS=" "} {print $3}' <<< $bmark)" - - if [[ "$tags" =~ "$key" ]]; then - add=$(echo "" | dmenu -p $url) - $BROWSER $newwin $url$add - else - $BROWSER $newwin $url - fi -} - -sed -E 's/\[(.*)\]\((.*)\) ?(.*)?/\1 \2 \3/' $BOOKMARK | dmenu -i -p bmark: -l 8 | -while IFS= read -r line -do - [[ $DEBUG == 1 ]] && echo "line=$line" - open "$line" -done diff --git a/bmrm b/bmrm @@ -1,54 +0,0 @@ -#!/usr/bin/env zsh - -usage="usage: <name> <url>" - -if [[ ! -f ${BOOKMARK} ]]; then - echo "BOOKMARK env is not set or not a file" >&2 - exit 1 -fi - -function confirm() { - echo "$1" - vared -p "Remove (y/n): " -c ok - if [[ $ok == "y" ]]; then - sed -i "${2}d" $BOOKMARK - fi -} - -function remove() { - name="$1" - url="$2" - - # Format search string - [[ -n $name ]] || exit 1 - search_string="\[.*${name}.*\]" - if [[ -n $url ]]; then - search_string+="(.*${url}.*)" - fi - - # Search bookmarks - g=$(grep -in "$search_string" < $BOOKMARK) - if [[ -z $g ]];then - echo "Not found" >&2 - exit 0 - fi - count=$(wc -l <<< "$g") - - # Selection, Confirm and remove - if [[ $count -gt 1 ]]; then - echo $g - vared -p "Number: " -c num - - if [[ $num != <-> ]]; then - echo "Not a number" - exit 1 - fi - - confirm "$(sed -n "/^$num/p" <<< "$g")" "$num" - else - num=$(awk 'BEGIN{FS=":"}{print $1}' <<< "$g") - confirm "$g" "$num" - fi -} - -remove "$@" diff --git a/chcol b/chcol @@ -1,4 +1,6 @@ #!/bin/zsh +# Change colorscheme +# usage: chcol <light|dark> theme="$1" themes=(light dark) diff --git a/dmenu_pass b/dmenu_pass @@ -1,17 +0,0 @@ -#!/bin/lua - --- get pswd from dmenu -local f = io.popen('1pass | dmenu ' .. table.concat(arg, ' ')) -local name = f:read('*l') - -if name then - local f2 = io.popen(string.format('1pass -p "%s" username', name)) - local username = f2:read('*l'); - if username then - os.execute(string.format('1pass "%s"', name)) - os.execute(string.format('notify-send "%s" "%s"', name, username)) - end -else - return -end - diff --git a/dunst-reload b/dunst-reload @@ -1,4 +0,0 @@ -#!/bin/env zsh - -killall dunst -notify-send foo diff --git a/external_rules b/external_rules @@ -1,12 +0,0 @@ -#!/bin/lua - -local wid = arg[1] -local class = arg[2] -local instance = arg[3] -local consequences = arg[4] - -local cmd = io.popen(string.format('xprop -id %s %s', wid, 'WM_WINDOW_ROLE')) -if cmd:read('l'):find('pop%-up') then - print('state=floating') -end -cmd:close() diff --git a/passmenu_section b/passmenu-section diff --git a/playerctl-custom.sh b/playerctl-custom.sh @@ -1,5 +0,0 @@ -#!/bin/sh - -a="`dbus-send --reply-timeout=1000 --print-reply --dest="org.mpris.MediaPlayer2.spotifyd" /org/mpris/MediaPlayer2 "org.freedesktop.DBus.Properties.Get" string:"org.mpris.MediaPlayer2.Player" string:"PlaybackStatus"`" -status="`echo $a | sed -n 's/.* string \"\(.*\)\"/\1/p'`" -echo $status diff --git a/mdev b/tmux-dev