From ad4446f61b106e2a312329cc877621bfcf7a6cc9 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Wed, 6 Oct 2021 18:59:14 +0300 Subject: [PATCH] Add configs for swaywm and waybar --- bootstrap.sh | 6 +- sway/config | 215 +++++++++++++++++++++++++++++ sway/config.d/50-systemd-user.conf | 7 + waybar/config | 35 +++++ waybar/launch.sh | 3 + waybar/style.css | 42 ++++++ 6 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 sway/config create mode 100644 sway/config.d/50-systemd-user.conf create mode 100644 waybar/config create mode 100755 waybar/launch.sh create mode 100644 waybar/style.css diff --git a/bootstrap.sh b/bootstrap.sh index f4d1365..6a8c799 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -18,6 +18,8 @@ alacrittyDir="$HOME/.config/alacritty" i3Dir="$HOME/.config/i3" polybarDir="$HOME/.config/polybar" rofiDir="$HOME/.config/rofi" +swayDir="$HOME/.config/sway" +waybarDir="$HOME/.config/waybar" picomFile="$HOME/.config/picom.conf" gitconfigFile="$HOME/.gitconfig" @@ -32,6 +34,8 @@ ln -s $PWD/i3 $i3Dir ln -s $PWD/alacritty $alacrittyDir ln -s $PWD/polybar $polybarDir ln -s $PWD/rofi $rofiDir +ln -s $PWD/sway $swayDir +ln -s $PWD/waybar $waybarDir ln -s $PWD/picom.conf $picomFile ln -s $PWD/.gitconfig $gitconfigFile @@ -45,7 +49,7 @@ fi # Remove all configs if [ "$1" = "-R" ] ; then -cd && rm -rf .bashrc $nvimDir $alacrittyDir $i3Dir $polybarDir $rofiDir $picomFile $gitconfigFile && cd - +cd && rm -rf .bashrc $nvimDir $alacrittyDir $i3Dir $polybarDir $rofiDir $swayDir $waybarDir $picomFile $gitconfigFile && cd - fi diff --git a/sway/config b/sway/config new file mode 100644 index 0000000..a75d8a8 --- /dev/null +++ b/sway/config @@ -0,0 +1,215 @@ +# __ ___ ____ ___ _ ____ _ _____ ____ +# \ \ / / \ | _ \|_ _| / \ | __ )| | | ____/ ___| +# \ \ / / _ \ | |_) || | / _ \ | _ \| | | _| \___ \ +# \ V / ___ \| _ < | | / ___ \| |_) | |___| |___ ___) | +# \_/_/ \_\_| \_\___/_/ \_\____/|_____|_____|____/ +# +set $mod Mod4 +set $alt Mod1 +set $term alacritty + +set $left h +set $down j +set $up k +set $right l + +set $menu dmenu_path | rofi -show run | xargs swaymsg exec -- + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + + + +# ____ _____ _ _ _____ ____ _ _ +# / ___| ____| \ | | ____| _ \ / \ | | +# | | _| _| | \| | _| | |_) | / _ \ | | +# | |_| | |___| |\ | |___| _ < / ___ \| |___ +# \____|_____|_| \_|_____|_| \_\/_/ \_\_____| +# + +default_border pixel +smart_borders on +focus_follows_mouse no +gaps inner 10 + +# Set a keyboard layout +input * { + xkb_layout "us,ru" + xkb_options "grp:win_space_toggle" +} + +# Draw a wallpaper +output * bg $HOME/Pictures/Wallpapers/2b.jpeg fill + +# For window settings +for_window [class="Steam"] floating enable +for_window [class="Steam"] move absolute center +for_window [class="mpv"] floating enable +for_window [class="mpv"] move absolute center +for_window [class="imv"] floating enable +for_window [class="imv"] move absolute center +for_window [class="MuPDF"] floating enable + +# Assign applications to specific workspaces +assign [class="firefox"] $ws1 +assign [class="Steam"] $ws3 + + +# ____ _____ _ ____ _____ _ _ ____ _ ____ ____ ____ +# / ___|_ _|/ \ | _ \_ _| | | | _ \ / \ | _ \| _ \/ ___| +# \___ \ | | / _ \ | |_) || | | | | | |_) | / _ \ | |_) | |_) \___ \ +# ___) || |/ ___ \| _ < | | | |_| | __/ / ___ \| __/| __/ ___) | +# |____/ |_/_/ \_\_| \_\|_| \___/|_| /_/ \_\_| |_| |____/ +# +exec_always --no-startup-id $HOME/.config/waybar/launch.sh +exec_always --no-startup-id /usr/share/sway/scripts/inactive-windows-transparency.py -o 0.8 + + +# _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____ +# | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___| +# | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \ +# | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) | +# |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/ +# + +# Make screenshots +bindsym $mod+Home exec --no-startup-id shot copy +bindsym $mod+Shift+Home exec --no-startup-id shot save + +# Volume and media control +bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 2 +bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 2 +bindsym XF86AudioMute exec --no-startup-id pamixer -t +bindsym XF86AudioPlay exec playerctl play-pause +bindsym XF86AudioNext exec playerctl next +bindsym XF86AudioPrev exec playerctl previous + +# Run applications +bindsym $alt+r exec alacritty -e ranger +bindsym $alt+f exec firefox +bindsym $alt+s exec steam + +# Start a terminal +bindsym $mod+Return exec $term + +# Kill focused window +bindsym $mod+Shift+q kill + +# Start app launcher +bindsym $mod+d exec $menu + +# Use $mod+Tab to cycle through workspaces +bindsym $mod+Tab workspace next +bindsym $mod+Shift+Tab workspace prev + +# Floating modifier +# allows to resize windows with $mod+RightMouseButton +# and move floating windows +floating_modifier $mod normal + +# Reload the configuration file +# also restarts sway +bindsym $mod+Shift+r reload + +### Movement keys +# Move your focus around +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right + +# Move the focused window with the same, but add Shift +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right move right + +### Workspace keys +# Switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +### Layout keys +# Change split mode +bindsym $mod+g 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 + + + +### 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 + +### Resizing windows +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 + + # Ditto, with arrow keys + 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+r mode "resize" + +include $PWD/config.d/* diff --git a/sway/config.d/50-systemd-user.conf b/sway/config.d/50-systemd-user.conf new file mode 100644 index 0000000..72e5dcd --- /dev/null +++ b/sway/config.d/50-systemd-user.conf @@ -0,0 +1,7 @@ +# sway does not set DISPLAY/WAYLAND_DISPLAY in the systemd user environment +# See FS#63021 +# Adapted from xorg's 50-systemd-user.sh, which achieves a similar goal. + +exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK +exec hash dbus-update-activation-environment 2>/dev/null && \ + dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..abc2647 --- /dev/null +++ b/waybar/config @@ -0,0 +1,35 @@ +{ + // "layer": "top", // Waybar at top layer + "position": "top", // Waybar position (top|bottom|left|right) + "height": 40, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + // Choose the order of the modules + "modules-left": ["sway/workspaces"], + "modules-center": [], + "modules-right": ["pulseaudio", "sway/language", "network", "clock"], + + // Left modules + "sway/workspaces": { + // "disable-scroll": true, + "all-outputs": true, + "format": "{index}" + }, + + // Right modules + "pulseaudio": { + "tooltip": false + }, + "sway/language": { + "tooltip": false + }, + "network": { + "format": "{icon} connected", + "format-icons": [""], + "tooltip": false + }, + "clock": { + "format": "{:%d %b %H:%M, %A}", + "tooltip": false + } +} + diff --git a/waybar/launch.sh b/waybar/launch.sh new file mode 100755 index 0000000..b392159 --- /dev/null +++ b/waybar/launch.sh @@ -0,0 +1,3 @@ +killall waybar + +waybar diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..50fa4d4 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,42 @@ +/* Colors */ +/* primary: #ffa759 */ +/* background: #202734 */ +/* background-alt: #191e2a */ +/* foreground: #cbccc6 */ + +window#waybar { + background: transparent; + color: #cbccc6; + font-family: "Fira Code", "Font Awesome 5 Free Solid"; +} + +#workspaces { + background: #202734; + margin: 10px; + border-radius: 8px; +} + +#workspaces button { + color: #fff; + background: transparent; +} + +#workspaces button.focused { + color: #ffa759; +} + +#workspaces button.urgent { + background: #ffa579; +} + +#clock, #network, #language, #pulseaudio { + background: #202734; + margin: 10px; + padding: 10px; + border-radius: 8px; +} + +#network, #language, #pulseaudio { + margin-right: 5px; +} +