Skip to content

Commit a1d54c8

Browse files
authored
Merge pull request #179 from budlabs/next
2021.06.04
2 parents 07882d4 + 87bb309 commit a1d54c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+139
-1076
lines changed

README.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ $ make
2323

2424
#### runtime dependencies
2525
[bash], [i3wm], [xdotool], [Gawk]
26-
[rofi] (*only used by [i3menu]*)
2726

2827
### changelog
2928

@@ -44,25 +43,18 @@ of most of **i3ass**.
4443

4544
script | description
4645
|:-|:-|
46+
[i3Kornhe] | move and resize windows gracefully
4747
[i3flip] | Tabswitching done right
4848
[i3fyra] | An advanced, simple grid-based tiling layout
4949
[i3get] | prints info about a specific window to stdout
5050
[i3gw] | a ghost window wrapper for i3wm
5151
[i3king] | window ruler
52-
[i3Kornhe] | move and resize windows gracefully
5352
[i3list] | list information about the current i3 session
54-
[i3menu] | Adds more features to rofi when used in i3wm
5553
[i3run] | Run, Raise or hide windows in i3wm
5654
[i3var] | get or get a i3 variable
5755
[i3viswiz] | professional window focus for i3wm
5856
[i3zen] | zentered container, full focus
5957

60-
### known issues
61-
62-
#### **NO SUPPORT FOR i3-gaps**
63-
Some **i3ass** scripts does not work with i3-gaps,
64-
that is the reason `i3-gaps` is listed as a conflict
65-
in the PKGBUILD on [AUR].
6658

6759
### license
6860

docs/readme_install.md

-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ $ make
1818

1919
#### runtime dependencies
2020
[bash], [i3wm], [xdotool], [Gawk]
21-
[rofi] (*only used by [i3menu]*)

docs/readme_issues.md

-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11

2-
### known issues
3-
4-
#### **NO SUPPORT FOR i3-gaps**
5-
Some **i3ass** scripts does not work with i3-gaps,
6-
that is the reason `i3-gaps` is listed as a conflict
7-
in the PKGBUILD on [AUR].

docs/releasenotes/0next.md

+4-22
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
#### i3ass
2-
3-
Fixed an issue in `share/main.awk` . Titles containing
4-
a colon (`:`) character where not being captured by
5-
f.i. `i3get -r o`. #174 thanks @DominikMarcinowski
6-
7-
#### i3run
8-
9-
Added `--silent` option
10-
11-
#### i3king
12-
13-
fixed issue where commented lines ending with backslash
14-
concatenated the next line.
15-
16-
added support for `$ROLE and $TYPE` variables in config.
17-
18-
#### i3get
19-
20-
added `--timeout SECONDS` option. To adjust the timeout
21-
before `--synk` stops waiting for a window (default 60s)
22-
1+
#### i3menu
232

3+
has been rewritten to use a custom dmenu fork instead
4+
of rofi. i3menu is no longer part of i3ass repository
5+
and now lives in it's own repo.

docs/releasenotes/2022.07.21.1.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#### i3king
2+
3+
**TITLE** new rule type
4+
5+
Triggers on new windows and title change.
6+
Always execute `title_format NEW_TITLE`
7+
8+
Instead of command /REGEX/ TEMPLATE is assumed
9+
TEMPLATE can use `$1,$2,$3...` to access capture groups
10+
from the REGEX.'
11+
12+
13+
14+
15+
16+
17+
18+
19+
#### i3ass
20+
21+
Fixed an issue in `share/main.awk` . Titles containing
22+
a colon (`:`) character where not being captured by
23+
f.i. `i3get -r o`. #174 thanks @DominikMarcinowski
24+
25+
#### i3run
26+
27+
Added `--silent` option
28+
29+
#### i3king
30+
31+
fixed issue where commented lines ending with backslash
32+
concatenated the next line.
33+
34+
added support for `$ROLE and $TYPE` variables in config.
35+
36+
#### i3get
37+
38+
added `--timeout SECONDS` option. To adjust the timeout
39+
before `--synk` stops waiting for a window (default 60s)
40+
41+

src/i3Kornhe/i3Kornhe

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ main(){
4848

4949
[[ -p $I3_KORNHE_FIFO_FILE ]] && {
5050
echo "$_direction $_next_mode $_speed $_margin" >> "$I3_KORNHE_FIFO_FILE" &
51-
((_o[verbose] && ! _o[dryrun])) && timer_stop
51+
# ((_o[verbose] && ! _o[dryrun])) && timer_stop
5252
exit
5353
}
5454

src/i3king/config.mak

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
NAME := i3king
2-
VERSION := 0.33
2+
VERSION := 0.4
33
CREATED := 2021-06-01
4-
UPDATED := 2022-05-21
4+
UPDATED := 2022-07-26
55
AUTHOR := budRich
66
CONTACT := https://github.com/budlabs/i3ass
77
USAGE := i3king [OPTIONS]

src/i3king/docs/description.md

+40
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,46 @@ Some built in magic variables are avaible in the config:
3434
- $WINID
3535
- $TITLE
3636

37+
**TITLE** is a rule type that works slightly different
38+
than the others. If triggered it will always execute
39+
the command `title_format NEW_TITLE`. And triggers
40+
on new windows and when a window title changes.
41+
42+
Instead of a command you specify: `[option]/REGEX/ template`
43+
Use `$1,$2,$3...` in the template to expand them to
44+
the corresponding capture group from the regex.
45+
46+
`[option]` is optional and can be either:
47+
- `~0` remove expanded $HOME/ from NEW_TITLE
48+
*if this results in empty NEW_TITLE, a single `~` will be used*
49+
- `~1` replace expanded $HOME with `~`
50+
51+
EXAMPLE
52+
-------
53+
```
54+
# assuming the window class is "Thunar" and the window
55+
# title is something like "/home/anon/.config/i3 - Thunar"
56+
57+
TITLE class=Thunar
58+
/^(.+)\s-\s(Thunar)$/ Filemanager: $2 - $1
59+
60+
# the above will result in NEW_TITLE:
61+
# Filemanager: Thunar - /home/anon/.config/i3
62+
63+
TITLE class=Thunar
64+
~0/^(.+)\s-\s(Thunar)$/ $1
65+
66+
# the above will result in NEW_TITLE:
67+
# .config/i3
68+
69+
TITLE class=Thunar
70+
~1/^(.+)\s-\s(Thunar)$/ $1
71+
72+
# the above will result in NEW_TITLE:
73+
# ~/.config/i3
74+
75+
```
76+
3777
EXAMPLE
3878
-------
3979

src/i3king/func/make_regex.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local re
66

77
re+=$(cat << EOB
88
(\{)
9-
"change":"(new|close)",
9+
"change":"(new|close|title)",
1010
"container":[{]
1111
"id":([0-9]+),
1212
"type":"[^"]+",

src/i3king/func/match_window.sh

+45-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ match_window() {
66
local type=$5 role=$6 wid=$7 change=$8
77

88
local last_cmd cmd rule
9+
local title_regex title_options new_title
910

1011
local identifier=""
1112

@@ -20,7 +21,8 @@ match_window() {
2021
[[ $cid =~ ^[0-9]{5,}$ ]] \
2122
|| ERX "match_window(): $cid is not a valid containerID"
2223

23-
if [[ $change = close ]]; then
24+
case "$change" in
25+
close )
2426
for rule in "${!close_rules[@]}"; do
2527
[[ $identifier =~ ${close_rules[$rule]} ]] || continue
2628
cmd=${commands[$rule]}
@@ -30,7 +32,8 @@ match_window() {
3032
execute+=("$cmd")
3133
matches+=("ON_CLOSE: ${close_rules[$rule]}"$'\n'$'\t'"$cmd")
3234
done
33-
else
35+
;;
36+
new )
3437
# test default rules first
3538
for rule in "${!default_rules[@]}"; do
3639

@@ -92,7 +95,46 @@ match_window() {
9295
execute+=("$cmd")
9396
matches+=("NORMAL: $rule_out"$'\n'$'\t'"$cmd")
9497
done
95-
fi
98+
;& # FALLTHRU !!!!
99+
100+
title) # apply both to new windows and titlechange
101+
for rule in "${!title_rules[@]}"; do
102+
[[ $identifier =~ ${title_rules[$rule]} ]] || continue
103+
cmd=${commands[$rule]}
104+
cmd=${cmd//\\\//@@SLASH@@}
105+
[[ $cmd =~ ^([^/]+)?/([^/]+)/[[:space:]]+(.+)$ ]] && {
106+
title_regex=${BASH_REMATCH[2]//@@SLASH@@//}
107+
new_title=${BASH_REMATCH[3]}
108+
title_options=${BASH_REMATCH[1]}
109+
110+
[[ $title =~ ${title_regex} ]] && {
111+
for rematch in "${!BASH_REMATCH[@]}"; do
112+
((rematch)) || continue
113+
new_title="${new_title//\$$rematch/${BASH_REMATCH[rematch]}}"
114+
done
115+
}
116+
117+
case "$title_options" in
118+
"~0" )
119+
[[ $new_title =~ ("${HOME}"[/]?) ]] && {
120+
new_title=${new_title//${BASH_REMATCH[1]}/}
121+
[[ $new_title ]] || new_title="~"
122+
}
123+
;;
124+
125+
"~1" )
126+
[[ $new_title =~ ("${HOME}") ]] \
127+
&& new_title=${new_title//${BASH_REMATCH[1]}/'~'}
128+
;;
129+
esac
130+
}
131+
132+
execute+=("title_format $new_title")
133+
matches+=("TITLE: $title")
134+
matches+=("REGEX: $cmd")
135+
done
136+
;;
137+
esac
96138

97139
[[ -a $_file_log && ${#matches[@]} -gt 0 ]] && {
98140
echo $'\n'"WINDOW: "\

src/i3king/func/parse_rules.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parse_rules() {
77

88
re_set='^\s*set\s+[$](\S+)\s+(.+)$'
99
re_group='(\s*([^=[:space:]]+)=([^=]+\S)\s*)$'
10-
re_rule='^(GLOBAL|DEFAULT|ON_CLOSE)?((\s+)?(.+)\s*)?$'
10+
re_rule='^(GLOBAL|DEFAULT|ON_CLOSE|TITLE)?((\s+)?(.+)\s*)?$'
1111

1212
declare -i counter_criteria counter_commands
1313

@@ -41,7 +41,7 @@ parse_rules() {
4141
done
4242

4343
elif [[ $line =~ $re_rule ]]; then
44-
# re_rules=^(GLOBAL|DEFAULT|ON_CLOSE)?((\s+)?(.+)\s*)?$
44+
# re_rules=^(GLOBAL|DEFAULT|ON_CLOSE|TITLE)?((\s+)?(.+)\s*)?$
4545
rule_type=${BASH_REMATCH[1]:-NORMAL}
4646

4747
[[ $rule_type = ON_CLOSE && ! ${BASH_REMATCH[4]} ]] \
@@ -98,6 +98,7 @@ parse_rules() {
9898
DEFAULT ) default_rules[counter_criteria++]=$rule ;;
9999
GLOBAL ) global_rules[counter_criteria++]=$rule ;;
100100
ON_CLOSE ) close_rules[counter_criteria++]=$rule ;;
101+
TITLE ) title_rules[counter_criteria++]=$rule ;;
101102
* ) rules[counter_criteria++]=$rule ;;
102103
esac
103104

src/i3king/i3king

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ main(){
1212
declare -ag global_rules
1313
declare -ag default_rules
1414
declare -ag close_rules
15+
declare -ag title_rules
1516
declare -ag rules
1617
declare -ag commands
1718
declare -g _fs=$'\x1f' # field separator, US

src/i3menu/GNUmakefile

-1
This file was deleted.

src/i3menu/conf/base/i3menu.rasi

-55
This file was deleted.

src/i3menu/conf/base/themevars.rasi

-32
This file was deleted.

0 commit comments

Comments
 (0)