From 068f9e013a6470af445bb444a3bc07551f9943fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2EFernando=20S=C3=A1nchez?= Date: Mon, 17 Jun 2013 10:27:17 +0200 Subject: [PATCH] Added i3 scripts --- .gitmodules | 3 +++ dmenu.sh | 27 +++++++++++++++++++++++++++ i3-one-instance | 5 +++++ i3-wm-scripts | 1 + 4 files changed, 36 insertions(+) create mode 100644 .gitmodules create mode 100755 dmenu.sh create mode 100755 i3-one-instance create mode 160000 i3-wm-scripts diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..59ab9a1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "i3-wm-scripts"] + path = i3-wm-scripts + url = git://github.com/yiuin/i3-wm-scripts.git diff --git a/dmenu.sh b/dmenu.sh new file mode 100755 index 0000000..eb61099 --- /dev/null +++ b/dmenu.sh @@ -0,0 +1,27 @@ +#!/bin/sh +#http://unix.stackexchange.com/questions/50539/inconsistent-behaviour-of-wmctrl-i-a-win + +# source dmenu config file if it exists +if [ -f $HOME/.dmenurc ]; then + . $HOME/.dmenurc +else + DMENU='dmenu -i' +fi + +# get list of all windows, and their count +wmctrl_output=$(wmctrl -lx) +win_count=$(echo "$wmctrl_output" | wc -l) +# get rid of the hostname and the number in the 2nd column +hostname=$(uname -n) +win_list=$(echo "$wmctrl_output" | \ + sed -r -e 's/[^@]'$hostname'//' | \ + sed -r -e 's/ [0-9][0-9]? / /') + +# select a window ($target) and extract its id ($target_id) +target=$(echo "$win_list" | $DMENU -l $win_count -p "Switch to: ") +target_id=$(echo "$target" | cut -d' ' -f1) + +# switch to target window +cmd="wmctrl -i -a \"$target_id\"" +eval "$cmd" + diff --git a/i3-one-instance b/i3-one-instance new file mode 100755 index 0000000..0bbca1a --- /dev/null +++ b/i3-one-instance @@ -0,0 +1,5 @@ +#!/bin/sh +python $HOME/.bin/i3-wm-scripts/nextmatch.py $1 +if [ $? -gt 0 ]; then + $* & sleep 0.1 && python $HOME/.bin/i3-wm-scripts/nextmatch.py $1 +fi diff --git a/i3-wm-scripts b/i3-wm-scripts new file mode 160000 index 0000000..4773352 --- /dev/null +++ b/i3-wm-scripts @@ -0,0 +1 @@ +Subproject commit 477335215dd1fff4f23b82afbb92e7ad1bd4552e