Created
          January 2, 2018 15:22 
        
      - 
      
- 
        Save Yepoleb/3e56c9936cc1fdc46d6cd007d5f0db28 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 collections | |
| import Xlib | |
| import Xlib.display | |
| Hints = collections.namedtuple("Hints", ["flags", "functions", "decorations", "inputMode", "status"]) | |
| MWM_HINTS_DECORATIONS = (1 << 1) | |
| MWM_DECOR_ALL = (1 << 0) | |
| display = Xlib.display.Display() | |
| root = display.screen().root | |
| NET_ACTIVE_WINDOW = display.intern_atom("_NET_ACTIVE_WINDOW") | |
| MOTIF_WM_HINTS = display.intern_atom("_MOTIF_WM_HINTS") | |
| active_id = root.get_full_property(NET_ACTIVE_WINDOW, Xlib.X.AnyPropertyType).value[0] | |
| window = display.create_resource_object("window", active_id) | |
| wm_hints_data = window.get_full_property(MOTIF_WM_HINTS, Xlib.X.AnyPropertyType) | |
| if wm_hints_data is not None: | |
| wm_hints = Hints._make(wm_hints_data.value) | |
| else: | |
| wm_hints = Hints(MWM_HINTS_DECORATIONS, 0, MWM_DECOR_ALL, 0, 0) | |
| print(wm_hints) | |
| wm_hints = wm_hints._replace(flags=wm_hints.flags | MWM_HINTS_DECORATIONS) | |
| if wm_hints.decorations != 0: | |
| wm_hints = wm_hints._replace(decorations=0) | |
| else: | |
| wm_hints = wm_hints._replace(decorations=MWM_DECOR_ALL) | |
| window.change_property(MOTIF_WM_HINTS, MOTIF_WM_HINTS, 32, list(wm_hints)) | |
| display.flush() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment