Add all sway relevant config

This commit is contained in:
Vladan Popovic 2021-06-17 09:39:49 +02:00
parent 483f435ef8
commit 284dd752dc
12 changed files with 399 additions and 2 deletions

34
.config/sway/apps Normal file
View File

@ -0,0 +1,34 @@
for_window [class="Firefox"] mark Browser
for_window [class="Firefox" window_role="Browser"] {
border normal 0
}
# firefox floating menus
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [window_role="bubble"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_role="Preferences"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
for_window [title="About Mozilla Firefox"] floating enabled
for_window [title="Password Required - Mozilla Firefox"] floating enabled
for_window [app_id="pinentry-qt"] {
move position center
floating enable
}
for_window [app_id="pavucontrol"] {
move position center
floating enable
}
for_window [app_id="wdisplays"] {
floating enable
}
for_window [app_id="com.nextcloud.desktopclient.nextcloud"] {
border normal 1
floating enable
}
for_window [app_id="avizo-service"] border pixel 0
for_window [app_id="avizo-service"] sticky toggle
no_focus [app_id="avizo-service"]

17
.config/sway/bar Normal file
View File

@ -0,0 +1,17 @@
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
position bottom
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command i3status
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}

140
.config/sway/bindings Normal file
View File

@ -0,0 +1,140 @@
# lock screen
bindsym $mod+z exec systemctl kill swayidle.service --user --signal USR1 --kill-who=main
bindsym $mod+Shift+t sticky toggle
bindsym $mod+Print exec grim screenshot-$(date --iso-8601=ns).png
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle # mute sound
bindsym XF86AudioMicMute exec pactl set-source-mute alsa_input.pci-0000_00_1b.0.analog-stereo toggle # mute mic
# Sreen brightness controls
bindsym XF86MonBrightnessUp exec brightnessctl -q s +10%
bindsym XF86MonBrightnessDown exec brightnessctl -q s 10%-
### Key bindings
#
# Basics:
#
# start a terminal
bindsym $mod+Return exec systemd-run --user $term
# Kill focused window
bindsym $mod+Shift+q kill
# start your launcher
bindsym $mod+d exec $menu
# 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
# reload the configuration file
bindsym $mod+Shift+c reload
# exit sway (logs you out of your Wayland session)
bindsym $mod+Alt+Delete exec swaynag -t warning -m 'You pressed the mod4+alt+del. Do you really want to: ' \
-b 'Exit sway' 'swaymsg exit' \
-b 'Reboot' 'systemctl reboot' \
-b 'Shutdown' 'systemctl poweroff'
#
# Moving around:
#
# Move your focus around
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# _move_ the focused window with the same, but add Shift
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
#
# Workspaces:
#
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# 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
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# move focus to the parent container
bindsym $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
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 Print scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Shift+R mode "resize"

View File

@ -17,7 +17,8 @@ set $right l
set $term alacritty set $term alacritty
# Your preferred application launcher # Your preferred application launcher
# Note: it's recommended that you pass the final command to sway # Note: it's recommended that you pass the final command to sway
set $menu wofi -c $HOME/.config/wofi/config -s $HOME/.config/wofi/style.css | xargs swaymsg exec -- # set $menu wofi -c $HOME/.config/wofi/config -s $HOME/.config/wofi/style.css | xargs swaymsg exec --
set $menu ~/src/wldash/target/release/wldash
### Output configuration ### Output configuration
# #
@ -62,6 +63,16 @@ input * xkb_layout "us,mk"
input * xkb_variant "typewriter" input * xkb_variant "typewriter"
input * xkb_options "grp:caps_toggle" input * xkb_options "grp:caps_toggle"
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle # mute sound
bindsym XF86AudioMicMute exec pactl set-source-mute alsa_input.pci-0000_00_1b.0.analog-stereo toggle # mute mic
# Sreen brightness controls
bindsym XF86MonBrightnessUp exec brightnessctl -q s +10%
bindsym XF86MonBrightnessDown exec brightnessctl -q s 10%-
### Key bindings ### Key bindings
# #
# Basics: # Basics:
@ -222,8 +233,11 @@ bindsym Shift+Print exec grim -g "$(slurp)" /tmp/screen.png
# Remove title from windows # Remove title from windows
default_border pixel 1 default_border pixel 1
default_floating_border normal
bindsym $mod+t border toggle bindsym $mod+t border toggle
hide_edge_borders smart
# Background # Background
set $bg #232425 set $bg #232425
# Background active # Background active
@ -235,7 +249,7 @@ set $fa #eff1f5
# Foreground inactive # Foreground inactive
set $fi #646464 set $fi #646464
# Border active # Border active
set $bra #7a7a7a set $bra #5a5a5a
# Border inactive # Border inactive
set $bri #000000 set $bri #000000
@ -252,3 +266,7 @@ gaps outer 0
#smart_gaps on #smart_gaps on
include /etc/sway/config.d/* include /etc/sway/config.d/*
include apps
exec "~/.config/sway/keyboard-layout-per-window.py"
exec "systemctl --user import-environment ; systemctl --user start sway-session.target"

9
.config/sway/env Normal file
View File

@ -0,0 +1,9 @@
MOZ_ENABLE_WAYLAND=1
SDL_VIDEODRIVER=wayland
SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh
XDG_CURRENT_DESKTOP=KDE
KDE_SESSION_VERSION=5
# QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# CLUTTER_BACKEND=wayland
FREETYPE_PROPERTIES="truetype:interpreter-version=35"
_JAVA_AWT_WM_NONREPARENTING=1

4
.config/sway/input Normal file
View File

@ -0,0 +1,4 @@
input 1:1:AT_Translated_Set_2_keyboard {
xkb_layout us,mk
xkb_options grp:switch,grp:caps_toggle
}

View File

@ -0,0 +1,42 @@
#!/usr/bin/env python
# This script keeps track of active keyboard layouts per window.
#
# This script requires i3ipc-python package (install it from a system package
# manager or pip).
#
# https://github.com/swaywm/sway/pull/4504/files
import i3ipc
sway = i3ipc.Connection()
prev_focused = sway.get_tree().find_focused().id
windows = {}
def on_window_focus(ipc, event):
global windows, prev_focused
# Save current layouts
layouts = {input.identifier: input.xkb_active_layout_index for input in sway.get_inputs()}
windows[prev_focused] = layouts
# Restore layout of the newly focused window
if event.container.id in windows:
for (input_id, layout_index) in windows[event.container.id].items():
if layout_index != layouts[input_id]:
sway.command(f'input "{input_id}" xkb_switch_layout {layout_index}')
prev_focused = event.container.id
def on_window_close(ipc, event):
global windows
if event.container.id in windows:
del(windows[event.container.id])
def on_window(ipc, event):
if event.change == "focus":
on_window_focus(ipc, event)
elif event.change == "close":
on_window_close(ipc, event)
sway.on("window", on_window)
sway.main()

57
.config/sway/normal.json Normal file
View File

@ -0,0 +1,57 @@
{
"id": 78,
"name": "Close tabs? — Mozilla Firefox",
"rect": {
"x": 0,
"y": 26,
"width": 1920,
"height": 1024
},
"focused": false,
"focus": [
],
"border": "normal",
"current_border_width": 0,
"layout": "none",
"orientation": "none",
"percent": 1.0,
"window_rect": {
"x": 0,
"y": 0,
"width": 1920,
"height": 1024
},
"deco_rect": {
"x": 1440,
"y": 0,
"width": 480,
"height": 26
},
"geometry": {
"x": 0,
"y": 0,
"width": 528,
"height": 147
},
"window": null,
"urgent": false,
"marks": [
],
"fullscreen_mode": 0,
"nodes": [
],
"floating_nodes": [
],
"sticky": false,
"type": "con",
"pid": 906,
"app_id": "firefox",
"visible": false,
"max_render_time": 0,
"shell": "xdg_shell",
"inhibit_idle": false,
"idle_inhibitors": {
"user": "fullscreen",
"application": "none"
}
}

11
.config/sway/output Normal file
View File

@ -0,0 +1,11 @@
### 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

57
.config/sway/tabs.json Normal file
View File

@ -0,0 +1,57 @@
{
"id": 8,
"name": "extrawurst\/gitui: Blazing 💥 fast terminal-ui for git written in rust 🦀 — Mozilla Firefox",
"rect": {
"x": 0,
"y": 26,
"width": 1920,
"height": 1024
},
"focused": false,
"focus": [
],
"border": "normal",
"current_border_width": 0,
"layout": "none",
"orientation": "none",
"percent": 1.0,
"window_rect": {
"x": 0,
"y": 0,
"width": 1920,
"height": 1024
},
"deco_rect": {
"x": 960,
"y": 0,
"width": 480,
"height": 26
},
"geometry": {
"x": 0,
"y": 0,
"width": 1920,
"height": 235
},
"window": null,
"urgent": false,
"marks": [
],
"fullscreen_mode": 0,
"nodes": [
],
"floating_nodes": [
],
"sticky": false,
"type": "con",
"pid": 906,
"app_id": "firefox",
"visible": false,
"max_render_time": 0,
"shell": "xdg_shell",
"inhibit_idle": false,
"idle_inhibitors": {
"user": "fullscreen",
"application": "none"
}
}

7
.config/swayidle/config Normal file
View File

@ -0,0 +1,7 @@
# ~/.config/swayidle/config
timeout 300 'swaylock -f'
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
before-sleep 'swaylock -f'
after-resume 'swaymsg "output * dpms on"'
unlock 'swaymsg "output * dpms on"'
lock 'swaylock -f'

1
.config/swaylock/config Normal file
View File

@ -0,0 +1 @@
color=222222