chezmoi/dot_config/sway/config
2022-06-08 22:06:09 +02:00

529 lines
20 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Please see https://i3wm.org/docs/userguide.html for a complete reference!
# this sets the mod button -> windows key
set $mod Mod4
set $mod1 Mod1
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
# font pango:monospace 8
# overrides title bars -> makes sure i3-gaps can do its thing
for_window [class="^.*"] border pixel 2
# for jetbrains windows... focus on dialogs!
for_window [class="^jetbrains-.+"][window_type=dialog] focus
# fix citrix windows
for_window [class="Wfica_Seamless"] floating enable
# border radius for the rounded windows
# border_radius 0
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
# Using the prefix of workspaces in order to be able to define ordering for special workspaces.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
set $wsleft ""
set $wsright ""
# automatically assign programs to workspace
# using workspace names here, otherwise doesn't work as expected
# assign [class="Chromium"] $ws1
assign [class="Thunderbird"] $ws2
# workspace 9: chat
assign [class="Slack"] $ws9
assign [class="Mattermost"] $ws9
assign [class="Hamsket"] $ws9
assign [class="discord"] $ws9
assign [class="signal"] $ws9
assign [class="ferdi"] $ws9
assign [class="microsoft teams - preview"] $ws9
assign [class="obsidian"] $ws8
assign [class="Wfica_Seamless"] $ws10
#assign [class="jetbrains-idea"] 7
#assign [class="jetbrains-webstorm"] 8
#assign [class="jetbrains-datagrip"] 9
#disabled this for now, using Ferdi for socials
#exec --no-startup-id "i3-msg 'workspace 9:9; append_layout /home/joachim/.config/i3/workspace-9.json'"
# Disallow endless looping of focus: extreme right is extreme right, don't flip to extreme left whenever you want...
focus_wrapping no
# font pango:DejaVu Sans Mono 8
# font xft:Fantasque Sans Mono 9
font xft:FuraCode Nerd Font 8
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec alacritty
bindsym $mod+Shift+Return exec kitty
# TODO make this help window a bit fancier
bindsym $mod+F1 exec alacritty -e chezmoi edit ~/.dotfiles/README.md
# screenshotting
# Desktop screenshot
#bindsym --release Print exec "scrot ~/Bilder/Bildschirmfotos/$(date --iso-8601='seconds').png -m -e 'xclip -selection c -t image/png < $f'"
# Choose window
#bindsym --release Mod1+Sys_Req exec "import -window `xwininfo | awk '/.*Window id:.*/ {print $4}'` ~/Bilder/Bildschirmfotos/$(date --iso-8601='seconds').png"
# Selection screenshot
#bindsym --release Shift+Print exec "scrot ~/Bilder/Bildschirmfotos/$(date --iso-8601='seconds').png -s -e 'xclip -selection c -t image/png < $f'"
bindsym --release Print exec ~/.config/i3/screenshot.sh
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
# bindsym $mod+d exec dmenu_run
bindsym $mod+d exec ~/.config/rofi/runrofi.sh
bindsym $mod+Shift+d exec "albert show"
# this uses the output of greenclip (see here https://wiki.archlinux.org/index.php/Greenclip) to show clipboard history in rofi
bindsym $mod+c exec rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
# do a nice menu with mode
# lock / logout / sleep / hibernate / restart / poweroff
set $mode_system System  l e s鈴 h rﰇ וּsﮤ
mode "$mode_system" {
bindsym l exec --no-startup-id ~/.config/i3/i3exit.sh lock, mode "default"
bindsym e exec --no-startup-id ~/.config/i3/i3exit.sh logout, mode "default"
bindsym s exec --no-startup-id ~/.config/i3/i3exit.sh suspend, mode "default"
bindsym h exec --no-startup-id ~/.config/i3/i3exit.sh hibernate, mode "default"
bindsym r exec --no-startup-id ~/.config/i3/i3exit.sh reboot, mode "default"
bindsym Shift+s exec --no-startup-id ~/.config/i3/i3exit.sh shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Pause mode "$mode_system"
bindsym $mod+F12 mode "$mode_system"
# do a nice menu for monitor values
set $mode_redshift Monitor 2,3,4,5,6,7,8洞 j/k
mode "$mode_redshift" {
bindsym 2 exec --no-startup-id redshift -P -O 2000
bindsym 3 exec --no-startup-id redshift -P -O 3000
bindsym 4 exec --no-startup-id redshift -P -O 4000
bindsym 5 exec --no-startup-id redshift -P -O 5000
bindsym 6 exec --no-startup-id redshift -P -O 6000
bindsym 7 exec --no-startup-id redshift -P -O 7000
bindsym 8 exec --no-startup-id redshift -P -O 8000
bindsym k exec --no-startup-id "light -A 10"
bindsym j exec --no-startup-id "light -U 10"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+F9 mode "$mode_redshift"
# do a nice menu for keyboard layouts
set $mode_xkbmap Layout aus bus-intl cus-altgr dgb egb-intl fdvorak
mode "$mode_xkbmap" {
bindsym a exec --no-startup-id setxkbmap us, mode "default"
bindsym b exec --no-startup-id setxkbmap us intl, mode "default"
bindsym c exec --no-startup-id setxkbmap us altgr-intl, mode "default"
bindsym d exec --no-startup-id setxkbmap gb, mode "default"
bindsym e exec --no-startup-id setxkbmap gb intl, mode "default"
bindsym f exec --no-startup-id setxkbmap dvorak, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Ctrl+k mode "$mode_xkbmap"
# this is a menu dedicated to audio stuff
# some nice symbols to try here: 0|    論b籠i錄 
set $mode_audio Audio    - + 0 y
mode "$mode_audio" {
# Pulse Audio controls
# Increase / decrease volume for the running sink only
bindsym k exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f 1) +2%
bindsym plus exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f 1) +2%
bindsym bracketleft exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f 1) +2%
# decrease
bindsym j exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f 1) -2%
bindsym minus exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f 1) -2%
bindsym bracketright exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f 1) -2%
# Mute sound
bindsym 0 exec --no-startup-id pactl set-sink-mute $(pactl list short sinks | grep RUNNING | cut -f 1) toggle
# Start mps-youtube
bindsym y exec --no-startup-id urxvt -e mpsyt, mode "default"
# Media player controls
# Toggle pause/play
bindsym space exec playerctl play-pause
#bindsym XF86AudioPause exec playerctl pause
#bindsym XF86AudioNext exec playerctl next
#bindsym XF86AudioPrev exec playerctl previous
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+F11 mode "$mode_audio"
# do a nice menu for custom launches
set $mode_launch  adefault start-up bnoise-fix cdual dhorizontal etearing
mode "$mode_launch" {
# These are all the default programs launching at startup.
bindsym a exec thunderbird, exec signal-desktop, exec ferdi, exec obsidian mode "default", exec teams --no-sandbox, exec slack
# This fixes audio noise (lenovo)
# bindsym b exec sudo hda-verb /dev/snd/hwC*D0 0x1d SET_PIN_WIDGET_CONTROL 0x0, mode "default"
# This bypasses weird xrandr bug, resets to single display, then goes back to triple monitor setup (use autorandr profile here, needs to be set up in advance)
#bindsym c exec xrandr --output eDP1 --mode 2560x1440, exec autorandr triple, mode "default"
#bindsym c exec autorandr dual2k, mode "default"
# execute default horizontal layout of monitors
bindsym d exec autorandr horizontal, mode "default"
# this fixes tearing on nvidia
# bindsym e exec nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+F10 mode "$mode_launch"
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# these are shortcuts for programs
bindsym $mod+Ctrl+t exec urxvt
bindsym $mod+Ctrl+e exec thunar
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# move workspace to left and right monitors
bindsym $mod+Shift+bracketleft move workspace to output left
bindsym $mod+Shift+bracketright move workspace to output right
# explicit bindings for arandr's setups: might not need these anymore... using autorandr now
# bindsym $mod+Shift+Ctrl+1 exec ~/.screenlayout/laptop-only.sh
# bindsym $mod+Shift+Ctrl+2 exec ~/.screenlayout/work-desk.sh
# split in horizontal orientation
bindsym $mod+m split h
# split in vertical orientation
bindsym $mod+n split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+i focus parent
# do some gaps magic: win+shift+g
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
# focus the child container
bindsym $mod+u focus child
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
bindsym $mod+comma workspace $wsleft
bindsym $mod+period workspace $wsright
# Scratchpad
bindsym $mod+Shift+BackSpace move scratchpad
bindsym $mod+BackSpace scratchpad show
# generic switch
#bindcode 49+34 workspace $ws9
#bindsym $mod+grave workspace $ws9
#bindsym $mod+shift+grave workspace $ws9
# check this out: https://unix.stackexchange.com/questions/338228/i3wm-more-than-10-workspaces-with-double-modifier-key#339985
bindsym $mod+grave exec i3-input -F 'workspace %s' -P 'go to workspace: '
bindsym $mod+shift+grave exec i3-input -F 'move container to workspace %s' -P 'move to workspace: '
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
bindsym $mod+Shift+comma move container to workspace $wsleft
bindsym $mod+Shift+period move container to workspace $wsright
# reload the configuration file
bindsym $mod+Shift+c exec "i3-msg reload && notify-send ' i3' 'Reloaded config.' -u low"
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
#bindsym $mod+Shift+r exec "i3-msg 'restart' && sleep 3 && notify-send ' i3' 'Restarted.' -u low"
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Edit config files
bindsym XF86Tools exec --no-startup-id urxvt -e vim ~/.config/i3/config
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound
bindsym $mod+XF86AudioPlay exec --no-startup-id urxvt -e mpsyt # start terminal youtube player
#bindsym $mod+F11 exec --no-startup-id urxvt -e mpsyt # start terminal youtube player
# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
#bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Screen brightness keys
# (This should work for both acpilight or xbacklight.)
bindsym XF86MonBrightnessUp exec xbacklight -inc 20
bindsym XF86MonBrightnessDown exec xbacklight -dec 20
# Dunst controls
bindsym $mod+Ctrl+space exec dunstctl close
bindsym $mod+Ctrl+Shift+space exec dunstctl close-all
bindsym $mod+Ctrl+$mod1+space exec dunstctl history-pop
# start multi touch support
exec --no-startup-id libinput-gestures-setup start
# start polybar
# exec_always --no-startup-id ~/.config/polybar/launch-multi.sh
# start the network manager applet
exec --no-startup-id nm-applet
# start bluetooth applet
exec --no-startup-id blueman-applet
# start the xfce4-power-manager -> helping us do lid / laptop things
exec --no-startup-id xfce4-power-manager
# load the wallpaper
exec_always --no-startup-id sh ~/.fehbg
# start greenclip, this somehow fails to start at launch (sometimes?)
# exec --no-startup-id systemctl --user start greenclip
exec --no-startup-id greenclip daemon>/dev/null
# reload the walpaper / color configuratin using pywal
# exec --no-startup-id wal -R -q
# change the wallpaper exec_always feh --bg-scale ~/Documents/private/img/mars-wallpaper-23.jpg
# gruvbox colors
set $dark0_hard #1d2021
set $dark0 #282828
set $dark0_soft #32302f
set $dark1 #3c3836
set $dark2 #504945
set $dark3 #665c54
set $dark4 #7c6f64
set $gray_245 #928374
set $gray_244 #928374
set $light0_hard #f9f5d7
set $light0 #fbf1c7
set $light0_soft #f2e5bc
set $light1 #ebdbb2
set $light2 #d5c4a1
set $light3 #bdae93
set $light4 #a89984
set $bright_red #fb4934
set $bright_green #b8bb26
set $bright_yellow #fabd2f
set $bright_blue #83a598
set $bright_purple #d3869b
set $bright_aqua #8ec07c
set $bright_orange #fe8019
set $neutral_red #cc241d
set $neutral_green #98971a
set $neutral_yellow #d79921
set $neutral_blue #458588
set $neutral_purple #b16286
set $neutral_aqua #689d6a
set $neutral_orange #d65d0e
set $faded_red #9d0006
set $faded_green #79740e
set $faded_yellow #b57614
set $faded_blue #076678
set $faded_purple #8f3f71
set $faded_aqua #427b58
set $faded_orange #af3a03
set $transparent #ffffff00
# Current color set
# This is how you would get a colors from xrdb
# set_from_resource $color0 i3wm.color0 #000000
# window color class [border| backgr.| text| indicator| child_border]
client.focused $gray_245 $dark0_hard $light0_hard $bright_orange $bright_green
client.focused_inactive $dark0_hard $dark0_hard $light0_hard $dark0_hard $dark0_hard
client.unfocused $dark0_hard $dark0_hard $light0_hard $dark0_hard #FFFFFF00
client.urgent $dark0_hard $dark0 $light0_hard $dark0_hard $bright_orange
client.placeholder $dark0_hard $dark0_hard $light0_hard $dark0_hard $dark0_hard
client.background $dark0_hard
# Took this from the default config
# bar {
# position top
#
# # When the status_command prints a new line to stdout, swaybar updates.
# # The default just shows the current date and time.
# status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
#
# colors {
# statusline #ffffff
# background $dark0_hard
# inactive_workspace #32323200 #32323200 #5c5c5c
# }
# }
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg ~/pictures/l_ash03_big.jpg fill
# Testing this out
# dwt - disable while typing
# middle_emulation - middle click emulation
input "1267:12590:ELAN0755:00_04F3:312E_Touchpad" {
dwt enabled
tap enabled
natural_scroll enabled
middle_emulation enabled
}
# start waybar
bar swaybar_command waybar
# pretty important, loads specific fixes, e.g., https://www.reddit.com/r/swaywm/comments/n13tro/problem_with_dbus_auto_activation_in_archsway/
include /etc/sway/config.d/*