From f00d98afa7ecd4abcd99a2f8f6f872db96b94568 Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Sat, 26 Aug 2023 15:27:01 +0800 Subject: [PATCH] sway: refactor --- .config/sway/config | 344 ++++++++++++++++++-------------------------- 1 file changed, 143 insertions(+), 201 deletions(-) diff --git a/.config/sway/config b/.config/sway/config index 40188e4..6865d10 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -1,164 +1,136 @@ -exec himitsud -exec hissh-agent -exec pipewire -exec mako -exec foot --server -exec ~/.local/libexec/title-watch.sh -exec sh -c 'wlchewing -e -d no -f "Noto Sans CJK TC 11" -b#303030 -s#80cbc4 -S#101a19 2>/tmp/wlchewing.log' -exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP GTK_THEME - -output eDP-1 scale 3 -output DP-2 pos 0 0 -output 'AOC 2269W BFAD39A000404' pos 0 0 - -output 'BNQ BenQ BL2780 96L0214501Q' subpixel rgb -output 'AOC 2269W BFAD39A000404' subpixel rgb +exec { + himitsud + hissh-agent + pipewire + mako + foot --server + ~/.local/libexec/title-watch.sh + wlchewing -e -d no -f "Noto Sans CJK TC 11" -b#303030 -s#80cbc4 -S#101a19 2>/tmp/wlchewing.log + dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP GTK_THEME +} + +#xwayland disable + +output { + eDP-1 scale 3 + DP-2 pos 0 0 + + 'AOC 2269W BFAD39A000404' { + pos 0 0 + subpixel rgb + } + + 'BNQ BenQ BL2780 96L0214501Q' subpixel rgb + + * background ~/.local/share/backgrounds/20618.jpg fill +} bindswitch lid:toggle output eDP-1 toggle -#for_window [title="."] title_format "%title %app_id %class %instance %shell" -#xwayland disable +input { + 1739:30383:DELL07E6:00_06CB:76AF_Touchpad tap enabled + 1267:9454:ELAN24EE:00_04F3:24EE map_to_output eDP-1 +} -set $mod Mod4 +set $m Mod4 + +# Use Mouse+$m to drag floating windows to their wanted position +floating_modifier $m + +bindsym { + $m+Return exec footclient + $m+d exec j4-dmenu-desktop --dmenu='wmenu -i -n c0c0c0 -N 303030 -s ffffff -S 37474f' --no-generic --term=footclient --usage-log=$HOME/.cache/j4desktop + + $m+Shift+q kill + + $m+Left focus left + $m+Down focus down + $m+Up focus up + $m+Right focus right + + $m+space focus mode_toggle + + $m+Shift+Left move left + $m+Shift+Down move down + $m+Shift+Up move up + $m+Shift+Right move right + + $m+h split h + $m+v split v + + $m+s layout stacking + $m+w layout tabbed + $m+e layout toggle split + + $m+f fullscreen toggle + $m+p sticky toggle + $m+b border toggle + $m+Shift+space floating toggle + + $m+1 workspace 1 + $m+2 workspace 2 + $m+3 workspace 3 + $m+4 workspace 4 + $m+5 workspace 5 + $m+6 workspace 6 + $m+7 workspace 7 + $m+8 workspace 8 + $m+9 workspace 9 + $m+0 workspace 10 + + $m+Shift+1 move container to workspace 1 + $m+Shift+2 move container to workspace 2 + $m+Shift+3 move container to workspace 3 + $m+Shift+4 move container to workspace 4 + $m+Shift+5 move container to workspace 5 + $m+Shift+6 move container to workspace 6 + $m+Shift+7 move container to workspace 7 + $m+Shift+8 move container to workspace 8 + $m+Shift+9 move container to workspace 9 + $m+Shift+0 move container to workspace 10 + + $m+Shift+c reload + $m+Shift+e exit + $m+Shift+l exec swaylockd + + XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ + + XF86AudioPlay exec playerctl play-pause + XF86AudioPrev exec playerctl previous + XF86AudioNext exec playerctl next + XF86Search exec playerctl shuffle Toggle + + XF86MonBrightnessUp exec 'notify-send Brightness "Brightness set to $(blctl +5%)"' + XF86MonBrightnessDown exec 'notify-send Brightness "Brightness set to $(blctl -5%)"' + + Print exec 'STAMP=$(date +%Y%m%d-%H%M%S); grim ~/Pictures/$STAMP.png; notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved"' + $m+Print exec 'set -e; STAMP=$(date +%Y%m%d-%H%M%S);COR=$(slurp); grim -g "$COR" ~/Pictures/$STAMP.png; notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved, $COR"' +} -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -#font pango:monospace 8 +bindgesture { + swipe:right focus right + swipe:left focus left -# This font is widely installed, provides lots of unicode glyphs, right-to-left -# text rendering and scalability on retina/hidpi displays (thanks to pango). -#font pango:Noto Sans Mono CJK TC 8 -font pango:Noto Sans Mono, Noto Sans Mono CJK TC 8 -# Before i3 v4.8, we used to recommend this one as the default: -# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -# The font above is very space-efficient, that is, it looks good, sharp and -# clear in small sizes. However, its unicode glyph coverage is limited, the old -# X core fonts rendering does not support right-to-left and this being a bitmap -# font, it doesn’t scale on retina/hidpi displays. - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# start a terminal -bindsym $mod+Return exec footclient - -# kill focused window -bindsym $mod+Shift+q kill - -# start dmenu (a program launcher) -#bindsym $mod+d exec dmenu_run -# There also is the (new) i3-dmenu-desktop which only displays applications -# shipping a .desktop file. It is a wrapper around dmenu, so you need that -# installed. -bindsym $mod+d exec j4-dmenu-desktop --dmenu="wmenu -i -n c0c0c0 -N 303030 -s ffffff -S 37474f" --no-generic --term=footclient --usage-log=$HOME/.cache/j4desktop - -# change focus -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# move focused 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 - -# split in horizontal orientation -bindsym $mod+h split h - -# split in vertical orientation -bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -#bindsym $mod+d focus child - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. -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" - -# switch to workspace -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 -bindsym $mod+0 workspace $ws10 - -# move focused container to workspace -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 -bindsym $mod+Shift+0 move container to workspace $ws10 - -# reload the configuration file -bindsym $mod+Shift+c reload - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym semicolon resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" + pinch:inward+up move up + pinch:inward+down move down + pinch:inward+left move left + pinch:inward+right move right } -bindsym $mod+r mode "resize" +mode resize { + bindsym { + Left resize shrink width + Down resize grow height + Up resize shrink height + Right resize grow width + $m+r mode default + } +} + +bindsym $m+r mode resize -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) bar { status_command i3status colors { @@ -174,9 +146,10 @@ bar { urgent_workspace #F44336 #F44336 #ffffff } separator_symbol | - #icon_theme Arc } +font pango:Noto Sans Mono, Noto Sans Mono CJK TC 8 + # mtrl dark secondary client.focused #37474f #37474f #ffffff #37474f #37474f client.unfocused #303030 #303030 #c0c0c0 #303030 #303030 @@ -186,56 +159,25 @@ default_border normal 1 hide_edge_borders both focus_on_window_activation urgent -#bindsym Print exec "export STAMP=$(date '+%Y%m%d-%H%M%S'); import -window root ~/Pictures/$STAMP.png; notify-send -i camera Screenshot \\"$STAMP.png saved\\" " -bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle -bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -bindsym XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ - -mode "Minecraft" { - bindsym $mod+f exec ~/sources/mcafk/mcrightclick.sh on - bindsym $mod+g exec ~/sources/mcafk/mcrightclick.sh off - bindsym $mod+m mode "default" -} +set $ff "^firefox$" -bindsym $mod+m mode "Minecraft" - -input 1739:30383:DELL07E6:00_06CB:76AF_Touchpad tap enabled -input 1267:9454:ELAN24EE:00_04F3:24EE map_to_output eDP-1 -bindsym $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' -output "*" background ~/.local/share/backgrounds/20618.jpg fill -bindsym XF86MonBrightnessUp exec 'notify-send Brightness "Brightness set to $(blctl +5%)" -i /usr/share/icons/Arc/status/symbolic/brightness-display-symbolic.svg' -bindsym XF86MonBrightnessDown exec 'notify-send Brightness "Brightness set to $(blctl -5%)" -i /usr/share/icons/Arc/status/symbolic/brightness-display-symbolic.svg' -bindsym Print exec 'export STAMP=$(date +%Y%m%d-%H%M%S); grim ~/Pictures/$STAMP.png; notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved" ' -bindsym $mod+Print exec 'STAMP=$(date +%Y%m%d-%H%M%S);COR=$(slurp); grim -g "$COR" ~/Pictures/$STAMP.png; notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved, $COR" ' - -for_window [app_id="firefox" title="^(Picture-in-Picture$|子母畫面)"] { - border none - floating enable - sticky enable - move right 390 px - move down 210 px - resize set 480 270 -} +for_window { + [app_id=$ff title="^(Picture-in-Picture|子母畫面)$"] { + border none + floating enable + sticky enable + move right 390 px + move down 210 px + resize set 480 270 + } -for_window [app_id="firefox" title="^Extension: \(Open in Browser\) \- Opening "] floating enable + [app_id=$ff title="^Extension: \(Open in Browser\) \- Opening "] floating enable -for_window [app_id="firefox" title="^Opening "] floating enable + [app_id=$ff title="^Opening "] floating enable -for_window [app_id="firefox" title="^Firefox — (Sharing Indicator|分享指示器)"] { - floating enable - border none - resize set 80 50 + [app_id=$ff title="^Firefox — (Sharing Indicator|分享指示器)$"] { + border none + floating enable + resize set 80 50 + } } - -bindsym XF86AudioPlay exec playerctl play-pause -bindsym XF86AudioPrev exec playerctl previous -bindsym XF86AudioNext exec playerctl next -bindsym XF86Search exec playerctl shuffle Toggle - -bindgesture swipe:right focus right -bindgesture swipe:left focus left - -bindgesture pinch:inward+up move up -bindgesture pinch:inward+down move down -bindgesture pinch:inward+left move left -bindgesture pinch:inward+right move right -- 2.45.2