summaryrefslogtreecommitdiff
path: root/config/sway.scm
blob: f9cd0df9d6d9bf12982bd68d3381ce54dd886f87 (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
(define-library (config sway)
  (export sway-config)
  (import (scheme base)	  
	  (config-generation sway))
  (begin
    (define screenshot-menu "guile --r7rs -L ~/src/wofi-guile/lib/ ~/src/screenshot-menu.scm")

    (define sway-config
      (scm->sway-config 
   ;;; Variables
       `((set $mod Mod4			; Logo key. Use Mod1 for Alt.
	      $hyper Mod1+Mod4+Shift+Control
	      $meh Mod1+Shift+Control
	      
	      ;; Home row directions keys, like vim.	
	      $left h
	      $down j
	      $up k
	      $right l
	      
	      ;; Prefered terminal emulator
	      $term "foot"

	      ;; Preferred editor
	      $editor "emacsclient -c -a emacs"

	      ;; Preferred application launcher
	      $menu "wofi -c ~/.config/wofi/config -I"

	      ;; Preferred music player
	      $music "foot cmus")

	 
	 ;; Output configuration
	 (output ((* bg "#2E3440" solid_color)
		  (HDMI-A-1 mode 1920x1080@144Hz)))

	 ;; Input configuration
	 ;; (input "9580:110:HUION_Huion_Tablet_Pen" map_to_output HDMI-A-1)

	 ;; Hide cursor after 3 seconds
	 (seat * hide_cursor 3000)

	 (input "1133:50504:Logitech_USB_Receiver_Mouse"
		((accel_profile flat)
		 (pointer_accel -0.4)))

;;; Key bindings
	 (bindsyms
	  ;; Kill focused window
	  ;; (($mod+Shift+q $meh+q) kill)
	  ;; Start launcher
	  ;; (($hyper+d $mod+d) exec $menu)
	  ;; Reload the config file
	  ;; ($mod+Shift+c reload)
	  ;; Lock sway
	  (($meh+l $mod+Semicolon) exec swaylock -c "#000000")
	  ;; Exit sway
	  ;; ($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" "herd stop sway")
	  ;; Screenshot menu
	  ($meh+a exec ,screenshot-menu))

	 ;; Drag floating windows by holding down $mod and left mouse button.
	 ;; Resize them with right mouse button + $mod.
	 ;; Also works for non-floating windows.
	 ;; Change normal to inverse to use left mouse buttor for resizing and right
	 ;; mouse button for dragging.
	 (floating_modifier $mod normal)

	 ;; Moving around
	 ;; (bindsyms
	 ;;  ;; Moving focus around
	 ;;  (($mod+$left $mod+Left) focus left)
	 ;;  (($mod+$down $mod+Down) focus down)
	 ;;  (($mod+$up $mod+Up) focus up)
	 ;;  (($mod+$right $mod+Right) focus right)
	 
	 ;;  ;; Move the focused window by adding Shift
	 ;;  (($mod+Shift+$left $mod+Shift+Left) move left)
	 ;;  (($mod+Shift+$down $mod+Shift+Down) move down)
	 ;;  (($mod+Shift+$up $mod+Shift+Up) move up)
	 ;;  (($mod+Shift+$right $mod+Shift+Right) move right))

	 ;; Workspaces
	 (bindsyms
	  ;; Switch to workspace
	  ;; ($mod+1 workspace number 1)
	  ;; ($mod+2 workspace number 2)
	  ;; ($mod+3 workspace number 3)
	  ;; ($mod+4 workspace number 4)
	  ;; ($mod+5 workspace number 5)
	  ;; ($mod+6 workspace number 6)
	  ;; ($mod+7 workspace number 7)
	  ;; ($mod+8 workspace number 8)
	  ;; ($mod+9 workspace number 9)
	  ;; ($mod+0 workspace number 10)
	  
	  ;; Move focused container to workspace
	  ;; ($mod+Shift+1 move container to workspace number 1)
	  ;; ($mod+Shift+2 move container to workspace number 2)
	  ;; ($mod+Shift+3 move container to workspace number 3)
	  ;; ($mod+Shift+4 move container to workspace number 4)
	  ;; ($mod+Shift+5 move container to workspace number 5)
	  ;; ($mod+Shift+6 move container to workspace number 6)
	  ;; ($mod+Shift+7 move container to workspace number 7)
	  ;; ($mod+Shift+8 move container to workspace number 8)
	  ;; ($mod+Shift+9 move container to workspace number 9)
	  ;; ($mod+Shift+0 move container to workspace number 10)
	  
	  ;; Split the current object
	  ;; ($mod+b splith)
	  ;; ($mod+v splitv)
	  
	  ;; Switch the current container layout style
	  ;; ($mod+s layout stacking)
	  ;; ($mod+w layout tabbed)
	  ;; ($mod+e layout toggle split)

	  ;; Make the current focus fullscreen
	  ;; ($mod+f fullscreen)

	  ;; Toggle 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
	 ;; (bindsyms
	 ;;  ;; 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))

   ;;; Resizing
	 ;; (mode "resize"
	 ;;   ((bindsyms
	 ;; 	 (($left Left) resize shrink width 10px)
	 ;; 	 (($down Down) resize grow height 10px)
	 ;; 	 (($up Up) resize shrink height 10px)
	 ;; 	 (($right Right) resize grow width 10px)
	 
	 ;; 	 ;; Return to default mode
	 ;; 	 (Return mode "default")
	 ;; 	 (Escape mode "default"))))
	 ;; (bindsym $mod+r mode "resize")

   ;;; Media
	 (bindsyms
	  (XF86AudioRaiseVolume exec pamixer --increase 5)
	  (XF86AudioLowerVolume exec pamixer --decrease 5)
	  (XF86AudioMute exec pamixer --toggle-mute)
	  (XF86AudioPlay exec emacsclient -e "(emms-pause)")
	  (XF86AudioNext exec emacsclient -e "(emms-next)")
	  (XF86AudioPrev exec emacsclient -e "(emms-previous)")
	  (XF86Search exec $menu))

	 ;; Applications
	 (bindsyms
	  ;; Start music player on workspace 5
	  ($hyper+m (workspace 5) (exec $music) (workspace back_and_forth))
	  ;; Start terminal
	  ;; (($mod+Return $mod+Shift+t) exec emacsclient -c -e "(new-eshell)")
	  ;; Start editor
	  (($mod+t $hyper+t) exec $editor))

	 ;; TODO REMOVE
	 (exec "hash dbus-update-activation-environment 2>/dev/null")
	 (exec_always "dbus-update-activation-environment --all")

   ;;; Styling

	 (font "pango:Noto Sans Mono" 8)
	 (titlebar_padding 7 1)
	 
	 ;; Remove titlebar by default
	 (for-window (title ".*") border pixel 2)

	 (for-window (class ".*") inhibit_idle fullscreen)
	 (for-window (app_id ".*") inhibit_idle fullscreen)

	 ;; Class                 border    backgr.   text      indicator   child_border
	 (client.focused          "#bf616a" "#bf616a" "#ffffff" "#bf616a"   "#bf616a")
	 (client.focused_inactive "#333333" "#5f676a" "#ffffff" "#484e50"   "#5f676a")
	 (client.unfocused        "#333333" "#222222" "#888888" "#292d2e"   "#222222")
	 (client.urgent           "#2f343a" "#900000" "#ffffff" "#900000"   "#900000")
	 (client.placeholder      "#000000" "#0c0c0c" "#ffffff" "#000000"   "#0c0c0c"))))))