aboutsummaryrefslogtreecommitdiff
path: root/sxhkd/terminal_bspwm.py
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2020-12-16 02:12:41 +0100
committerbozo.kopic <bozo@kopic.xyz>2020-12-16 02:12:41 +0100
commit004162c05e42a2f2645ca06702567967b1d88961 (patch)
tree18319b9654b8ec561524a58fed0fd3af7131647e /sxhkd/terminal_bspwm.py
parent2f694c9ab1416de12d6c5da47d384a625662edf1 (diff)
.
Diffstat (limited to 'sxhkd/terminal_bspwm.py')
-rw-r--r--sxhkd/terminal_bspwm.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/sxhkd/terminal_bspwm.py b/sxhkd/terminal_bspwm.py
deleted file mode 100644
index eee7875..0000000
--- a/sxhkd/terminal_bspwm.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import subprocess
-
-
-desktop_name = 'term'
-instance_name = 'tmux_term'
-
-
-def is_term_running():
- p = subprocess.run(['xdo', 'id', '-n', instance_name])
- return p.returncode == 0
-
-
-def run_term():
- subprocess.Popen(['alacritty', '--class', instance_name,
- '-e', 'tmux', 'new-session', '-A', '-s', 'default'])
-
-
-def get_focused_desktop():
- p = subprocess.run(['bspc', 'query', '-D', '--names', '-d', 'focused'],
- capture_output=True,
- check=True)
- return p.stdout.decode('utf-8').strip()
-
-
-def hide_term():
- subprocess.run(['bspc', 'desktop', '-f', 'last.local'], check=True)
-
-
-def show_term():
- subprocess.run(['bspc', 'desktop', 'term', '-m', 'focused'])
- subprocess.run(['bspc', 'desktop', '-f', 'term'], check=True)
-
-
-def main():
- if not is_term_running():
- run_term()
-
- focused_desktop = get_focused_desktop()
- if focused_desktop == desktop_name:
- hide_term()
- else:
- show_term()
-
-
-if __name__ == '__main__':
- main()