From 6f5a491adc9d5f30577fa9c82f572604f59ade0b Mon Sep 17 00:00:00 2001 From: Johannes Rothe Date: Wed, 14 Sep 2022 19:38:22 +0200 Subject: [PATCH] Add sway configs --- roles/dotfiles/files/foot.ini | 169 +++++++++++++++++++++ roles/dotfiles/files/kanshi_config | 8 + roles/dotfiles/files/sway_config | 229 +++++++++++++++++++++++++++++ roles/dotfiles/tasks/main.yml | 28 +++- 4 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 roles/dotfiles/files/foot.ini create mode 100644 roles/dotfiles/files/kanshi_config create mode 100644 roles/dotfiles/files/sway_config diff --git a/roles/dotfiles/files/foot.ini b/roles/dotfiles/files/foot.ini new file mode 100644 index 0000000..5326aca --- /dev/null +++ b/roles/dotfiles/files/foot.ini @@ -0,0 +1,169 @@ +# -*- conf -*- + +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot (or xterm-256color if built with -Dterminfo=disabled) +# login-shell=no + +# app-id=foot +# title=foot +# locked-title=no +font=Roboto Mono:size=9 +# font-bold= +# font-italic= +# font-bold-italic= +# line-height= +# letter-spacing=0 +# horizontal-letter-offset=0 +# vertical-letter-offset=0 +# underline-offset= +# box-drawings-uses-font-glyphs=no +dpi-aware=auto + +# initial-window-size-pixels=700x500 # Or, +# initial-window-size-chars= +# initial-window-mode=windowed +# pad=2x2 # optionally append 'center' +# resize-delay-ms=100 + +# notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body} + +# bold-text-in-bright=no +# word-delimiters=,│`|:"'()[]{}<> +# selection-target=primary +# workers= + +[environment] +# name=value + +[bell] +# urgent=no +# notify=no +# command= +# command-focused=no + +[scrollback] +# lines=1000 +# multiplier=3.0 +# indicator-position=relative +# indicator-format= + +[url] +# launch=xdg-open ${url} +# label-letters=sadfjklewcmpgh +# osc8-underline=url-mode +# protocols=http, https, ftp, ftps, file, gemini, gopher +# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[] + +[cursor] +# style=block +# color= +# blink=no +# beam-thickness=1.5 +# underline-thickness= + +[mouse] +# hide-when-typing=no +# alternate-scroll-mode=yes + +[colors] +foreground=dbdee9 +background=0e1420 +regular0=5b6272 +regular1=bf616a +regular2=a3be8c +regular3=ebcb8b +regular4=81a1c1 +regular5=b48ead +regular6=88c0d0 +regular7=e5e9f0 +bright0=4c566a +bright1=bf616a +bright2=a3be8c +bright3=ebcb8b +bright4=81a1c1 +bright5=b48ead +bright6=8fbcbb +bright7=eceff4 +[csd] +# preferred=server +# size=26 +# font= +# color= +# hide-when-typing=no +# border-width=0 +# border-color= +# button-width=26 +# button-color= +# button-minimize-color= +# button-maximize-color= +# button-close-color= + +[key-bindings] +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# clipboard-copy=Control+Shift+c XF86Copy +# clipboard-paste=Control+Shift+v XF86Paste +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none +# show-urls-launch=Control+Shift+u +# show-urls-copy=none +# show-urls-persistent=none +# prompt-prev=Control+Shift+z +# prompt-next=Control+Shift+x +# unicode-input=none +# noop=none + +[search-bindings] +# cancel=Control+g Control+c Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+w +# clipboard-paste=Control+v Control+Shift+v Control+y XF86Paste +# primary-paste=Shift+Insert +# unicode-input=none + +[url-bindings] +# cancel=Control+g Control+c Control+d Escape +# toggle-url-visible=t + +[text-bindings] +# \x03=Mod4+c # Map Super+c -> Ctrl+c + +[mouse-bindings] +# selection-override-modifiers=Shift +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 + +# vim: ft=dosini diff --git a/roles/dotfiles/files/kanshi_config b/roles/dotfiles/files/kanshi_config new file mode 100644 index 0000000..5e4615b --- /dev/null +++ b/roles/dotfiles/files/kanshi_config @@ -0,0 +1,8 @@ +profile { + output eDP-1 disable + output HDMI-A-2 enable +} + +profile { + output eDP-1 enable +} diff --git a/roles/dotfiles/files/sway_config b/roles/dotfiles/files/sway_config new file mode 100644 index 0000000..9616499 --- /dev/null +++ b/roles/dotfiles/files/sway_config @@ -0,0 +1,229 @@ +# swayidle -> configure idle timers +# kanshi -> automatic display selection +# grimshot -> screnshots +# foot -> terminal +# swaylock -> lock screen +# dmenu +# i3status +# mako-notifier -> notifications +# gammastep -> redshift +# wl-clipboard -> copy stuff +# wdisplays -> interactive display configuration + +set $mod Mod4 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term foot +set $menu dmenu_path | dmenu | xargs swaymsg exec -- +set $wallpaper ~/pictures/wallpaper/voxel-city-by-huntingfluff.jpg + +# screenshot +bindsym --release Print exec grimshot copy area +# lock +bindsym Mod1+l exec swaylock -f -i $wallpaper -s fill +# dynamic monitor configuration, see ~/.config/kanshi/config, get outputs with swaymsg -t get_outputs +exec_always "pkill kanshi; kanshi" +# titlebars +default_border pixel +default_floating_border pixel +hide_edge_borders smart +titlebar_padding 5 1 +# notifications +exec_always "pkill mako; mako --ignore-timeout=1 --default-timeout=5000" +# redshift +exec gammastep -l50.81:6.37 +# Fix for slow application startup +# https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start +exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK + + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg $wallpaper fill + +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. +exec swayidle -w \ + timeout 1800 'swaylock -f -c 000000' \ + timeout 3600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ + before-sleep 'swaylock -f -c 000000' + +### Input configuration +# +# Example configuration: +# +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. +input * { + xkb_layout "de" +} + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $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+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' +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + 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 + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 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 $mod+minus 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 + + # 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" + +# +# 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 while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done + status_command i3status + + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } +} diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index 1bf099c..abf5c53 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -11,17 +11,24 @@ - bat - black # code formatting - bsdmainutils # ncal calendar + - dmenu - feh # set background - fish - flameshot - fonts-roboto + - foot - fzf + - gammastep + - grimshot - htop - hsetroot - ispell - i3 - i3lock-fancy + - i3status + - kanshi - keychain + - mako-notifier - pass - python3-pylint-common - pulseaudio-utils # pactl volume control @@ -29,9 +36,14 @@ - rofi # dmenu replacement - scrot # screenshot - shellcheck + - sway + - swayidle + - swaylock - tmux - vim - vim-nox + - wdisplays + - wl-clipboard state: present cache_valid_time: 3600 @@ -49,7 +61,7 @@ - name: Backup stuff copy: src: '{{ item }}' - dest: '{{ home }}/tmp/dotfiles_backup' + dest: '/tmp/dotfiles_backup' remote_src: True # copy the folder from the host instead of ansible mode: 0755 ignore_errors: yes @@ -62,9 +74,12 @@ - '{{ home }}/.ssh/config' - '{{ home }}/.config/i3/config' - '{{ home }}/.config/i3status/config' - - '{{ home }}/.config/rofi/config' + - '{{ home }}/.config/rofi/config.rasi' + - '{{ home }}/.config/kanshi/config' + - '{{ home }}/.config/foot/foot.ini' - '{{ home }}/.gitconfig' - '{{ home }}/.gnupg/gpg-agent.conf' + - '{{ home }}/.sway/config' - name: Make sure folders exist file: @@ -76,9 +91,12 @@ - '{{ home }}/.config/i3status/' - '{{ home }}/.config/rofi/' - '{{ home }}/.config/tmux/' + - '{{ home }}/.config/kanshi/' + - '{{ home }}/.config/foot/' - '{{ home }}/.ssh/' - '{{ home }}/pictures/shots/' - '{{ home }}/.gnupg/' + - '{{ home }}/.sway/' - name: Link files file: @@ -107,3 +125,9 @@ dest: '{{ home }}/.gitconfig' - src: '{{ files_dir }}/gpg-agent.conf' dest: '{{ home }}/.gnupg/gpg-agent.conf' + - src: '{{ files_dir }}/sway_config' + dest: '{{ home }}/.sway/config' + - src: '{{ files_dir }}/kanshi_config' + dest: '{{ home }}/.config/kanshi/config' + - src: '{{ files_dir }}/foot.ini' + dest: '{{ home }}/.config/foot/foot.ini'