i3_selectwindow.sh: full change of script
README.md: init .gitignore: init i3_selectwindow.config_sample: init
This commit is contained in:
parent
8b5ebb37d5
commit
f328341d94
|
@ -0,0 +1,7 @@
|
|||
*~
|
||||
.*.sw?
|
||||
.sw?
|
||||
\#*\#
|
||||
DEADJOE
|
||||
|
||||
/i3_selectwindow.config
|
|
@ -0,0 +1,40 @@
|
|||
# i3_selectwindow.sh
|
||||
Allows the user to jump directly to a window even if its on a different workspace or physical screen with a sample keybinding in the .i3/config
|
||||
|
||||
For example:
|
||||
bindsym Mod1+Tab exec '/home/myuser/git/i3_selectwindow/i3_selectwindow.sh'
|
||||
|
||||
## Reqirements
|
||||
It uses [sed](https://www.gnu.org/software/sed/), [grep](http://www.gnu.org/software/grep/), [i3-msg](https://i3wm.org/), [jq](https://github.com/stedolan/jq), [dmenu](https://i3wm.org/) and [bashisms](https://en.wikipedia.org/wiki/Bashism). So please make sure that you have them installed. For example with [apt](https://wiki.debian.org/Apt) for [debian](https://www.debian.org/)
|
||||
|
||||
## Configuration
|
||||
The colours of the dmenu can be configured in the file i3_selectwindow.config and its the only purpose of that file.
|
||||
It is stored in the same directory as the script is. You can also rename the i3_selectwindow.config_sample to i3_selectwindow.config and perform an your color changes.
|
||||
This one is excluded from git that you do not get anoyed by changes in there.
|
||||
```sh
|
||||
cat i3_selectwindow.config_sample
|
||||
dmsb="#1C1C1C"
|
||||
dmsf="#000000"
|
||||
dmnb="#000000"
|
||||
dmnf="#FBFBFB"
|
||||
```
|
||||
|
||||
## Usage
|
||||
As its triggered by a keybinding you dont need to run it from the termianl.
|
||||
But if yes, just run the script, there are no parameters and you will get only one output if you select something:
|
||||
```bash
|
||||
./i3_selectwindow.sh
|
||||
[{"success":true}]
|
||||
```
|
||||
|
||||
## .gitignore
|
||||
```bash
|
||||
cat .gitignore
|
||||
*~
|
||||
.*.sw?
|
||||
.sw?
|
||||
\#*\#
|
||||
DEADJOE
|
||||
|
||||
/i3_selectwindow.config
|
||||
```
|
|
@ -0,0 +1,4 @@
|
|||
dmsb="#1C1C1C"
|
||||
dmsf="#000000"
|
||||
dmnb="#000000"
|
||||
dmnf="#FBFBFB"
|
|
@ -1,11 +1,22 @@
|
|||
#!/bin/bash
|
||||
#wmclass=$(i3-msg -t get_tree | jq -r '.' | grep class | grep -v i3bar | sed -e 's/ *//g;s/"class"://g;s/^"//g;s/",$//g' | awk '{print NR, $0}')
|
||||
shopt -s nullglob globstar
|
||||
sctpa="$(dirname ${0})"
|
||||
confpa="${sctpa}/i3_selectwindow.config"
|
||||
|
||||
#wmtittle=$(i3-msg -t get_tree | jq -r '.' | grep title | grep -v i3bar | sed -e 's/ *//g;s/"title"://g;s/^"//g;s/",$//g' | awk '{print NR, $0}' | dmenu -l 4)
|
||||
dmsb="#005577"
|
||||
dmsf="#eeeeee"
|
||||
dmnb="#222222"
|
||||
dmnf="#bbbbbb"
|
||||
|
||||
#wmNR=$(echo ${wmtittle} | awk '{print $1}')
|
||||
#wmclass=$(i3-msg -t get_tree | jq -r '.' | grep class | grep -v i3bar | sed -e 's/ *//g;s/"class"://g;s/^"//g;s/",$//g' | awk '{print NR, $0}' | grep -E "^${wmNR} "| sed -e "s/^${wmNR} //g")
|
||||
#wmtittle=$(echo "${wmtittle}" | sed -e "s/^${wmNR} //g")
|
||||
if [ -f "${confpa}" ]; then
|
||||
source "${confpa}"
|
||||
fi
|
||||
|
||||
typeit=0
|
||||
if [[ $1 == "--type" ]]; then
|
||||
typeit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
tmpid=""
|
||||
tmpclass=""
|
||||
|
@ -20,6 +31,10 @@ do
|
|||
if ! [ -z "$(echo ${line} | grep -v i3bar | grep -E \"class\")" ]
|
||||
then
|
||||
tmpclass=$(echo ${line} | grep -E "class" | sed -e 's/ *//g;s/"class"://g;s/^"//g;s/",$//g')
|
||||
if [ "${tmpclass}" == "Firefox-esr" ]
|
||||
then
|
||||
line="\"title\":firefox"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [ -z "$(echo ${line} | grep -v i3bar | grep -E \"title\")" ]
|
||||
|
@ -28,6 +43,8 @@ do
|
|||
echo "$tmptitle $tmpclass $tmpid"
|
||||
fi
|
||||
|
||||
done<<<$(i3-msg -t get_tree | jq -r '.' | grep -B1 "type.*con" -A41 | grep -E "id...[0-9]+|class|title") | dmenu -l 4)
|
||||
done<<<$(i3-msg -t get_tree | jq -r '.' | grep -B1 "type.*con" -A41 | grep -E "id...[0-9]+|class|title") | dmenu -l 4 -i -sb "$dmsb" -sf "$dmsf" -nb "$dmnb" -nf "$dmnf")
|
||||
|
||||
[ -z "${choice}" ] && exit
|
||||
|
||||
i3-msg "[con_id="$(echo $choice | awk '{print $3}')"]" focus
|
||||
|
|
Loading…
Reference in New Issue