update sway config
This commit is contained in:
parent
0ed78d898e
commit
169953d51f
4 changed files with 99 additions and 23 deletions
61
config/sway/autorotate
Executable file
61
config/sway/autorotate
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
#!/bin/bash
|
||||
|
||||
# This script handles rotation of the screen and related input devices automatically
|
||||
# using the output of the monitor-sensor command (part of the iio-sensor-proxy package)
|
||||
# for sway.
|
||||
# The target screen and input device names should be configured in the below variables.
|
||||
# Note: input devices using the libinput driver (e.g. touchscreens) should be included
|
||||
# in the WAYLANDINPUT array.
|
||||
#
|
||||
# You can get a list of input devices with the `swaymsg -t output` command.
|
||||
#
|
||||
# This scritp was frok from https://gitlab.com/snippets/1793649 by Fishonadish
|
||||
|
||||
|
||||
SCREEN="eDP-1"
|
||||
WAYLANDINPUT=(
|
||||
"type:mouse"
|
||||
"type:touchpad"
|
||||
"type:tablet_tool"
|
||||
"type:touch"
|
||||
)
|
||||
|
||||
|
||||
function rotate_ms {
|
||||
case $1 in
|
||||
"normal")
|
||||
rotate 0
|
||||
;;
|
||||
"right-up")
|
||||
rotate 90
|
||||
;;
|
||||
"bottom-up")
|
||||
rotate 180
|
||||
;;
|
||||
"left-up")
|
||||
rotate 270
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function rotate {
|
||||
|
||||
TARGET_ORIENTATION=$1
|
||||
|
||||
echo "Rotating to" $TARGET_ORIENTATION
|
||||
|
||||
swaymsg output $SCREEN transform $TARGET_ORIENTATION
|
||||
|
||||
for i in "${WAYLANDINPUT[@]}"
|
||||
do
|
||||
swaymsg input "$i" map_to_output "$SCREEN"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
while IFS='$\n' read -r line; do
|
||||
rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")"
|
||||
[[ ! -z $rotation ]] && rotate_ms $rotation
|
||||
done < <(stdbuf -oL monitor-sensor)
|
||||
|
||||
|
|
@ -1,8 +1,3 @@
|
|||
# Default config for sway
|
||||
#
|
||||
# Copy this to ~/.config/sway/config and edit it to your liking.
|
||||
#
|
||||
# Read `man 5 sway` for a complete reference.
|
||||
|
||||
### Variables
|
||||
#
|
||||
|
|
@ -26,7 +21,7 @@ set $menu bemenu-run
|
|||
### Output configuration
|
||||
#
|
||||
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
||||
# output * bg ~/Pictures/wallpaper.jpg fill
|
||||
output * bg ~/Pictures/wallpaper.png fill
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
|
|
@ -38,10 +33,10 @@ set $menu bemenu-run
|
|||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# exec swayidle -w \
|
||||
# timeout 300 'swaylock -f -c 000000' \
|
||||
# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
||||
# before-sleep 'swaylock -f -c 000000'
|
||||
exec swayidle -w \
|
||||
timeout 300 'swaylock -f -c 000000' \
|
||||
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
||||
before-sleep 'swaylock -f -c 000000'
|
||||
#
|
||||
# This will lock your screen after 300 seconds of inactivity, then turn off
|
||||
# your displays after another 300 seconds, and turn your screens back on when
|
||||
|
|
@ -51,7 +46,7 @@ set $menu bemenu-run
|
|||
#
|
||||
# Example configuration:
|
||||
#
|
||||
input "2:14:ETPS/2_Elantech_Touchpad" {
|
||||
input "type:touchpad" {
|
||||
dwt enabled
|
||||
tap enabled
|
||||
natural_scroll enabled
|
||||
|
|
@ -86,9 +81,6 @@ input "type:keyboard" {
|
|||
# mouse button for dragging.
|
||||
floating_modifier $mod normal
|
||||
|
||||
# Reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
||||
# Exit sway (logs you out of your Wayland session)
|
||||
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
|
||||
bindsym $mod+Shift+r reload
|
||||
|
|
@ -120,6 +112,7 @@ input "type:keyboard" {
|
|||
# Workspaces:
|
||||
#
|
||||
# Switch to workspace
|
||||
bindsym $mod+slash workspace back_and_forth
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
|
|
@ -146,16 +139,11 @@ input "type:keyboard" {
|
|||
#
|
||||
# Layout stuff:
|
||||
#
|
||||
# You can "split" the current object of your focus with
|
||||
# $mod+b or $mod+v, for horizontal and vertical splits
|
||||
# respectively.
|
||||
bindsym $mod+b splith
|
||||
bindsym $mod+v splitv
|
||||
|
||||
# Switch the current container between different layout styles
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
bindsym $mod+v layout toggle split
|
||||
|
||||
# Make the current focus fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
|
@ -180,6 +168,25 @@ input "type:keyboard" {
|
|||
# Show the next scratchpad window or hide the focused scratchpad window.
|
||||
# If there are multiple scratchpad windows, this command cycles through them.
|
||||
bindsym $mod+minus scratchpad show
|
||||
|
||||
#
|
||||
# System:
|
||||
#
|
||||
# screenshot current window
|
||||
bindsym print exec grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" - | wl-copy
|
||||
bindsym print+shift exec grim -g "$(slurp)" - | wl-copy
|
||||
|
||||
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
bindsym XF86AudioPlay exec playerctl play-pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
bindsym XF86MonBrightnessUp exec brightnessctl set +5%
|
||||
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
|
||||
|
||||
#
|
||||
# Resizing containers:
|
||||
#
|
||||
|
|
@ -224,5 +231,12 @@ bar {
|
|||
# Start Stuff
|
||||
|
||||
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||
exec monitor-sensor | bash $DOTS/config/sway/autorotate &> /tmp/autorotate.log
|
||||
|
||||
gaps inner 10
|
||||
gaps outer 2
|
||||
|
||||
smart_borders on
|
||||
|
||||
xwayland enable
|
||||
|
||||
include /etc/sway/config.d/*
|
||||
|
|
|
|||
|
|
@ -109,5 +109,5 @@ if [[ "$ZPROF" = true ]]; then
|
|||
fi
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
eval "$(rtx activate zsh)"
|
||||
# eval "$(rtx activate zsh)"
|
||||
# eval "$(zellij setup --generate-auto-start zsh)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue