Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Maxime Bombar
Config_Files
Commits
393d2bf9
Commit
393d2bf9
authored
Aug 30, 2020
by
Maxime Bombar
Browse files
Improve swapping of workspaces
parent
ef49afd5
Changes
2
Hide whitespace changes
Inline
Side-by-side
.config/i3/bin/slide_workspace_left.sh
View file @
393d2bf9
#!/bin/sh
# Slide current workspace to the
lef
t on i3-bar
# Slide current workspace to the
righ
t on i3-bar
nam
e
=
$(
i3-msg
-t
get_outputs | jq |
grep
'current_workspace'
|
awk
'{split($0,a,": "); print a[2]}'
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
1 |
head
-n
1
)
number
=
$(
i3-msg
-t
get_
output
s | jq |
grep
'current_workspace'
|
awk
'{split($0,a,": "); print a[2]}'
|
cut
-d
:
-f
1 |
cut
-d
\"
-f
2 |
head
-n
1
)
curworkspac
e
=
$(
i3-msg
-t
get_outputs | jq |
grep
'current_workspace'
|
awk
'{split($0,a,": "); print a[2]}'
|
head
-n
1
)
prevworkspace
=
$(
i3-msg
-t
get_
workspace
s | jq |
grep
name |
grep
$curworkspace
-C
1 |
cut
-d
,
-f
1
|
awk
'{split($0,a,": "); print a[2]}'
|
head
-n
1
)
if
[
-z
$number
]
;
then
number
=
-1
;
fi
# current workspace
curnumber
=
$(
echo
$curworkspace
|
cut
-d
:
-f
1 |
cut
-d
\"
-f
2
)
;
curname
=
$(
echo
$curworkspace
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
1
)
;
i3-msg rename workspace to
"
$(
expr
$number
- 1
)
:
$name
"
# prev workspace
prevnumber
=
$(
echo
$prevworkspace
|
cut
-d
:
-f
1 |
cut
-d
\"
-f
2
)
;
prevname
=
$(
echo
$prevworkspace
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
1
)
;
# swap workspaces
i3-msg rename workspace
$prevworkspace
to
$curnumber
:
$prevname
;
i3-msg rename workspace
$curworkspace
to
$prevnumber
:
$curname
;
.config/i3/bin/slide_workspace_right.sh
View file @
393d2bf9
...
...
@@ -3,9 +3,17 @@
# Slide current workspace to the right on i3-bar
nam
e
=
$(
i3-msg
-t
get_outputs | jq |
grep
'current_workspace'
|
awk
'{split($0,a,": "); print a[2]}'
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
1 |
head
-n
1
)
n
umber
=
$(
i3-msg
-t
get_
output
s | jq |
grep
'current_workspace'
|
awk
'{split($0,a,": "); print a[2]}'
|
cut
-d
:
-f
1 |
cut
-d
\"
-f
2 |
head
-n
1
)
curworkspac
e
=
$(
i3-msg
-t
get_outputs | jq |
grep
'current_workspace'
|
awk
'{split($0,a,": "); print a[2]}'
|
head
-n
1
)
n
extworkspace
=
$(
i3-msg
-t
get_
workspace
s | jq |
grep
name |
grep
$curworkspace
-C
1 |
cut
-d
,
-f
1
|
awk
'{split($0,a,": "); print a[2]}'
|
tail
-n
1
)
if
[
-z
$number
]
;
then
number
=
-1
;
fi
# current workspace
curnumber
=
$(
echo
$curworkspace
|
cut
-d
:
-f
1 |
cut
-d
\"
-f
2
)
;
curname
=
$(
echo
$curworkspace
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
1
)
;
i3-msg rename workspace to
"
$(
expr
$number
+ 1
)
:
$name
"
# next workspace
nextnumber
=
$(
echo
$nextworkspace
|
cut
-d
:
-f
1 |
cut
-d
\"
-f
2
)
;
nextname
=
$(
echo
$nextworkspace
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
1
)
;
# swap workspaces
i3-msg rename workspace
$nextworkspace
to
$curnumber
:
$nextname
;
i3-msg rename workspace
$curworkspace
to
$nextnumber
:
$curname
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment