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
3885d4d1
Commit
3885d4d1
authored
Aug 30, 2020
by
Maxime Bombar
Browse files
Move new workspace script to python
parent
324ed679
Changes
4
Hide whitespace changes
Inline
Side-by-side
.config/i3/bin/new_workspace
0 → 100755
View file @
3885d4d1
#!/bin/bash
# Create a new workspace
if
[
!
-d
~/.config/i3/venv
]
;
then
python3
-m
virtualenv ~/.config/i3/venv
;
pip3
install
-m
~/.config/i3/requirements.txt
;
fi
source
~/.config/i3/venv/bin/activate
&&
python3 ~/.config/i3/bin/new_workspace.py
$@
.config/i3/bin/new_workspace.py
0 → 100755
View file @
3885d4d1
#!/usr/bin/python3
# Create a new workspace with the lowest available number
import
i3ipc
def
main
():
i3
=
i3ipc
.
Connection
()
workspaces
=
i3
.
get_workspaces
()
all_numbers
=
sorted
(
list
(
map
(
lambda
w
:
w
.
num
,
workspaces
)))
new
=
all_numbers
[
0
]
i
=
0
while
new
==
all_numbers
[
i
]:
new
+=
1
i
+=
1
i3
.
command
(
f
"workspace
{
new
}
"
)
if
__name__
==
'__main__'
:
main
()
.config/i3/bin/new_workspace.sh
deleted
100755 → 0
View file @
324ed679
#!/bin/sh
# Create a new workspace
i3-msg workspace
$((
$(
i3-msg
-t
get_workspaces |
tr
,
'\n'
|
grep
'"num":'
|
cut
-d
:
-f
2 |
sort
-rn
|
head
-1
)
+
1
))
.config/i3/config
View file @
3885d4d1
...
...
@@ -147,8 +147,8 @@ bindsym $mod+space focus mode_toggle
#####################
# Create a new workspace on current output
bindsym $mod+Shift+n exec --no-startup-id ~/.config/i3/bin/new_workspace
.sh
bindsym Control+$alt+n exec --no-startup-id ~/.config/i3/bin/new_workspace
.sh
bindsym $mod+Shift+n exec --no-startup-id ~/.config/i3/bin/new_workspace
bindsym Control+$alt+n exec --no-startup-id ~/.config/i3/bin/new_workspace
# Move current workspace to the right
bindsym $alt+Shift+Right exec --no-startup-id ~/.config/i3/bin/slide_workspace_right.sh
...
...
Write
Preview
Markdown
is supported
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