From 2dc2feacf35cfebade39b2e2797e02ac6d84c4c4 Mon Sep 17 00:00:00 2001 From: Tslil Clingman Date: Fri, 5 Dec 2014 11:59:55 +0200 Subject: Tweaks and ratpoison window switcher --- aur | 3 +-- ce | 15 ++++++++------- ci | 4 ++-- m | 2 +- ratws | 14 ++++++++++++++ sc | 2 +- wls | 3 ++- 7 files changed, 29 insertions(+), 14 deletions(-) create mode 100755 ratws diff --git a/aur b/aur index 30df19a..093741e 100755 --- a/aur +++ b/aur @@ -1,5 +1,4 @@ -# Simple AUR wrapper -#!/bin/sh +#!/bin/dash if [ "$1" = "-s" ]; then shift echo Searching for "$*" ... diff --git a/ce b/ce index 49946b1..e777877 100755 --- a/ce +++ b/ce @@ -1,13 +1,14 @@ -# Smart directory changer using the power of grep ;) -# source in a function j() { . ce $*} or some such #!/bin/bash +# Smart directory changer using the power of grep ;) +# source in a function j() { ce $*; cd `head -n 1 ~/.local/share/dir_lst` } +# or some such [ "$1" = "$HOME" ] && echo $HOME && exit -fl="$HOME/.local/share/dir_lst";[ ! -f "$fl" ] && touch "$fl" -[ "$2" = "!" ] && echo "$1" && exit || \ +fl="$HOME/.local/share/dir_lst"; [ ! -f "$fl" ] && touch "$fl" +[ "$2" = '!' ] && echo $1 && exit || \ ln=`grep -n "$1" "$fl" | head -n 1 | cut -d : -f 1` -if [ ! "$1" = "" ]; then if [ ! "$ln" = "" ]; then -cd `echo -e "$ln m0\n1p\nw"|ed -s "$fl"` ||echo \?; else +if [ "$1" != "" ]; then if [ "$ln" != "" ]; then +echo -e "$ln m0\n1p\nw" | ed -s "$fl" || echo \?; else l=$1; while [ ! -d "$l" ]; do echo \?; read l; done; -l=`echo "$l" | sed "s|^[^/]|$PWD/&|"`; cd $l +l=`echo "$l" | sed "s|^[^/]|$PWD/&|"`; echo -e "0i\n$l\n.\nw" | ed -s "$fl"; sed -i '43,$d' "$fl" fi; else echo -e "2 m0\nw" | ed -s "$fl"; fi; diff --git a/ci b/ci index 7418f79..c0ab20c 100755 --- a/ci +++ b/ci @@ -1,7 +1,7 @@ -# Convenient frontend for quickly evaluating C code #!/bin/bash +# Convenient frontend for quickly evaluating C code -LIBR="stdlib stdio math ieee754 limits" +LIBR="stdlib stdio math ieee754 limits stdint" FLAG="-Wall -lm" NAME=/tmp/$RANDOM-$RANDOM diff --git a/m b/m index d9f6799..c73f8eb 100755 --- a/m +++ b/m @@ -1,5 +1,5 @@ -# MPD control script based on socat and an idea I saw somewhere #!/bin/bash +# MPD control script based on socat and an idea I saw somewhere case "$1" in "") socat - tcp-connect:localhost:6600 | grep -v '^OK' | sed 's/^$//';; diff --git a/ratws b/ratws new file mode 100755 index 0000000..7f55235 --- /dev/null +++ b/ratws @@ -0,0 +1,14 @@ +#!/usr/bin/env dash + +font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*" +screen=$(ratpoison -c sdump | tr ',' '\n' | grep '1$') +width=$(echo $screen | cut -d ' ' -f 4) +height=$(echo $screen | cut -d ' ' -f 5) +s=$(echo $screen | cut -d ' ' -f 1) +w=$(($width/3)) +h=$(($height/3)) + +alias dm="dmenu -l 16 -s $s -x $w -y $h -w $w -p \"Select >\" -sb '#0B0' -sf black -nb '#000' -fn $font -i" + +sel=$(ratpoison -c windows | dm | cut -d ' ' -f 1) +[ ! "$sel" = "" ] && ratpoison -c "select $sel" || true diff --git a/sc b/sc index 8fa6029..17ec791 100755 --- a/sc +++ b/sc @@ -1,5 +1,5 @@ -# Quick hack to manage screen hotplugging #!/bin/dash +# Quick hack to manage screen hotplugging case "$1" in "d") xrandr --nograb --output CRT1 --off --output LVDS --auto;; "r") xrandr --nograb --output CRT1 --auto --primary --output LVDS --off;; diff --git a/wls b/wls index bad8319..dc6db1c 100755 --- a/wls +++ b/wls @@ -1,6 +1,7 @@ -# Terribly written wireless network control script #!/bin/bash +# Terribly written wireless network control script + dird="${HOME}/.config/wireless" sudo killall wpa_supplicant &> /dev/null -- cgit v1.2.3