小物類いろいろ。作りっぱなし置きっぱなし。 <> == スクリーンショット == * 単一のウィンドウをキャプチャする場合はそのウィンドウをクリック * 画面全体をキャプチャする場合は第一引数に-rootを与えてどこかを適当にクリック {{{#!highlight c #!/bin/sh prefix='/tmp' output=$(date +"$prefix/cap%y%m%d%H%M%S.png") if [ $# -ge 1 ] && [ $1 = '-root' ]; then xwininfo > /dev/null import -window root $output else import $output fi }}} == dwmのパッチ == dwm 6.0で動作確認。たぶん5.8.2や5.9でも使えるはず。 * [[attachment:dwm-6.0-rotate.diff]] - ウィンドウ配置を時計回りに回転する(タイル配置時) * [[attachment:dwm-6.0-statuscolor.diff]] - ステータス領域に固有の色を設定可能にする * [[attachment:dwm-6.0-moderatetile.diff]] - タイル配置かつ縦横に見てウィンドウ数が1の場合、余白を入れる * 詳細は[[clear/note/2012-05#05/07|こちら]] == dwm用ステータスバー == 環境や起動の仕方によってはdwmが終了しても生き残る場合があるので、そのような場合は生存確認をする。 {{{ pgrep -aU $(id -u) dwm > /dev/null if [ $? -eq 1 ]; then exit 0 else sleep 30 fi }}} === シンプルなバッテリ状態+時計 === あまり画面に余裕のないラップトップ用。 {{{#!highlight sh #!/bin/sh export LC_TIME=C # 曜日の表記のため while true; do b=$(acpi) state=$(echo $b | awk 'BEGIN{s=" "}/Discharging/{s="- "}/Charging/{s="+ "}END{print s}') remain=$(echo $b | awk '{print $4}'|tr -d '%,') xsetroot -name "$remain$state$(date +"%a %d %R")" sleep 30 done }}} === 普通の時計 === 月日と曜日、時刻。 {{{#!highlight sh #!/bin/sh while true; do xsetroot -name "$(date +"%m/%d(%a) %R")" sleep 30 done }}} == 色 == === 16色端末 === 端末エミュレータの色設定を確認するためのもの。 {{{#!highlight bash #!/usr/local/bin/bash reset="\033[0m" echo -e "\033[30mblack\t\033[1;30mbold black$reset" echo -e "\033[31mred\t\033[1;31mbold red$reset" echo -e "\033[32mgreen\t\033[1;32mbold green$reset" echo -e "\033[33myellow\t\033[1;33mbold yellow$reset" echo -e "\033[34mblue\t\033[1;34mbold blue$reset" echo -e "\033[35mmagenta\t\033[1;35mbold magenta$reset" echo -e "\033[36mcyan\t\033[1;36mbold cyan$reset" echo -e "\033[37mwhite\t\033[1;37mbold white$reset" }}} == デュアルディスプレイ == ノートPCをプロジェクタ等に接続して外部出力する際の設定を行うスクリプト。 {{{#!highlight sh #!/bin/sh # vgaout.sh [l|r|a|b] on|off # monitor on the laptop LCD=LVDS1 # external monitor VGA=VGA1 orientation='--below' if [ $# -gt 1 ]; then case $1 in l) orientation='--left-of' ;; r) orientation='--right-of' ;; a) orientation='--above' ;; b|*) orientation='--below' ;; esac op=$2 else op=$1 fi case $op in on) echo "$VGA: on($(echo $orientation | tr - \ | sed 's/^ \(.*\)/\1/') $LCD)" xrandr --output $VGA --auto $orientation $LCD ;; off) echo $VGA: off xrandr --output $VGA --off ;; *) echo unknown option exit 1 ;; esac }}}