From 08de0874b5793ab991b55f14fc2719cc994b9335 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sat, 27 Apr 2019 16:35:17 +0200 Subject: [PATCH] [sway] initial config based on i3 --- install.conf.json | 14 ++- sway/Xdefaults | 63 ++++++++++ sway/config | 297 ++++++++++++++++++++++++++++++++++++++++++++++ sway/lock.sh | 20 ++++ sway/thinkman | 13 ++ 5 files changed, 402 insertions(+), 5 deletions(-) create mode 100644 sway/Xdefaults create mode 100644 sway/config create mode 100755 sway/lock.sh create mode 100644 sway/thinkman diff --git a/install.conf.json b/install.conf.json index 9537298..8654696 100644 --- a/install.conf.json +++ b/install.conf.json @@ -14,12 +14,13 @@ ["mkdir -p ~/.profile.d/", "Creating local profile dir"], ["mkdir -p ~/.local/bin", "Creating local bin dir"], ["mkdir -p ~/.config/alacritty", "Creating alacritty-config dir"], + ["mkdir -p ~/.config/dunst", "Creating dunst dir"], ["mkdir -p ~/.config/i3", "Creating i3-config dir"], ["mkdir -p ~/.config/i3status", "Creating i3-status dir"], - ["mkdir -p ~/.config/dunst", "Creating dunst dir"], - ["mkdir -p ~/.config/yay", "Creating yay dir"] ["mkdir -p ~/.config/redshift/hooks", "Creating redshift dir"], - ["mkdir -p ~/.vim/", "Creating vim dir"], + ["mkdir -p ~/.config/sway", "Creating sway dir"], + ["mkdir -p ~/.config/yay", "Creating yay dir"], + ["mkdir -p ~/.vim/", "Creating vim dir"] ] }, { @@ -54,14 +55,17 @@ "~/.profile.d/81-fzf.sh": "shell/fzf.sh", "~/.config/redshift.conf": "redshift/redshift.conf", "~/.config/redshift/hooks/hook.sh": "redshift/hook.sh", - "~/.config/yay/config.json": "yay/config.json", + "~/.config/sway/config": "sway/config", + "~/.config/sway/thinkman": "sway/thinkman", "~/.tmux.conf": "tmux/tmux.conf", "~/.toprc": "top/toprc", "~/.config/htop/htoprc": "top/htoprc", "~/.vimrc": "vim/wuman-vimrc/vimrc", "~/.vim/bundle": "vim/wuman-vimrc/bundle", "~/.wgetrc": "wget/wgetrc", - "~/.Xresources": "i3/Xresources" + "~/.Xresources": "i3/Xresources", + "~/.Xdefaults": "sway/Xdefaults", + "~/.config/yay/config.json": "yay/config.json" } }, { diff --git a/sway/Xdefaults b/sway/Xdefaults new file mode 100644 index 0000000..719d22f --- /dev/null +++ b/sway/Xdefaults @@ -0,0 +1,63 @@ +xterm*selectToClipboard: true + +xterm*faceName: Source Code Pro:size=10 +xterm*font: 8x13 +xterm*saveLines: 4096 +xterm*locale: true +xterm*termName: xterm-256color +xterm*borderWidth: 0 +xterm*scrollTtyOutput: false +xterm*scrollKey: true + +XTerm*VT100.AutoWrap: true +xterm*allowWindowOps: true +XTerm*VT100.utf8Title: true + +! http://unix.stackexchange.com/questions/227701/how-to-use-ctrl-insert-to-copy-from-xterm +XTerm*VT100.Translations: #override\n\ + Shift Ctrl v: insert-selection(CLIPBOARD)\n\ + Shift Ctrl c: copy-selection(CLIPBOARD)\n + +! Color definition +#define COLOR_THEME_FG #E0E0E0 +#define COLOR_THEME_BG #080808 + +! Colours stolen from user 'Barrucadu' in the ArchLinux Thread: +! https://bbs.archlinux.org/viewtopic.php?pid=652678#p652678 +#define COLOR_THEME_BLACK #202426 +#define COLOR_THEME_DARK_RED #B80000 +#define COLOR_THEME_DARK_GREEN #04822A +#define COLOR_THEME_DARK_YELLOW #804400 +#define COLOR_THEME_DARK_BLUE #193B6B +#define COLOR_THEME_DARK_MAGENTA #5C3F61 +#define COLOR_THEME_DARK_CYAN #036466 +#define COLOR_THEME_DARK_GREY #555753 + +#define COLOR_THEME_LIGHT_GREY #D7D4D7 +#define COLOR_THEME_LIGHT_RED #E62727 +#define COLOR_THEME_LIGHT_GREEN #23994A +#define COLOR_THEME_LIGHT_YELLOW #D77200 +#define COLOR_THEME_LIGHT_BLUE #547599 +#define COLOR_THEME_LIGHT_MAGENTA #946D90 +#define COLOR_THEME_LIGHT_CYAN #059799 +#define COLOR_THEME_WHITE #EBE8EB + +*color0: COLOR_THEME_BLACK +*color8: COLOR_THEME_DARK_GREY +*color1: COLOR_THEME_DARK_RED +*color9: COLOR_THEME_LIGHT_RED +*color2: COLOR_THEME_DARK_GREEN +*color10: COLOR_THEME_LIGHT_GREEN +*color3: COLOR_THEME_DARK_YELLOW +*color11: COLOR_THEME_LIGHT_YELLOW +*color4: COLOR_THEME_DARK_BLUE +*color12: COLOR_THEME_LIGHT_BLUE +*color5: COLOR_THEME_DARK_MAGENTA +*color13: COLOR_THEME_LIGHT_MAGENTA +*color6: COLOR_THEME_DARK_CYAN +*color14: COLOR_THEME_LIGHT_CYAN +*color7: COLOR_THEME_LIGHT_GREY +*color15: COLOR_THEME_WHITE + +*foreground: COLOR_THEME_FG +*background: COLOR_THEME_BG diff --git a/sway/config b/sway/config new file mode 100644 index 0000000..8d8fa3a --- /dev/null +++ b/sway/config @@ -0,0 +1,297 @@ +set $mod Mod4 +floating_modifier $mod + +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l + +# Your preferred terminal emulator +set $term "alacritty" + +# keyboard layout +input * { + xkb_layout de,us + xkb_variant nodeadkeys + xkb_options caps:escape + xkb_options grp:win_space_toggle + xkb_numlock enabled +} +seat * hide_cursor 10000 + +# outputs +output "LVDS-1" { + position 0,180 + resolution 1600x900 +} + +# background +output * bg #2F343F solid_color +#output * bg wallpaper.png fit + +# startup programs +exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec nm-applet +exec gnome-keyring-daemon --start --components secrets +# mute microfone +exec amixer set Capture nocap +exec swayidle \ + timeout 285 'notify-send -a lockscreen -c lock-warn -u critical -t 100 -i system-lock-screen "Locking Screen" "Will Lock Screen in 15s"' \ + timeout 300 '~/.dotfiles/sway/lock.sh' \ + timeout 600 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' \ + before-sleep '~/.dotfiles/sway/lock.sh' +exec albert +exec QSyncthingTray +exec telegram-desktop -startintray +exec /usr/lib/geoclue-2.0/demos/agent +exec redshift-gtk -m wayland +exec nextcloud +exec feedreader --headless + +# font +font pango:Fira Code 12 + +# default floating +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 [instance="update_installer"] floating enable +# custom floating +for_window [class="Firefox" window_role="About"] floating enable +for_window [class="Nightly" window_role="About"] floating enable +for_window [class="evolution-alarm-notify"] floating enable +assign [title="^pdfpc- presentation"] output right +assign [title="^pdfpc- presenter"] output primary + +# Stick windows to workspaces +assign [app_id="feedreader"] 8 +assign [class="Thunderbird"] 9 +assign [app_id="evolution"] 9 +assign [app_id="rhythmbox"] 10 + +hide_edge_borders both +focus_follows_mouse no + +# to switch workspace-tabs +bindsym $mod+Tab workspace next +bindsym Shift+$mod+Tab workspace prev + +bindsym $mod+m exec keepassxc +bindsym $mod+e exec subl3 +bindsym $mod+w exec firefox +bindsym $mod+u exec feedreader + +# to prevent gnome-help +bindsym F1 exec : + +# ESP8266 +bindsym $mod+F1 exec curl http://esp8266.local/socket0Toggle +bindsym $mod+Shift+F1 exec curl http://esp8266.local/socket0Off +bindsym $mod+F2 exec curl http://esp8266.local/socket1Toggle +bindsym $mod+Shift+F2 exec curl http://esp8266.local/socket1Off + +bindsym $mod+F11 exec curl http://esp8266.local/socket2Toggle +bindsym $mod+Shift+F11 exec curl http://esp8266.local/socket2Off +bindsym $mod+F12 exec curl http://esp8266.local/socket3Toggle +bindsym $mod+Shift+F12 exec curl http://esp8266.local/socket3Off + +# Screenshot +bindsym Print exec "grim ~/Downloads/Screenshot-$(date +'%Y-%m-%d_%H%M%S.png')" +bindsym $mod+Print exec "slurp | grim -g - ~/Downloads/Screenshot-$(date +'%Y-%m-%d_%H%M%S.png')" + + +# forward an backward at arrow-keys +#bindsym --release XF86Back exec +#bindsym --release XF86Forward exec + + +# Sreen brightness controls +bindsym --locked XF86MonBrightnessUp exec brightnessctl set +5% +bindsym --locked XF86MonBrightnessDown exec brightnessctl set -5% + +# Pulse Audio controls +bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle +bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% +bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + +# Microphone +bindsym --locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle +bindsym --locked $mod+XF86AudioRaiseVolume exec pactl set-source-volume @DEFAULT_SOURCE@ +5% +bindsym --locked $mod+XF86AudioLowerVolume exec pactl set-source-volume @DEFAULT_SOURCE@ -5% + +# Media player controls +bindsym --locked XF86AudioPlay exec dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +bindsym --locked XF86AudioPause exec dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +bindsym --locked XF86AudioNext exec dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next +bindsym --locked XF86AudioPrev exec dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous + +# main commands +bindsym $mod+Shift+c reload +bindsym $mod+Shift+r restart +bindsym $mod+Shift+e exit + +# start a terminal +bindsym $mod+Return exec $term + +# screensaver +bindsym $mod+z exec ~/.dotfiles/sway/lock.sh +bindsym $mod+y exec ~/.dotfiles/sway/lock.sh +bindsym Scroll_Lock exec ~/.dotfiles/config/sway/lock.sh + +# start dmenu (a program launcher) +bindsym $mod+d exec albert toggle || albert +bindsym Alt+Space exec albert toggle || albert + +# kill focused window +bindsym $mod+Shift+q kill + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle +bindsym $mod+g fullscreen global + +# change layouts +bindsym $mod+b split h +bindsym $mod+v split v +bindsym $mod+c layout toggle split +#bindsym $mod+z layout stacking +#bindsym $mod+t layout tabbed + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle +#bindsym $mod+space focus mode_toggle +bindsym $mod+space exec setxkbmap de -option ctrl:nocaps +# focus the child container +bindsym $mod+s focus child +# focus the parent container +bindsym $mod+a focus parent + +bindsym Mod1+Left move workspace to output left +bindsym Mod1+Right move workspace to output right +bindsym Mod1+Up move workspace to output up +bindsym Mod1+Down move workspace to output down + +# 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 + +# move windows to workspace and switch to it +bindsym Ctrl+1 move container to workspace 1; workspace 1 +bindsym Ctrl+2 move container to workspace 2; workspace 2 +bindsym Ctrl+3 move container to workspace 3; workspace 3 +bindsym Ctrl+4 move container to workspace 4; workspace 4 +bindsym Ctrl+5 move container to workspace 5; workspace 5 +bindsym Ctrl+6 move container to workspace 6; workspace 6 +bindsym Ctrl+7 move container to workspace 7; workspace 7 +bindsym Ctrl+8 move container to workspace 8; workspace 8 +bindsym Ctrl+9 move container to workspace 9; workspace 9 +# for settings the zoom-level back to default in firefox +#bindsym Ctrl+0 move container to workspace 10; workspace 10 + +bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name: ' + +#FOCUS +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right +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 +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# resize window (you can also use the mouse for that) +mode "resize" { + bindsym $left resize shrink width 10 px or 10 ppt + bindsym $down resize shrink height 10 px or 10 ppt + bindsym $up resize grow height 10 px or 10 ppt + bindsym $right resize grow width 10 px or 10 ppt + + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Up resize grow height 10 px or 10 ppt + bindsym Down resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} +bindsym $mod+r mode "resize" + +mode "passthrough" { + bindsym $mod+Escape mode "default" +} +bindsym $mod+Escape mode "passthrough" + +# colors +set $color_bg #2F343F +set $color_bg_inactive #2F343F +set $color_text #F3F4F5 +set $color_text_inactive #676E7D +set $color_bg_urgent #E53935 +set $color_indicator #00FF00 + +set $color_separator #666666 +set $color_ws #5294E2 +set $color_ws_inactive #2F343F +set $color_ws_text #FFFFFF +set $color_ws_text_inactive #D3DAE3 + +# window colors +# border background text indicator child_border +client.focused $color_bg $color_bg $color_text $color_indicator $color_bg +client.unfocused $color_bg_inactive $color_bg_inactive $color_text_inactive $color_indicator $color_bg +client.focused_inactive $color_bg_inactive $color_bg_inactive $color_text_inactive $color_indicator $color_bg +client.urgent $color_bg_urgent $color_bg_urgent $color_text $color_indicator $color_bg + +bar { + status_command i3status + position top + workspace_buttons yes + colors { + background $color_bg + statusline $color_ws_text_inactive + separator $color_separator + focused_workspace $color_ws $color_ws $color_ws_text + active_workspace $color_ws_inactive $color_ws_inactive $color_ws_text_inactive + inactive_workspace $color_ws_inactive $color_ws_inactive $color_ws_text_inactive + urgent_workspace $color_bg_urgent $color_bg_urgent $color_ws_text + } +} + +include ~/.config/sway/`hostname` +include /etc/sway/config.d/* \ No newline at end of file diff --git a/sway/lock.sh b/sway/lock.sh new file mode 100755 index 0000000..d14e183 --- /dev/null +++ b/sway/lock.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +images=() +swaylock_args=() + +swaylock_args+=(-e) + +for output in $(swaymsg -t get_outputs | jq -r '.[] .name'); do + image=$(mktemp --suffix=.png) + images+=($image) + swaylock_args+=(-i $output:$image) + grim -o $output $image +done + +printf '%s\n' "${images[@]}" | xargs -P 0 -I{} convert -resize 20% -level 0%,100%,0.9 -blur 0x2 -resize 500% {} {} + +physlock -l prevent tty switching +swaylock ${swaylock_args[@]} -s center +physlock -L reenable tty switching +rm ${images[@]} diff --git a/sway/thinkman b/sway/thinkman new file mode 100644 index 0000000..dd45eb9 --- /dev/null +++ b/sway/thinkman @@ -0,0 +1,13 @@ +output "HDMI-A-3" { + position 1600,0 + resolution 1920x1080 + scale 1.0 +} + +input "2:7:SynPS/2_Synaptics_TouchPad" { + dwt enabled + tap enabled + natural_scroll enabled + middle_emulation enabled + scroll_factor 0.5 +} \ No newline at end of file