2985
コメント: supress output
|
3595
オプションが間違ってたのを修正
|
削除された箇所はこのように表示されます。 | 追加された箇所はこのように表示されます。 |
行 1: | 行 1: |
= 小物類いろいろ = 作りっぱなし置きっぱなし。 |
小物類いろいろ。作りっぱなし置きっぱなし。 <<TableOfContents(3)>> |
行 5: | 行 6: |
=== タイマー付き、画面全体 === 第一引数にファイル名、第2引数に待ち時間(指定しなければ0)を与える。すぐに制御を返す。 {{{#!highlight bash #!/usr/local/bin/bash if [ $# -eq 2 ]; then sleeptime=$2 |
* 単一のウィンドウをキャプチャする場合はそのウィンドウをクリック * 画面全体をキャプチャする場合は第一引数に-rootを与えてどこかを適当にクリック {{{#!highlight c #!/bin/sh prefix='/tmp' output=$(date +"$prefix/cap%y%m%d%H%M%S.png") if [ $# -ge 1 ] && [ $1 = '-root' ]; then echo 'Click somewhere...' xwininfo > /dev/null import -window root $output |
行 12: | 行 19: |
sleeptime=0 | echo 'Click the window to capture...' id=$(xwininfo | grep "Window id:" | cut -d \ -f 4) && import -window $id $output |
行 14: | 行 22: |
(sleep $sleeptime; import -window root $1; echo "captured.")& | |
行 17: | 行 24: |
=== クリックしたウィンドウ === 実行するとマウスポインタが十字になるのでスクリーンショットを撮りたいウィンドウをクリックする。 {{{#!highlight sh #!/bin/sh id=$(xwininfo | grep "Window id:" | awk '{ print $4 }') && import -window $id $(date +"~/picture/scrnshot/scrnshot%y%m%d%H%M%S.png") }}} |
== 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|こちら]] |
行 60: | 行 67: |
端末エミュレータの色設定を確認するためのもの。 | |
行 74: | 行 82: |
ノートPCをプロジェクタ等に接続して外部出力する際の設定を行うスクリプト。 | |
行 76: | 行 85: |
# vgaset.sh [l|r|t|b] on|off | # vgaout.sh [l|r|a|b] on|off |
行 78: | 行 87: |
# monitor on the device | # monitor on the laptop |
行 83: | 行 92: |
orientation='-below' | orientation='--below' |
行 87: | 行 96: |
orientation='-left-of' | orientation='--left-of' |
行 90: | 行 99: |
orientation='-right-of' | orientation='--right-of' |
行 92: | 行 101: |
t) orientation='-upper' |
a) orientation='--above' |
行 96: | 行 105: |
orientation='-below' | orientation='--below' |
行 106: | 行 115: |
echo "$VGA: on($(echo $orientation | sed 's/-/ /g') $LCD)" | echo "$VGA: on($(echo $orientation | tr - \ | sed 's/^ \(.*\)/\1/') $LCD)" |
小物類いろいろ。作りっぱなし置きっぱなし。
スクリーンショット
- 単一のウィンドウをキャプチャする場合はそのウィンドウをクリック
- 画面全体をキャプチャする場合は第一引数に-rootを与えてどこかを適当にクリック
1 #!/bin/sh
2
3 prefix='/tmp'
4 output=$(date +"$prefix/cap%y%m%d%H%M%S.png")
5
6 if [ $# -ge 1 ] && [ $1 = '-root' ]; then
7 echo 'Click somewhere...'
8 xwininfo > /dev/null
9 import -window root $output
10 else
11 echo 'Click the window to capture...'
12 id=$(xwininfo | grep "Window id:" | cut -d \ -f 4) && import -window $id $output
13 fi
dwmのパッチ
dwm 6.0で動作確認。たぶん5.8.2や5.9でも使えるはず。
dwm-6.0-rotate.diff - ウィンドウ配置を時計回りに回転する(タイル配置時)
dwm-6.0-statuscolor.diff - ステータス領域に固有の色を設定可能にする
dwm-6.0-moderatetile.diff - タイル配置かつ縦横に見てウィンドウ数が1の場合、余白を入れる
詳細はこちら
dwm用ステータスバー
環境や起動の仕方によってはdwmが終了しても生き残る場合があるので、そのような場合は生存確認をする。
pgrep -aU $(id -u) dwm > /dev/null if [ $? -eq 1 ]; then exit 0 else sleep 30 fi
シンプルなバッテリ状態+時計
あまり画面に余裕のないラップトップ用。
普通の時計
月日と曜日、時刻。
色
16色端末
端末エミュレータの色設定を確認するためのもの。
1 #!/usr/local/bin/bash
2 reset="\033[0m"
3 echo -e "\033[30mblack\t\033[1;30mbold black$reset"
4 echo -e "\033[31mred\t\033[1;31mbold red$reset"
5 echo -e "\033[32mgreen\t\033[1;32mbold green$reset"
6 echo -e "\033[33myellow\t\033[1;33mbold yellow$reset"
7 echo -e "\033[34mblue\t\033[1;34mbold blue$reset"
8 echo -e "\033[35mmagenta\t\033[1;35mbold magenta$reset"
9 echo -e "\033[36mcyan\t\033[1;36mbold cyan$reset"
10 echo -e "\033[37mwhite\t\033[1;37mbold white$reset"
デュアルディスプレイ
ノートPCをプロジェクタ等に接続して外部出力する際の設定を行うスクリプト。
1 #!/bin/sh
2 # vgaout.sh [l|r|a|b] on|off
3
4 # monitor on the laptop
5 LCD=LVDS1
6 # external monitor
7 VGA=VGA1
8
9 orientation='--below'
10 if [ $# -gt 1 ]; then
11 case $1 in
12 l)
13 orientation='--left-of'
14 ;;
15 r)
16 orientation='--right-of'
17 ;;
18 a)
19 orientation='--above'
20 ;;
21 b|*)
22 orientation='--below'
23 ;;
24 esac
25 op=$2
26 else
27 op=$1
28 fi
29
30 case $op in
31 on)
32 echo "$VGA: on($(echo $orientation | tr - \ | sed 's/^ \(.*\)/\1/') $LCD)"
33 xrandr --output $VGA --auto $orientation $LCD
34 ;;
35 off)
36 echo $VGA: off
37 xrandr --output $VGA --off
38 ;;
39 *)
40 echo unknown option
41 exit 1
42 ;;
43 esac