better container moving management, handle xrandr at login

This commit is contained in:
2020-09-24 15:33:14 +02:00
parent 069aadd788
commit 3a784764c6
4 changed files with 55 additions and 12 deletions

20
bin/auto-outputs Executable file
View File

@@ -0,0 +1,20 @@
#! /bin/bash
. ~/.config/i3/env
usage() {
echo "usage: auto-outputs"
}
if [ $# -ne 0 ]; then
usage; exit 1
fi
xrandr --auto
if [ -n "${PRIMARY_OUTPUT}" ] && [ -n "${SECONDARY_OUTPUT}" ]; then
if [ -n "${SECONDARY_OUTPUT_POSITION}" ]; then
xrandr --output ${PRIMARY_OUTPUT} --primary --output ${SECONDARY_OUTPUT} ${SECONDARY_OUTPUT_POSITION} HDMI-1
else
xrandr --output ${PRIMARY_OUTPUT} --primary --output ${SECONDARY_OUTPUT} --right-of HDMI-1
fi
fi

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
ROFI_INPUT=1 ~/.config/i3/bin/focus_workspace $(i3-msg -t get_workspaces | jq '.[]' | jq -r '.name' | rofi -dmenu -p "Select workspace:" | sed 's/:.*//') ROFI_INPUT=1 ~/.config/i3/bin/focus_workspace $(i3-msg -t get_workspaces | jq '.[]' | jq -r '.name' | sort -n | rofi -dmenu -p "Select workspace:" | sed 's/:.*//')

22
bin/move_to_workspace Executable file
View File

@@ -0,0 +1,22 @@
#! /bin/bash
. ~/.config/i3/env
usage() {
echo "usage: move_to_workspace [1-9]"
}
if [ $# -ne 1 ]; then
usage; exit 1
fi
CURRENT_OUTPUT=$(i3-msg -t get_workspaces | jq -r ".[] | select(.focused==true).output")
if [ $1 -gt 0 ] && [ $1 -lt 43 ]; then
NEXT_WORKSPACE=$1
[ ${CURRENT_OUTPUT} == "${SECONDARY_OUTPUT}" ] && NEXT_WORKSPACE=$((10 + $1))
else
usage; exit 1
fi
i3-msg -q "move container to workspace ${NEXT_WORKSPACE}"

23
config
View File

@@ -1,7 +1,8 @@
set $mod Mod4 set $mod Mod4
floating_modifier $mod floating_modifier $mod
exec --no-startup-id "~/.config/i3/bin/create_workspaces" exec --no-startup-id ~/.config/i3/bin/auto-outputs
exec --no-startup-id ~/.config/i3/bin/create_workspaces
########## ##########
# Visual # # Visual #
@@ -22,7 +23,7 @@ exec --no-startup-id "xbindkeys > /dev/null 2>&1"
exec --no-startup-id "nm-applet > /dev/null 2>&1" exec --no-startup-id "nm-applet > /dev/null 2>&1"
exec --no-startup-id "pasystray > /dev/null 2>&1" exec --no-startup-id "pasystray > /dev/null 2>&1"
exec --no-startup-id "blueman-applet > /dev/null 2>&1" exec --no-startup-id "blueman-applet > /dev/null 2>&1"
exec --no-startup-id "compton > /dev/null 2>&1" exec --no-startup-id "compton -b > /dev/null 2>&1"
exec --no-startup-id "xss-lock slock" exec --no-startup-id "xss-lock slock"
############ ############
@@ -70,15 +71,15 @@ bindsym $mod+7 exec ~/.config/i3/bin/focus_workspace 7
bindsym $mod+8 exec ~/.config/i3/bin/focus_workspace 8 bindsym $mod+8 exec ~/.config/i3/bin/focus_workspace 8
bindsym $mod+9 exec ~/.config/i3/bin/focus_workspace 9 bindsym $mod+9 exec ~/.config/i3/bin/focus_workspace 9
# move focused container to workspace # move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1 bindsym $mod+Shift+1 exec ~/.config/i3/bin/move_to_workspace 1
bindsym $mod+Shift+2 move container to workspace number 2 bindsym $mod+Shift+2 exec ~/.config/i3/bin/move_to_workspace 2
bindsym $mod+Shift+3 move container to workspace number 3 bindsym $mod+Shift+3 exec ~/.config/i3/bin/move_to_workspace 3
bindsym $mod+Shift+4 move container to workspace number 4 bindsym $mod+Shift+4 exec ~/.config/i3/bin/move_to_workspace 4
bindsym $mod+Shift+5 move container to workspace number 5 bindsym $mod+Shift+5 exec ~/.config/i3/bin/move_to_workspace 5
bindsym $mod+Shift+6 move container to workspace number 6 bindsym $mod+Shift+6 exec ~/.config/i3/bin/move_to_workspace 6
bindsym $mod+Shift+7 move container to workspace number 7 bindsym $mod+Shift+7 exec ~/.config/i3/bin/move_to_workspace 7
bindsym $mod+Shift+8 move container to workspace number 8 bindsym $mod+Shift+8 exec ~/.config/i3/bin/move_to_workspace 8
bindsym $mod+Shift+9 move container to workspace number 9 bindsym $mod+Shift+9 exec ~/.config/i3/bin/move_to_workspace 9
# switch/move to output # switch/move to output
bindsym $mod+s focus output right bindsym $mod+s focus output right
bindsym $mod+Shift+s move container to output right bindsym $mod+Shift+s move container to output right