Use primary/nonprimary for workspace display bindings instead of script
This commit is contained in:
parent
fdfd0c045f
commit
27abcfed0c
@ -8,9 +8,6 @@ set $config_dir ~/.config/i3
|
||||
|
||||
include include/`hostname`.conf
|
||||
|
||||
exec_always $config_dir/monitor_workspaces.py
|
||||
include include/dynamic.conf
|
||||
|
||||
## Startup Applications ##
|
||||
exec --no-startup-id ~/.fehbg
|
||||
exec --no-startup-id xfce4-panel -d
|
||||
@ -211,6 +208,29 @@ bindsym --whole-window $mod+Shift+button1 mark --add quickswap; mode "swap-dest"
|
||||
bindsym $mod+Mod1+comma mark --add quickswap
|
||||
bindsym $mod+comma swap container with mark quickswap; [con_mark="quickswap"] focus; unmark quickswap
|
||||
|
||||
# bind workspaces 1-10 to primary monitor, 11-20 to nonprimary monitor
|
||||
workspace 1 output primary
|
||||
workspace 2 output primary
|
||||
workspace 3 output primary
|
||||
workspace 4 output primary
|
||||
workspace 5 output primary
|
||||
workspace 6 output primary
|
||||
workspace 7 output primary
|
||||
workspace 8 output primary
|
||||
workspace 9 output primary
|
||||
workspace 10 output primary
|
||||
|
||||
workspace 11 output nonprimary
|
||||
workspace 12 output nonprimary
|
||||
workspace 13 output nonprimary
|
||||
workspace 14 output nonprimary
|
||||
workspace 15 output nonprimary
|
||||
workspace 16 output nonprimary
|
||||
workspace 17 output nonprimary
|
||||
workspace 18 output nonprimary
|
||||
workspace 19 output nonprimary
|
||||
workspace 20 output nonprimary
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
|
@ -1,71 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import i3ipc
|
||||
|
||||
import Xlib.display
|
||||
from Xlib.ext import randr
|
||||
|
||||
i3 = i3ipc.Connection()
|
||||
|
||||
|
||||
def iter_outputs():
|
||||
display = Xlib.display.Display()
|
||||
screen_root = display.screen().root
|
||||
res = randr.get_screen_resources(screen_root)
|
||||
primary_display_id = screen_root.xrandr_get_output_primary().output
|
||||
|
||||
for output in sorted(res.outputs, key=lambda o: o != primary_display_id):
|
||||
params = display.xrandr_get_output_info(output, res.config_timestamp)
|
||||
if not params.crtc: # skip inactive
|
||||
continue
|
||||
yield params.name, output == primary_display_id
|
||||
|
||||
|
||||
def workspaces_for_output(name, primary):
|
||||
if primary:
|
||||
yield "# Primary Monitor"
|
||||
workspaces = range(1, 11)
|
||||
else:
|
||||
yield "# Secondary Monitor"
|
||||
workspaces = range(11, 21)
|
||||
|
||||
for workspace in workspaces:
|
||||
yield f"workspace {workspace} output {name}"
|
||||
|
||||
|
||||
with open(Path(__file__).parent / "include/dynamic.conf", "w") as f:
|
||||
f.write(
|
||||
"\n\n".join(
|
||||
"\n".join(workspaces_for_output(output, primary))
|
||||
for output, primary in iter_outputs()
|
||||
)
|
||||
)
|
||||
f.write("\n")
|
||||
|
||||
|
||||
# outputs = i3.get_outputs()
|
||||
|
||||
|
||||
# def workspaces_for_output(output: i3ipc.OutputReply):
|
||||
# if output.primary:
|
||||
# yield "# Primary Monitor"
|
||||
# workspaces = range(1, 11)
|
||||
# else:
|
||||
# yield "# Secondary Monitor"
|
||||
# workspaces = range(11, 21)
|
||||
|
||||
# for workspace in workspaces:
|
||||
# yield f"workspace {workspace} output {output.name}"
|
||||
|
||||
|
||||
# with open(Path(__file__).parent / "include/dynamic.conf", "w") as f:
|
||||
# f.write(
|
||||
# "\n\n".join(
|
||||
# "\n".join(workspaces_for_output(output))
|
||||
# for output in sorted(outputs, key=lambda o: o.primary, reverse=True)
|
||||
# if output.active
|
||||
# )
|
||||
# )
|
||||
# f.write("\n")
|
Loading…
Reference in New Issue
Block a user