From 7264c2ead536e19b7dc8b5575cbbce74a31fb69f Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 3 Aug 2021 16:00:28 +0200 Subject: [PATCH] i3-companion: partially revert layout indicator Ideally, it should be per output, but then it is a bit complicated to know which polybar is on which output. While this seems a cool hack to have, I don't think that's really useful. Keeping some of the (unrelated) changes. --- bin/i3-companion | 21 ++------------------- config | 4 ++-- dotfiles/polybar.conf | 8 +------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/bin/i3-companion b/bin/i3-companion index 7589fae..8df6b70 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -80,10 +80,6 @@ icons = { "headset": icon(2, ""), "keyboard": icon(2, "⌨"), "laptop": icon(2, "💻"), - "layout-splith": icon(2, ""), - "layout-splitv": icon(2, ""), - "layout-stacking": icon(2, ""), - "layout-tabbed": icon(2, ""), "loudspeaker": icon(2, ""), "microphone": icon(2, ""), "mouse": icon(2, ""), @@ -239,7 +235,7 @@ def debounce(sleep, *, unless=None): return decorator -def polybar(module, silent=False): +def polybar(module): """Use returned string to update polybar module""" def decorator(fn): @@ -263,8 +259,7 @@ def polybar(module, silent=False): if e.errno != errno.ENXIO: raise - log = logger.debug if silent else logger.info - log("polybar/%s: content updated", module) + logger.info(f"polybar/{module}: content updated") cache[module] = content return content @@ -592,18 +587,6 @@ async def workspace_info(i3, event): workspace_info.last_id = result[0] -@on(I3Event.WINDOW_FOCUS, CommandEvent("layout-changed"), StartEvent) -@polybar("i3layout", silent=True) -async def layout_update(i3, event): - """Display layout of the current focused container.""" - tree = await i3.get_tree() - focused = tree.find_focused() - if not focused: - return "" - layout = focused.parent.layout - return icons.get(f"layout-{layout}", icons['unknown']) - - @on(I3Event.OUTPUT, StartEvent) @static(last_setup=None) @debounce(2) diff --git a/config b/config index 5cc0358..b59a24d 100644 --- a/config +++ b/config @@ -73,8 +73,8 @@ bindsym $mod+f fullscreen toggle bindsym $mod+Shift+f fullscreen toggle global # change container layout (tabbed, toggle split) -bindsym $mod+w layout toggle splitv splith tabbed; nop "layout-changed" -bindsym $mod+v split toggle; nop "layout-changed" +bindsym $mod+w layout toggle splitv splith tabbed +bindsym $mod+v split toggle # toggle tiling / floating bindsym $mod+Shift+space floating toggle diff --git a/dotfiles/polybar.conf b/dotfiles/polybar.conf index 916f5b9..f1e7c6c 100644 --- a/dotfiles/polybar.conf +++ b/dotfiles/polybar.conf @@ -30,7 +30,7 @@ font-0 = Iosevka Aile:style=Regular:size=10;2 font-1 = Font Awesome 6 Pro:style=Solid:size=10;2 font-2 = Font Awesome 6 Brands:style=Regular:size=10;2 -modules-left = i3 i3layout +modules-left = i3 modules-center = date [bar/alone] @@ -67,12 +67,6 @@ label-urgent = %name% label-urgent-background = #a00000 label-urgent-padding = 1 -[module/i3layout] -type = custom/ipc -hook-0 = cat $XDG_RUNTIME_DIR/i3/i3layout.txt 2> /dev/null -format-foreground = ${colors.focused} -initial = 1 - # This needs 3.6+ [module/disk] type = internal/fs