Added support for tie-fighter display arrangement

This commit is contained in:
Ezri Brimhall 2024-04-15 17:11:57 -06:00
parent 19181c9f42
commit d1bbc82397
Signed by: ezri
GPG Key ID: 058A78E5680C6F24
9 changed files with 166 additions and 43 deletions

View File

@ -24,7 +24,7 @@
(tycho-leftbar--center)
(tycho-leftbar--right)))
(defwindow rightbar
(defwindow centerbar
:monitor 1
:geometry (geometry :width "100%"
:height "26px"
@ -34,9 +34,24 @@
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(tycho-rightbar--left)
(tycho-rightbar--center)
(tycho-rightbar--right)))
(tycho-centerbar--left)
(tycho-centerbar--center)
(tycho-centerbar--right)))
(defwindow rightbar
:monitor 2
:geometry (geometry :width "100%"
:height "36px"
:anchor "top center")
:exclusive true
:focusable false
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(tycho-rightbar--left)
(tycho-rightbar--center)
(tycho-rightbar--right)))
(defwindow network-status
:monitor 0

View File

@ -72,7 +72,7 @@ class Workspace:
group: [find_workspace(workspace, group) for workspace in workspaces]
for group, workspaces in groups.items()
}
for context, groups in initial.items()
for context, groups in initial["contexts"].items()
}
return result, workspaces

View File

@ -96,10 +96,7 @@
:space-evenly false
:spacing 20
:class "leftbox"
(clock)
(network)
(vpn-network)
(aggietime-shift)))
(system-name)))
(defwidget tycho-leftbar--center []
(box :orientation "h"
@ -107,7 +104,7 @@
:space-evenly false
:spacing 20
:class "centerbox"
(system-name)))
))
(defwidget tycho-leftbar--right []
(box :orientation "h"
@ -118,24 +115,28 @@
(sway-workspace :group "left")
(sway-workspaces :group "left")))
(defwidget tycho-rightbar--left []
(defwidget tycho-centerbar--left []
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 20
:class "leftbox"
(sway-workspaces :group "right")
(sway-workspace :group "right")))
(clock)
(network)
(vpn-network)
(aggietime-shift)
(sway-workspace :group "center")))
(defwidget tycho-rightbar--center []
(defwidget tycho-centerbar--center []
(box :orientation "h"
:halign "end"
:space-evenly false
:spacing 20
:class "centerbox"
(system-name)))
(sway-workspaces :group "center")
))
(defwidget tycho-rightbar--right []
(defwidget tycho-centerbar--right []
(box :orientation "h"
:halign "end"
:space-evenly false
@ -146,4 +147,29 @@
(system-cpu-avg)
(clock)))
(defwidget tycho-rightbar--left []
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 20
:class "leftbox"
(sway-workspaces :group "right")
(sway-workspace :group "right")))
(defwidget tycho-rightbar--center []
(box :orientation "h"
:halign "end"
:space-evenly false
:spacing 20
:class "centerbox"
))
(defwidget tycho-rightbar--right []
(box :orientation "h"
:halign "end"
:space-evenly false
:spacing 20
:class "rightbox"
(system-name)))

View File

@ -2,10 +2,12 @@
# Tycho Station Display Config #
### ###
set $leftdisplay 'Hewlett Packard HP Z24n CN47090537'
set $rightdisplay 'Hewlett Packard HP Z24n CN4709053L'
set $leftdisplay DP-1
set $centerdisplay DP-2
set $rightdisplay DP-3
output {
$leftdisplay pos 0 0 mode 1920x1200
$rightdisplay pos 1920 0 mode 1920x1200
$leftdisplay pos 0 0 mode 1920x1080 transform 270
$centerdisplay pos 1080 384 mode 2560x1440 scale 1.25
$rightdisplay pos 3128 0 mode 2560x1440 scale 1.25 transform 270
}

View File

@ -0,0 +1,66 @@
### -*-conf-space-*- ###
# Tie Fighter Workspace Settings #
### ###
# This file defines the workspaces and creates the keybinds to switch
# between them and move containers around between them. This version
# is for "tie-fighter" systems (one horizontal central display flanked
# by two vertical displays). The host-specific display-arrangement.conf
# file should declare the $leftdisplay, $centerdisplay, and $rightdisplay
# variables used here.
workspace {
# Left monitor workspaces
1 output $leftdisplay
2 output $leftdisplay
3 output $leftdisplay
4 output $leftdisplay
5 output $leftdisplay
# Center monitor workspaces
6 output $centerdisplay
7 output $centerdisplay
8 output $centerdisplay
9 output $centerdisplay
10 output $centerdisplay
11 output $centerdisplay
12 output $centerdisplay
13 output $centerdisplay
14 output $centerdisplay
15 output $centerdisplay
# Right monitor workspaces
16 output $rightdisplay
17 output $rightdisplay
18 output $rightdisplay
19 output $rightdisplay
20 output $rightdisplay
}
## Workspace Switching Keybinds
bindsym {
$mod+1 exec swaymsg workspace $(sway-find-workspace 1 )
$mod+2 exec swaymsg workspace $(sway-find-workspace 2 )
$mod+3 exec swaymsg workspace $(sway-find-workspace 3 )
$mod+4 exec swaymsg workspace $(sway-find-workspace 4 )
$mod+5 exec swaymsg workspace $(sway-find-workspace 5 )
$mod+6 exec swaymsg workspace $(sway-find-workspace 6 )
$mod+7 exec swaymsg workspace $(sway-find-workspace 7 )
$mod+8 exec swaymsg workspace $(sway-find-workspace 8 )
$mod+9 exec swaymsg workspace $(sway-find-workspace 9 )
$mod+0 exec swaymsg workspace $(sway-find-workspace 10)
}
## Window Reassignment Keybinds
bindsym {
$mod+Shift+1 exec swaymsg move container to workspace $(sway-find-workspace 1 )
$mod+Shift+2 exec swaymsg move container to workspace $(sway-find-workspace 2 )
$mod+Shift+3 exec swaymsg move container to workspace $(sway-find-workspace 3 )
$mod+Shift+4 exec swaymsg move container to workspace $(sway-find-workspace 4 )
$mod+Shift+5 exec swaymsg move container to workspace $(sway-find-workspace 5 )
$mod+Shift+6 exec swaymsg move container to workspace $(sway-find-workspace 6 )
$mod+Shift+7 exec swaymsg move container to workspace $(sway-find-workspace 7 )
$mod+Shift+8 exec swaymsg move container to workspace $(sway-find-workspace 8 )
$mod+Shift+9 exec swaymsg move container to workspace $(sway-find-workspace 9 )
$mod+Shift+0 exec swaymsg move container to workspace $(sway-find-workspace 10)
}

View File

@ -1,4 +1,4 @@
# -*-conf-unix-*-
[Service]
ExecStartPost=eww open-many leftbar rightbar network-status
ExecStartPost=eww open-many leftbar centerbar rightbar network-status

View File

@ -34,6 +34,12 @@
'(elcord-idle-message "Idling...")
'(elcord-idle-timer 120)
'(elcord-refresh-rate 3)
'(lsp-pyls-plugins-flake8-ignore '("E501"))
'(lsp-pyls-plugins-pycodestyle-ignore '("E501"))
'(lsp-pyls-plugins-pydocstyle-enabled nil)
'(lsp-pylsp-plugins-flake8-ignore ["E501"])
'(lsp-pylsp-plugins-pydocstyle-enabled nil)
'(lsp-pylsp-plugins-pylint-enabled t)
'(mouse-autoselect-window t)
'(package-selected-packages
'(kotlin-mode magit counsel doom-modeline doom-themes use-package))

View File

@ -1,6 +1,6 @@
#!/usr/bin/env zsh
exec < /dev/null
exec </dev/null
exec > >(systemd-cat -t i3-sensible-launcher -p info)
exec 2> >(systemd-cat -t i3-sensible-launcher -p err)
@ -8,29 +8,29 @@ pyenv shell system
current_workspace=$(swaymsg -t get_workspaces | jq '.[] | select(.focused==true).name' -r)
ws_data=$(jq < $HOME/.config/sway/workspaces.json "[.[] | values[]] | flatten(1) | .[] | select(.index==${current_workspace})" -c)
ws_data=$(jq <$HOME/.config/sway/workspaces.json ".contexts | [.[] | values[]] | flatten(1) | .[] | select(.index==${current_workspace})" -c)
program=$(echo $ws_data | jq -r '.exec')
program_name=$(echo $ws_data | jq -r '.program_name')
memory_profile=$(echo $ws_data | jq '.memory_profile' -c)
run_with_systemd=$(echo $ws_data | jq '.systemd' -r)
void_output=$(echo $ws_data | jq '.void_output' -r)
IFS=$'\n' environ=($(echo $ws_data | jq '.environ | to_entries | map("\(.key)=\(.value|tostring)") | .[]' -r 2> /dev/null))
IFS=$'\n' args=($(echo $ws_data | jq '.args | .[]' -r 2> /dev/null))
IFS=$'\n' environ=($(echo $ws_data | jq '.environ | to_entries | map("\(.key)=\(.value|tostring)") | .[]' -r 2>/dev/null))
IFS=$'\n' args=($(echo $ws_data | jq '.args | .[]' -r 2>/dev/null))
systemd_run_args=()
if [[ $memory_profile != "null" ]]; then
max_memory=$(echo $memory_profile | jq -r '.max')
high_memory=$(echo $memory_profile | jq -r '.high')
max_memory=$(echo $memory_profile | jq -r '.max')
high_memory=$(echo $memory_profile | jq -r '.high')
systemd_run_args+=("--property=MemoryAccounting=yes" "--property=MemoryMax=${max_memory}" "--property=MemoryHigh=${high_memory}")
systemd_run_args+=("--property=MemoryAccounting=yes" "--property=MemoryMax=${max_memory}" "--property=MemoryHigh=${high_memory}")
fi
pty=alacritty
function error() {
gxmessage -buttons "OK:0" -name "Program Launch Error" -title "Program Launch Error" "Error: This workspace is not assigned a default program" -borderless -wrap -center -sticky -default OK
gxmessage -buttons "OK:0" -name "Program Launch Error" -title "Program Launch Error" "Error: This workspace is not assigned a default program" -borderless -wrap -center -sticky -default OK
}
if [[ $program == "" ]]; then
@ -57,19 +57,19 @@ elif [[ $program == "console" ]]; then
fi
if [[ $void_output == "true" ]]; then
# Run it under a scope for resource control, but don't capture stdout/stderr
# This should only be used for programs that either produce no output, or
# produce so much output that it would flood the journal and make it
# difficult to use.
exec > /dev/null
exec 2> /dev/null
exec systemd-run --user $=systemd_run_args --scope --unit="$program_name-$$" --description="$program_name" --slice=gui.slice -- $=program
# Run it under a scope for resource control, but don't capture stdout/stderr
# This should only be used for programs that either produce no output, or
# produce so much output that it would flood the journal and make it
# difficult to use.
exec >/dev/null
exec 2>/dev/null
exec systemd-run --user $=systemd_run_args --scope --unit="$program_name-$$" --description="$program_name" --slice=gui.slice -- $=program
fi
if [[ $run_with_systemd == "false" ]]; then
# Run it under systemd-cat to capture stdout/stderr to journal, but don't use systemd-run
# so that we don't get resource control
exec systemd-cat -t $program_name -p info -- $=program
# Run it under systemd-cat to capture stdout/stderr to journal, but don't use systemd-run
# so that we don't get resource control
exec systemd-cat -t $program_name -p info -- $=program
fi
# Run programs using systemd-run to allow for resource control and capture of stdout/stderr

View File

@ -2,15 +2,17 @@
output_sets=()
# Order outputs by x position (left to right)
for output in $(swaymsg -t get_outputs | jq '[ (.[] | select(.active) | pick(.name, .rect)) ] | sort_by(.rect.x) | .[] | .name' -r); do
# Get output ordering
for output in $(jq <~/.config/sway/workspaces.json '.display_layout[.display_ordering.[]] | strings' -r); do
output_sets+=$output
done
echo "Output sets: $output_sets" >&2
workspace_counts=()
total_workspaces=0
for output in {1..${#output_sets[@]}}; do
workspace_counts+=$(jq <~/.config/sway/workspaces.json "[.[] | values[]][$((output - 1))] | length" -r)
workspace_counts+=$(jq <~/.config/sway/workspaces.json ".contexts[.default_context] | [values[]][$((output - 1))] | length" -r)
((total_workspaces += workspace_counts[output]))
done
@ -38,7 +40,7 @@ function get_ws {
echo "Searching for workspace $ws_target on output $ws_set" >&2
workspace=$(($(get_previous_output_workspaces $ws_set) + ws_target))
echo "Staying on this output would be workspace $workspace" >&2
if ((workspace == current_workspace)); then
if [[ $workspace == $current_workspace ]]; then
echo "We're already on the target workspace, so we should look to change outputs" >&2
initial_ws_set=$ws_set
while :; do
@ -60,9 +62,15 @@ function get_ws {
}
i=0
found=false
for output in $output_sets; do
if [[ $current_output == $output ]]; then
found=true
get_ws $i $1
fi
((i++))
done
if [[ $found == false ]]; then
echo "[ ERR ] Current output not found in list of outputs" >&2
fi