myconfigfiles/.config/sway/config

349 lines
11 KiB
Text

#==================================================================================#
# Sway Window Manager Configuration File #
#----------------------------------------------------------------------------------#
# Purpose: This configuration file enables you to tweak keyboard shortcuts, adjust #
# themes and colors, set the wallpaper, and more. #
# #
# License: Creative Commons Attribution 4.0 International #
# Source: https://www.learnlinux.tv #
# Author: Gregory Trolliet <gregory@trolliet.info> #
# #
# Pro-tip: While using Sway, you can trigger this configuration to be re-read by #
# pressing Super + Shift + C. #
#==================================================================================#
#====================================#
# Keyboard configuration #
#====================================#
input "18003:1:foostan_Corne" {
xkb_layout fr
xkb_variant ergol
}
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout ch
xkb_variant fr
}
#========================#
# Appearance and Theming #
#========================#
# Declare Colors:
set $background #332b2b
set $color_urgent #fb4934
set $text_color #ffffff
set $title_bg_unfocused #666666
set $title_outline_active #0e844e
set $title_outline_unfocused #332b2b
# Set Colors: Border Background Text Indicator Child Border
client.background $background
client.focused $title_outline_active $background $text_color $title_outline_active $title_outline_active
client.focused_inactive $title_outline_unfocused $background $text_color $text_color $title_outline_unfocused
client.unfocused $title_outline_unfocused $title_bg_unfocused $text_color $title_outline_active
client.urgent $color_urgent $color_urgent $color_urgent $color_urgent $color_urgent
# Add gaps in between all application windows:
gaps inner 8
gaps outer 3
# Configure the default border:
default_border pixel 2
# Set the Wallpaper:
output * bg $HOME/.config/sway/wallpaper_ngnm.jpg fill
#====================================#
# Activate the panel #
#====================================#
# Set the waybar command for the application launcher:
bar {
swaybar_command waybar
}
#====================================#
# Keyboard Shortcuts (Sway-specific) #
#====================================#
# Set the modifier key to super:
set $mod Mod4
# Set the ALT key to $alt (since Mod1 is harder to remember):
set $alt Mod1
# Set up a shortcut to reload this config file:
bindsym $mod+k reload
# Quit your current session and return to the log-in manager/tty:
bindsym $mod+Shift+k exec $HOME/.config/sway/exit.sh
# Open password menu
bindsym $mod+x exec $HOME/.local/bin/fuzzel-menu --type
# Screen locking (automatic, with a timeout)
set $lock swaylock -c 550000
exec swayidle -w \
timeout 600 $lock \
timeout 570 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep $lock
# Screen locking (manual)
set $lock_screen exec bash ~/.config/sway/lock_screen.sh
bindsym $mod+Escape exec $lock_screen
#========================================#
# Keyboard Shortcuts (Window Management) #
#========================================#
# Move focus to another window:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the window:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# Hold the modifier key and hold the left/right mouse button
# to drag or resize a window respectively. This isn't exclusive
# to floating windows:
floating_modifier $mod normal
# Resizing containers:
mode "resize" {
# Resize windows with arrow keys:
bindsym Left resize shrink width 10px
bindsym Down resize shrink height 10px
bindsym Up resize grow height 10px
bindsym Right resize grow width 10px
# "cult of vim" version:
bindsym h resize shrink width 10px
bindsym j resize shrink height 10px
bindsym k resize grow height 10px
bindsym l resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#========================#
# Presenter #
#========================#
mode "present" {
# command starts mirroring
bindsym m mode "default"; exec wl-present mirror
# these commands modify an already running mirroring window
bindsym o mode "default"; exec wl-present set-output
bindsym r mode "default"; exec wl-present set-region
bindsym Shift+r mode "default"; exec wl-present unset-region
bindsym s mode "default"; exec wl-present set-scaling
bindsym f mode "default"; exec wl-present toggle-freeze
bindsym c mode "default"; exec wl-present custom
# return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+p mode "present"
#========================#
# Screen capture #
#========================#
# save screen to ~/Pictures
bindsym Print exec grim
# save a region to ~/Pictures
bindsym Shift+Print exec grim -g "$(slurp)"
# send screen to clipboard
bindsym Ctrl+Print exec grim - | wl-copy
# send a region to clipboard
bindsym Ctrl+Shift+Print exec grim -g "$(slurp)" - | wl-copy
#=================================#
# Keyboard Shortcuts (Workspaces) #
#=================================#
# Switch to workspace
set $ws0 "0 - Presentation"
set $ws1 "1 - Hack"
set $ws2 "2 - Browsing"
set $ws3 "3 - Communication"
set $ws4 "4 - Media"
set $ws5 "5 - Writing"
set $ws6 "6 - TBD"
set $ws7 "7 - TBD"
set $ws8 "8 - TBD"
set $ws9 "9 - TBD"
# Default workspace
workspace "1 - Hack"
# Move between workspaces
bindsym $mod+0 workspace $ws0
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
# Move focused container to workspace
bindsym $mod+Shift+0 move container to workspace $ws0
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
# Move workspace to another screen (output)
bindsym $mod+Ctrl+Left move workspace to output left
bindsym $mod+Ctrl+Right move workspace to output right
bindsym $mod+Ctrl+Up move workspace to output up
bindsym $mod+Ctrl+Down move workspace to output down
#=============================#
# Keyboard Shortcuts (Layout) #
#=============================#
# 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+t 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+f floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+tab focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#=================================#
# Keyboard Shortcuts (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
#===============================#
# Keyboard Shortcuts (Hardware) #
#===============================#
# Audio
bindsym XF86AudioRaiseVolume exec "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+; pkill -RTMIN+8 waybar"
bindsym XF86AudioLowerVolume exec "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; pkill -RTMIN+8 waybar"
bindsym XF86AudioMute exec "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; pkill -RTMIN+8 waybar"
# Brightness
bindsym XF86MonBrightnessDown exec light -U 10
bindsym XF86MonBrightnessUp exec light -A 10
#=============================================#
# Keyboard Shortcuts (launching applications) #
#=============================================#
# Set up wofi to replace dmenu as the launcher of choice:
set $menu fuzzel
# Launch your browser:
bindsym $mod+shift+b exec firefox
# Open a file manager:
bindsym ctrl+$mod+f exec pcmanfm
# Open a terminal emulator:
set $term alacritty
bindsym $mod+Shift+c exec $term
# Kill focused window:
bindsym $mod+F4 kill
# Open the application launcher:
bindsym $mod+space exec $menu
# Open the mail client
bindsym $mod+m exec thunderbird
#===============================#
# Default windows configuration #
#===============================#
assign [app_id="firefox"] workspace $ws2
assign [app_id="thunderbird"] workspace $ws3
assign [class="thunderbird-default"] workspace $ws3
for_window [class="TelegramDesktop"] resize set width 30ppt
assign [class="TelegramDesktop"] workspace $ws3
assign [class="FreeTube"] workspace $ws4
assign [app_id="at.yrlf.wl_mirror"] workspace $ws0
for_window [app_id="mpv"] resize set width 30ppt
for_window [class="Xreader"] resize set width 40ppt
for_window [app_id="org.pwmt.zathura"] resize set width 40ppt
for_window [app_id="gnome-calendar"] floating enable
#===============================#
# Startup app #
#===============================#
exec sleep 5s && nextcloud --background
#===============================#
# Dropdown terminal #
#===============================#
# source:
#https://www.reddit.com/r/swaywm/comments/goxsce/comment/inrdg0k
# Start with specific app_id/class
set $ddterm-id dropdown-terminal
set $ddterm $term --class $ddterm-id
set $ddterm-resize resize set 100ppt 100ppt, move position 0 0
# resize/move new dropdown terminal windows
for_window [app_id="$ddterm-id"] {
floating enable
$ddterm-resize
move to scratchpad
scratchpad show
}
# show existing or start new dropdown terminal
bindsym $mod+c exec swaymsg '[app_id="$ddterm-id"] scratchpad show' \
|| $ddterm -e tmuxinator start default \
&& sleep .1 && swaymsg '[app_id="$ddterm-id"] $ddterm-resize'
# ^-- resize again, case moving to different output
#======#
# Misc #
#======#
include /etc/sway/config-vars.d/*
include /etc/sway/config.d/*