Refactor sway config files, making them usable.

This commit is contained in:
Érico Rolim 2019-09-07 23:37:38 -03:00
parent 30f6ed6d5c
commit d3b932795e
2 changed files with 162 additions and 150 deletions

4
script/.local/bin/launcher Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
alacritty --dimensions 60 30 --title launcher --command bash -c 'compgen -c | sort -u | fzf --border | xargs lnch'

View File

@ -1,110 +1,129 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# ericonr's config for sway
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
## Defaults
set $term alacritty
set $menu launcher
set $editor emacs
## Set keyboard controls
# Logo key
set $mod Mod4
# 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
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# gaps conf
for_window [class=".*"] border pixel 0
gaps outer 2
gaps inner 4
#smart_gaps on
# quick launch
bindsym $mod+t exec --no-startup-id alacritty -e tmux
bindsym $mod+Shift+w exec --no-startup-id launch_browsers
bindsym $mod+Shift+f exec --no-startup-id dolphin
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec --no-startup-id alacritty
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
# bindsym $mod+d exec dmenu_run
# 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 dmenu
# change focus
# Change focus like VIM
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:
# You can also 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
# 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:
# You can also 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
# split in horizontal orientation
bindsym $mod+g split h
## System tasks
# Reload configuration file
bindsym $mod+Shift+c reload
# Restart sway inplace (can be used to upgrade sway)
bindsym $mod+Shift+r restart
# Exit sway
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'
# split in vertical orientation
bindsym $mod+v split v
## Input settings
# Change keyboard layout
set $keyboard "1:1:AT_Translated_Set_2_keyboard"
input $keyboard {
xkb_layout "us,br"
}
#TODO: make script that automatically switches inputs
bindsym $mod+Space input $keyboard xkb_switch_layout 0
bindsym $mod+Shift+Space input $keyboard xkb_switch_layout 1
# Touchpad
set $touchpad "1739:31251:SYNA2393:00_06CB:7A13_Touchpad"
input $touchpad {
tap enabled
natural_scroll disabled
}
# Media keys
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 XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set +5%
#TODO: use keys XF86AudioPlay, XF86AudioPause, XF86AudioPrev, XF86AudioNext
# enter fullscreen mode for the focused container
## Launching applications
# Start a terminal
bindsym $mod+Return exec $term
# Start a terminal with tmux
bindsym $mod+t exec $term -e tmux
# Launch editor
bindsym $mod+Shift+w exec $editor
# Start Dolphin file browser
bindsym $mod+Shift+f exec dolphin
# Kill focused window
bindsym $mod+Shift+q kill
# Start launcher
bindsym $mod+d exec $menu
for_window [title="launcher"] floating enable; border none
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
## Appearance
# Default wallpaper
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
# Font for window titles
font pango:Liberation Sans 8
# Gaps configuration
for_window [class=".*"] border none
gaps outer 3
gaps inner 3
## Idle configuration
# Automatic behavior
exec swayidle -w \
timeout 300 'swaylock' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock'
# Manual behavior
bindsym $mod+Shift+x exec swaylock -f -c 000000
## Layout
# Split in horizontal orientation
bindsym $mod+g splith
# Split in vertical orientation
bindsym $mod+v splitv
# Enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
# Change container layout (stacked, tabbed, toggle split)
bindsym $mod+q 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
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+z floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+z focus mode_toggle
# Move focys to the parent container
bindsym $mod+a focus parent
# Move focus to the child container
bindsym $mod+Shift+a focus child
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
## Workspaces
# Workspace name
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
@ -115,13 +134,12 @@ set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
set $ws11 "media"
set $ws12 "nwork"
set $ws13 "brow"
set $ws14 "pdf"
set $ws16 "og"
# switch to workspace
set $wsb "browser"
set $wsn "nth"
set $wsm "media"
set $wso "oh"
set $wsp "pdf"
# Switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
@ -132,13 +150,12 @@ bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
bindsym $mod+m workspace $ws11
bindsym $mod+n workspace $ws12
bindsym $mod+b workspace $ws13
bindsym $mod+p workspace $ws14
bindsym $mod+o workspace $ws16
# move focused container to workspace
bindsym $mod+b workspace $wsb
bindsym $mod+n workspace $wsn
bindsym $mod+m workspace $wsm
bindsym $mod+o workspace $wso
bindsym $mod+p workspace $wsp
# 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
@ -149,79 +166,70 @@ 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+m move container to workspace $ws11
bindsym $mod+Shift+n move container to workspace $ws12
bindsym $mod+Shift+b move container to workspace $ws13
bindsym $mod+Shift+p move container to workspace $ws14
bindsym $mod+Shift+o move container to workspace $ws16
bindsym $mod+Shift+b move container to workspace $wsb
bindsym $mod+Shift+n move container to workspace $wsn
bindsym $mod+Shift+m move container to workspace $wsm
bindsym $mod+Shift+o move container to workspace $wso
bindsym $mod+Shift+p move container to workspace $wsp
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+x 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'"
## Scratchpad
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# 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
# resize window (you can also use the mouse for that)
## Resizing containers
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 5 px or 5 ppt
bindsym j resize grow height 5 px or 5 ppt
bindsym k resize shrink height 5 px or 5 ppt
bindsym l resize grow width 5 px or 5 ppt
# same bindings, but for the arrow keys
# 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 5px
bindsym j resize grow height 5px
bindsym k resize shrink height 5px
bindsym l resize grow width 5px
# Same bindings, but for the arrow keys
bindsym Left resize shrink width 5 px or 5 ppt
bindsym Down resize grow height 5 px or 5 ppt
bindsym Up resize shrink height 5 px or 5 ppt
bindsym Right resize grow width 5 px or 5 ppt
# back to normal: Enter or Escape or $mod+r
# 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"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
## Status bar
bar {
status_command i3status
#status_command polybar example
position top
status_command i3status
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
input "1739:31251:SYNA2393:00_06CB:7A13_Touchpad" {
tap enabled
natural_scroll enabled
}
## Pre-configured workspaces
# Music
exec swaymsg 'workspace media; layout tabbed'
for_window [class="spotify"] move container to workspace $wsm
# Work
exec swaymsg 'workspace nth; layout tabbed'
assign [class="Kicad"] $wsn
assign [title="CubeMX"] $wsn
# PDF
exec swaymsg 'workspace pdf; layout tabbed'
assign [class="okular"] $wsp
# Return to first workspace
exec swaymsg 'workspace 1'
# music
exec --no-startup-id "i3-msg 'workspace media; layout tabbed'"
for_window [class="spotify"] move container to workspace $ws11
# work
exec --no-startup-id "i3-msg 'workspace nwork; layout tabbed'"
assign [class="Kicad"] $ws12
assign [title="CubeMX"] $ws12
# pdf
exec --no-startup-id "i3-msg 'workspace pdf; layout tabbed'"
assign [class="okular"] $ws14
for_window [title="Desktop — Plasma"] kill;
for_window [class="plasmashell"] floating enable;
for_window [class="Plasma"] floating enable;
for_window [title="plasma-desktop"] floating enable;
for_window [title="win7"] floating enable;
## Application specific settings
for_window [class="krunner"] floating enable;
for_window [class="Kmix"] floating enable; border none
for_window [class="konsole"] floating enable;
#for_window [class="Klipper"] floating enable; border none
for_window [class="Plasmoidviewer"] floating enable; border none
#for_window [class="(?i)*nextcloud*"] floating disable