From a088278bd08124d637d36e98b595415d3b768959 Mon Sep 17 00:00:00 2001 From: coolneng Date: Fri, 6 Mar 2020 00:29:24 +0100 Subject: [PATCH] Create usable Sway config --- .gitignore | 1 + sway/.config/environment.d/envvars.conf | 2 + sway/.config/sway/config | 256 ++++++++++++++++++++++++ waybar/.config/waybar/config | 120 +++++++++++ waybar/.config/waybar/style.css | 166 +++++++++++++++ 5 files changed, 545 insertions(+) create mode 100644 sway/.config/environment.d/envvars.conf create mode 100644 sway/.config/sway/config create mode 100644 waybar/.config/waybar/config create mode 100644 waybar/.config/waybar/style.css diff --git a/.gitignore b/.gitignore index e141e75..483f7c1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ weechat/.weechat/logs weechat/**/*.log weechat/.weechat/script/ +weechat/.weechat/sec.conf neovim/.config/nvim/.netrwhist neovim/.config/nvim/plugged deluge/.config/deluge/state/ diff --git a/sway/.config/environment.d/envvars.conf b/sway/.config/environment.d/envvars.conf new file mode 100644 index 0000000..c2a2447 --- /dev/null +++ b/sway/.config/environment.d/envvars.conf @@ -0,0 +1,2 @@ +MOZ_ENABLE_WAYLAND=1 +GRIM_DEFAULT_DIR=$HOME/Photos/Screenshots diff --git a/sway/.config/sway/config b/sway/.config/sway/config new file mode 100644 index 0000000..dc1c7d1 --- /dev/null +++ b/sway/.config/sway/config @@ -0,0 +1,256 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +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 kitty +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +set $menu /bin/rofi -show drun | xargs swaymsg exec -- + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg /home/coolneng/Photos/Wallpapers/d2a0wsarpmx21.jpg fill +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +### Idle configuration +# +# Example configuration: +# +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * dpms off"' \ +# resume 'swaymsg "output * dpms on"' \ +# before-sleep 'swaylock -f -c 000000' +# +# 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. + +### 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 "es" + + input "1739:29859:Synaptics_TM2985-009" { + dwt enabled + tap enabled + natural_scroll enabled + middle_emulation enabled + } + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+w 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 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 + # 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+t layout tabbed + bindsym $mod+e layout Make toggle + + # split 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 { + swaybar_command waybar +} + +# +# Visual tweaks +# +# Disable title bar +default_border none + +# +# Special keys +# +# Volume +bindsym XF86AudioRaiseVolume exec amixer set Master 5%+ +bindsym XF86AudioLowerVolume exec amixer set Master 5%- +bindsym XF86AudioMute exec amixer set Master toggle +# Brightness +bindsym XF86MonBrightnessUp exec brillo -A 10 +bindsym XF86MonBrightnessDown exec brillo -U 10 +# Media control +bindsym XF86AudioPlay exec mpc toggle +bindsym XF86AudioStop exec mpc stop +bindsym XF86AudioNext exec mpc next +bindsym XF86AudioPrev exec mpc prev + +# +# Program keybindings +# +# clipman +bindsym $mod+c exec clipman pick -t rofi +# grim +bindsym Print exec grim + +# +# Autostart programs +# +# clipman +exec wl-paste -t text --watch clipman store +# tmuxp +exec tmuxp load ~/.tmuxp/local.yaml +# syncthing +exec syncthing -no-browser -home="$HOME/.config/syncthing" + +include /etc/sway/config.d/* diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config new file mode 100644 index 0000000..6515338 --- /dev/null +++ b/waybar/.config/waybar/config @@ -0,0 +1,120 @@ +{ + "layer": "top", // Waybar at top layer + "height": 20, // Waybar height (to be removed for auto height) + "modules-left": ["sway/workspaces"], + "modules-center": ["clock"], + "modules-right": ["mpd", "network", "custom/alsa", "battery"], + // Modules configuration + // "sway/workspaces": { + // "disable-scroll": true, + // "all-outputs": true, + // "format": "{name}: {icon}", + // "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // "5": "", + // "urgent": "", + // "focused": "", + // "default": "" + // } + // }, + "sway/mode": { + "format": "{}" + }, + "mpd": { + "format": "{stateIcon}{title}", + "format-disconnected": "", + "format-stopped": "{stateIcon} ", + "unknown-tag": "N/A", + "interval": 2, + "consume-icons": { + "on": " " + }, + "state-icons": { + "paused": "", + "playing": "" + }, + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + "format": "{:%a %d %b %H:%M}", + "format-alt": "{:%Y-%m-%d}" + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon}{capacity}%", + "format-charging": "{capacity}%", + "format-plugged": "{capacity}%", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", ""] + }, + "battery#bat2": { + "bat": "BAT2" + }, + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{icon}{essid}", + "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "format-icons": ["", "", ""] + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphones": "", + "handsfree": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol" + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "spotify": "", + "default": "🎜" + }, + "escape": true, + "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder + // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + }, + "custom/alsa": { + "exec": "amixer get Master | sed -nre 's/.*\\[off\\].*/muted/p; s/.*\\[(.*%)\\].*/\\1/p'", + "signal": 11, + "interval": 10, + "tooltip": false + } +} diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css new file mode 100644 index 0000000..1257799 --- /dev/null +++ b/waybar/.config/waybar/style.css @@ -0,0 +1,166 @@ +* { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: lime, Siji; + font-size: 10px; + min-height: 0px; +} + +window#waybar { + background-color: #211B29; + color: #D8DEE9; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +/* +window#waybar.termite { +} + +window#waybar.chromium { +} +*/ + +#workspaces button { + padding: 0 5px; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; +} + +#workspaces button.focused { + color: #88C0D0; +} + +#workspaces button.urgent { + color: #88C0D0; +} + +#mode { + color: #88C0D0; +} + +#clock, +#battery, +#cpu, +#memory, +#temperature, +#backlight, +#network, +#pulseaudio, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#mpd { + padding: 0 10px; + margin: 0 4px; + color: #ffffff; +} + +#clock { +} + +#battery { +} + +#battery.charging { + color: #ffffff; +} + +@keyframes blink { + to { + color: #000000; + } +} + +#battery.critical:not(.charging) { + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { +} + +#cpu { +} + +#memory { +} + +#backlight { +} + +#network { +} + +#network.disconnected { +} + +#pulseaudio { + color: #D8DEE9; +} + +#pulseaudio.muted { + color: #D8DEE9; +} + +#custom-media { + color: #D8DEE9; + min-width: 100px; +} + +#custom-media.custom-spotify { +} + +#custom-media.custom-vlc { +} + +#temperature { +} + +#temperature.critical { +} + +#tray { +} + +#idle_inhibitor { +} + +#idle_inhibitor.activated { + color: #D8DEE9; +} + +#mpd { + color: #D8DEE9; +} + +#mpd.disconnected { +} + +#mpd.stopped { +} + +#mpd.paused { +}