aboutsummaryrefslogtreecommitdiff
path: root/dot_config/sway/config
blob: 629dec85f8b862faa010dae2011a6566f20e5c3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# 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
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term foot
set $lock swaylock
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu dmenu_path | dmenu | xargs swaymsg exec --

set $trans 0.7
set $alphamark "α"
for_window [con_mark=$alphamark] opacity set $trans

include /etc/sway/config-vars.d/*

### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
# Example configuration:
#
#   output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs

### Idle configuration
#
exec swayidle -w \
         timeout 180 $lock \
         timeout 240 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
         before-sleep $lock

### Input configuration
#

# This is only used to make bindsym --to-code map all of the default bindings to
# the same physical keys as the default us layout.
# The layouts are actually set by $XDG_CONFIG_HOME/sway/config.d/20_keyboards
input * {
    xkb_layout us
}

bindsym --locked {
    XF86AudioMute        exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
    XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
    XF86AudioRaiseVolume exec wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+
    XF86AudioMicMute     exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
    XF86MonBrightnessUp exec --no-startup-id light -A 10
    XF86MonBrightnessDown exec --no-startup-id light -U 10
}

#
# Basics:
#
bindsym --to-code {
    # Start a terminal
    $mod+Return exec $term

    # Kill focused window
    $mod+Shift+q kill

    # Start your launcher
    $mod+d exec $menu

    # Reload the configuration file
    $mod+Shift+c reload

    # Exit sway (logs you out of your Wayland session)
    $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'

    # Lock screen
    $mod+F5 exec swaymsg 'output * dpms toggle'
    $mod+F7 exec $lock

    # List all windows
    $mod+u exec wofi-window-switcher

    $mod+Shift+t mark --toggle "$alphamark" ; [con_id=__focused__] opacity set 1 ; [con_mark=$alphamark con_id=__focused__] opacity set $trans

#
# Moving around:
#

    # Move your focus around
    $mod+$left focus left
    $mod+$down focus down
    $mod+$up focus up
    $mod+$right focus right
    # Or use $mod+[up|down|left|right]
    $mod+Left workspace prev
    $mod+Down focus down
    $mod+Up focus up
    $mod+Right workspace next

    # Move the focused window with the same, but add Shift
    $mod+Shift+$left move left
    $mod+Shift+$down move down
    $mod+Shift+$up move up
    $mod+Shift+$right move right
    # Ditto, with arrow keys
    $mod+Shift+Left move left
    $mod+Shift+Down move down
    $mod+Shift+Up move up
    $mod+Shift+Right move right

    # Move focus between outputs
    $mod+x       focus output next
    $mod+Shift+x focus output prev
#
# Layout stuff:
#
    # You can "split" the current object of your focus with
    # $mod+b or $mod+v, for horizontal and vertical splits
    # respectively.
    $mod+b splith
    $mod+v splitv

    # Switch the current container between different layout styles
    $mod+s layout stacking
    $mod+w layout tabbed
    $mod+e layout toggle split

    # Make the current focus fullscreen
    $mod+f fullscreen

    # Toggle the current focus between tiling and floating mode
    $mod+Shift+space floating toggle

    # Swap focus between the tiling area and the floating area
    $mod+space focus mode_toggle

    # Move focus to the parent container
    $mod+a focus parent
#
# 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
    $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.
    $mod+minus scratchpad show

}

    bindgesture swipe:right workspace prev
    bindgesture swipe:left  workspace next

    # 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
#
# Resizing containers:
#
mode "resize" bindsym --to-code {
    # left will shrink the containers width
    # right will grow the containers width
    # up will shrink the containers height
    # down will grow the containers height
    $left resize shrink width 10px
    $down resize grow height 10px
    $up resize shrink height 10px
    $right resize grow width 10px

    # Ditto, with arrow keys
    Left resize shrink width 10px
    Down resize grow height 10px
    Up resize shrink height 10px
    Right resize grow width 10px

    # Return to default mode
    Return mode "default"
    Escape mode "default"
}
bindsym --to-code $mod+r mode "resize"


# use for_window instead of assign when we want to follow the window and focus
# on it
for_window [app_id="firefox"] move container to workspace number 2; focus
for_window [class="Signal"]   move container to workspace number 3; focus

bar swaybar_command waybar
exec_always pkill kanshi; exec kanshi

font pango:Iosevka Regular 8

include /etc/sway/config.d/*
include ~/.config/sway/config.d/*