Last active
May 26, 2022 14:24
-
-
Save ericbrandwein/a8be732d6498ca1298ad2ded8ddaaa88 to your computer and use it in GitHub Desktop.
Hide or show titles in i3wm windows depending on if the Workspace has more than one window. Requires [i3ipc-python](https://github.com/acrisci/i3ipc-python) to be installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import i3ipc | |
# Create the Connection object that can be used to send commands and subscribe | |
# to events. | |
i3 = i3ipc.Connection() | |
def change_titles(windows): | |
if len(windows) > 1: | |
command = 'border normal' | |
else: | |
command = 'border pixel 1' | |
for window in windows: | |
window.command(command) | |
def on_window(self, e): | |
focused = i3.get_tree().find_focused() | |
change_titles(focused.workspace().leaves()) | |
# Subscribe to events | |
i3.on('window', on_window) | |
# Start the main loop and wait for events to come in. | |
i3.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should add this to your
~/.i3/config
so that it is executed always at startup by addingexec --no-startup-id /path/to/i3-smarttitles.py