Created
April 9, 2020 05:20
-
-
Save aeghn/aae4225e07224aa667ea9c604afbba83 to your computer and use it in GitHub Desktop.
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 python3 | |
import i3ipc | |
import os | |
i3 = i3ipc.Connection() | |
focused = i3.get_tree().find_focused() | |
window_title = focused.window_title | |
window_class = focused.window_class | |
floating = focused.floating | |
i3_config_file = open(os.path.expanduser('~/.config/i3/config'),"a+") | |
if floating == "user_on": | |
window_rect = focused.window_rect | |
height = window_rect.height | |
width = window_rect.width | |
window_role = "\nfor_window [ title=\"^" + window_title + "$\" class=\"" + window_class +"\"] floating enable resize set " + str(width) + " " + str(height) | |
i3_config_file.write(window_role) | |
elif floating == "auto_off": | |
window_role = "\nfor_window [ title=\"^" + window_title + "$\" class=\"" + window_class +"\"] floating enable" | |
i3_config_file.write(window_role) | |
else: | |
print(floating) | |
i3_config_file.close() | |
focused.command("floating enable") | |
i3.command("reload") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment