Skip to content

Commit

Permalink
Added option to toggle window decorations. Removed some redundant flo…
Browse files Browse the repository at this point in the history
…ating window code
  • Loading branch information
hmusta committed Mar 3, 2014
1 parent 6909c5e commit bf87bcf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions config.py
Expand Up @@ -16,6 +16,9 @@
# Whether new windows should tile or float by default (default is False)
floats_default = False

# Whether tiled windows should have their decorations removed
remove_decorations = False

# How much to increment the master area proportion size
proportion_change = 0.05

Expand Down
5 changes: 3 additions & 2 deletions pt3/client.py
Expand Up @@ -5,6 +5,7 @@
import xpybutil
import xpybutil.event as event
import xpybutil.ewmh as ewmh
import xpybutil.motif as motif
import xpybutil.icccm as icccm
import xpybutil.rect as rect
import xpybutil.util as util
Expand Down Expand Up @@ -54,8 +55,6 @@ def __init__(self, wid):
self.save()

def remove(self):
if config.tiles_below and not self.floating:
ewmh.request_wm_state_checked(self.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
tile.update_client_removal(self)
debug('Disconnecting from %s' % self)
event.disconnect('ConfigureNotify', self.parentid)
Expand All @@ -77,6 +76,8 @@ def save(self):

def restore(self):
debug('Restoring %s' % self)
if config.remove_decorations:
motif.set_hints_checked(self.wid,2,decoration=1).check()
if config.tiles_below:
ewmh.request_wm_state_checked(self.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
if self.saved_state:
Expand Down
1 change: 0 additions & 1 deletion pt3/layouts/layout_vert_horz.py
Expand Up @@ -122,7 +122,6 @@ def focus_master(self):
def toggle_float(self):
assert self.tiling

self._get_focused().floating = not self._get_focused().floating
self.store.toggle_float(self._get_focused())
self.tile()

Expand Down
10 changes: 8 additions & 2 deletions pt3/layouts/store.py
@@ -1,6 +1,7 @@
import pt3.config as config
import xpybutil.ewmh as ewmh
import xpybutil.util as util
import xpybutil.motif as motif

class Store(object):
def __init__(self):
Expand All @@ -9,8 +10,14 @@ def __init__(self):

def add(self, c, above=None):
if c.floating:
if config.remove_decorations:
motif.set_hints_checked(c.wid,2,decoration=1).check() # add decorations
if config.tiles_below:
ewmh.request_wm_state_checked(c.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
self.floats.append(c)
else:
if config.remove_decorations:
motif.set_hints_checked(c.wid,2,decoration=2).check() #remove decorations
if config.tiles_below:
ewmh.request_wm_state_checked(c.wid,1,util.get_atom('_NET_WM_STATE_BELOW')).check()
if len(self.masters) < self.mcnt:
Expand All @@ -24,8 +31,6 @@ def remove(self, c):
if c in self.floats:
self.floats.remove(c)
else:
if config.tiles_below:
ewmh.request_wm_state_checked(c.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
if c in self.masters:
self.masters.remove(c)
if len(self.masters) < self.mcnt and self.slaves:
Expand Down Expand Up @@ -71,6 +76,7 @@ def switch(self, c1, c2):

def toggle_float(self, c):
self.remove(c)
c.floating = not c.floating
self.add(c)

def __len__(self):
Expand Down

0 comments on commit bf87bcf

Please sign in to comment.