rework sway

This commit is contained in:
Marco Thomas
2022-06-27 17:15:17 +02:00
parent ef9a7cd971
commit c1b48254e0
10 changed files with 476 additions and 92 deletions

View File

@@ -9,11 +9,11 @@ It will link all dotfiles to their correct place.
Fallsback are provided in `fallback-fonts/`
SFMono also provides icons.
## notable deps
## 'invisible' deps
### for sway
+ `SwayNotificationCenter`
+ `sworkstyle` (application icons in status bar)
+ `wlogout` (logout menu)
+ `waybar` (cool bar)
+ `SwayNotificationCenter` - default conf
+ `wlogout` (logout menu) - change lock to `~/.local/bin/lock.sh`
+ `bemenu` (dmenu replacement)
+ `slurp`, `grim`, `swappy` (screenshot)

Binary file not shown.

View File

@@ -0,0 +1,49 @@
env:
TERM: alacritty
font:
normal:
family: SFMono Nerd Font
style: Regular
bold:
family: SFMono Nerd Font
style: Bold
italic:
family: SF Mono Nerd Font
style: Italic
size: 11.0
draw_bold_text_with_bright_colors: false
colors:
primary:
background: '0xfdf6e3'
foreground: '0x657B83'
normal:
black: '0x073642'
red: '0xdc322f'
green: '0x859900'
yellow: '0xb58900'
blue: '0x268bd2'
magenta: '0xd33682'
cyan: '0x2aa198'
white: '0xeee8d5'
bright:
black: '0x002b36'
red: '0xcb4b16'
green: '0x586e75'
yellow: '0x657b83'
blue: '0x839496'
magenta: '0x6c71c4'
cyan: '0x93a1a1'
white: '0xfdf6e3'
live_config_reload: true
mouse:
hide_when_typing: true

View File

@@ -1,43 +0,0 @@
#!/bin/bash
date=$(date +'%A, %d. %b')
time=$(date +'%I:%M %p')
battery=$(cat /sys/class/power_supply/BAT1/capacity)
if [ $(cat /sys/class/power_supply/BAT1/status) = 'Discharging' ]; then
bat_rem="▼"
if [ ${battery} -lt 6 ]; then
notify-send -i battery "Battery" "Critical Battery State!\n ${battery}% remaining!"
fi
else
bat_rem="⯅"
fi
if [ $(cat /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode) = '1' ]; then
conservation='capped'
else
conservation='uncapped'
fi
wifi=$(iwgetid -r)
if [ -z "$wifi" ]; then
wifi='no wifi'
fi
powermode=$(cat /sys/firmware/acpi/platform_profile)
cpu_util=$(cat /proc/loadavg | awk '{print $1, $2, $3}')
if [ $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') = 'no' ]; then
audio="$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}')"
else
audio="婢 muted"
fi
light=$(light -G | awk '{print int($1+0.5)'})"%"
sep=" "
echo "${sep}${light} ${sep} ${audio} ${sep}${wifi} ${sep}${powermode}: ${cpu_util} ${sep}${conservation} ${sep}${battery}% ${bat_rem} ${sep}${date} ${sep}${time}"

View File

@@ -31,13 +31,13 @@ set $baseB2 #073642
set $baseB3 #002b36
set $custom #e1cab3
set $bar_bg #ffffffbb
set $bar_bg #323232
# clientclass border backgr. text indicator
client.focused $green $green $baseB3 $blue
client.focused_inactive $baseA2 $baseA2 $baseB2 $violet
client.unfocused $baseA2 $baseA2 $baseB1 $baseA1
client.urgent $yellow $yellow $baseB3 $orange
# clientclass border backgr. text indicator
client.focused $bar_bg $bar_bg #ffffff $bar_bg
client.focused_inactive $bar_bg $bar_bg $baseA1 $violet
client.unfocused $bar_bg $bar_bg $baseA1 $bar_bg
client.urgent $yellow $yellow $baseB3 $orange
# Output configuration
set $laptop eDP-1
@@ -48,13 +48,19 @@ bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
# Idle configuration
# Lock after 20 minutes
# Suspend after 30 minutes
set $lock 'swaylock -f --image /tmp/lock.png --indicator-idle-visible'
# create blurred lock screen
exec_always convert ~/images/wallpaper/wallpaper.png -blur 0x8 /tmp/lock.png
# set lockc and save to script, so other programs can also use it
set $lock 'swaylock -f --image /tmp/lock.png --indicator-idle-visible'
exec_always echo $lock > ~/.local/bin/lock.sh
exec_always chmod +x ~/.local/bin/lock.sh
# Lock after 20 minutes
# Suspend after 22 minutes
exec swayidle -w \
timeout 1200 $lock \
timeout 1800 'systemctl suspend' \
timeout 1320 'systemctl suspend' \
before-sleep $lock
# Input configuration
@@ -72,7 +78,7 @@ input type:keyboard {
# Key bindings
# Basics:
# Terminal
bindsym $mod+Return exec gnome-terminal
bindsym $mod+Return exec alacritty
# Kill focused window
bindsym $mod+Shift+Backspace kill
@@ -162,6 +168,14 @@ input type:keyboard {
# Layout stuff:
workspace_layout stacking
title_align center
default_border none
default_floating_border none
# hide title and border, if only one application open
hide_edge_borders --i3 smart
gaps inner 5
smart_gaps on
# Make the current focus fullscreen
bindsym $mod+f fullscreen
@@ -176,12 +190,6 @@ input type:keyboard {
bindsym $mod+space focus mode_toggle
# Window rules
title_align center
default_border none
titlebar_border_thickness 0
gaps inner 0
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] kill
for_window [app_id="firefox"] move container to workspace number $ws2
for_window [class="discord"] move container to workspace number $ws3
@@ -196,31 +204,15 @@ input type:keyboard {
bar {
position top
tray_output none
status_command while ~/.config/sway/bar.sh; do sleep 1; done
colors {
separator $blue
# background $baseA3
background $bar_bg
statusline $baseB2
# workclass border backgr. text
focused_workspace $green $green $baseB3
active_workspace $bar_bg $bar_bg $baseB1
inactive_workspace $bar_bg $bar_bg $baseB1
urgent_workspace $orange $orange $baseB3
}
swaybar_command waybar
}
# Startup programs
exec syncthing
exec swaync
exec fcitx5
exec sworkstyle &> /tmp/sworkstyle.log
# generate a lock screen
exec convert ~/images/wallpaper/wallpaper.png -blur 0x8 /tmp/lock.png
exec nm-applet --indicator
exec blueman-applet
# Include some defaults
include /etc/sway/config.d/*

View File

@@ -4,7 +4,7 @@
# set default terminal
set -g default-terminal "tmux-256color"
# enable true color terminal
set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides ",*256col*:Tc,alacritty:Tc"
# new panes (open with current path)
bind-key -n M-v split-window -h -c "#{pane_current_path}"
@@ -51,9 +51,32 @@ set -g base-index 1
setw -g pane-base-index 1
# some styling
set -g status-bg white
set -g window-status-current-style "underscore, bold"
set -g window-status-current-format "#I:#W"
set -g window-status-format "#I:#W"
set -g status-left " "
set -g status-right "#S @ #h - %I:%M %p "
#set -g status-bg white
#set -g window-status-current-style "underscore, bold"
#set -g window-status-current-format "#I:#W"
#set -g window-status-format "#I:#W"
#set -g status-left " "
#set -g status-right "#S @ #h - %I:%M %p "
set -g status-position top
set -g pane-border-lines heavy
# generated, using https://github.com/edkolev/tmuxline.vim
set -g status-justify "left"
set -g status "on"
set -g status-left-style "none"
set -g message-command-style "fg=colour7,bg=colour14"
set -g status-right-style "none"
set -g pane-active-border-style "fg=colour11"
set -g status-style "none,bg=colour7"
set -g message-style "fg=colour7,bg=colour14"
set -g pane-border-style "fg=colour14"
set -g status-right-length "100"
set -g status-left-length "100"
setw -g window-status-activity-style "none"
setw -g window-status-separator ""
setw -g window-status-style "none,fg=colour14,bg=colour7"
set -g status-left "#[fg=colour7,bg=colour11,bold] #S #[fg=colour11,bg=colour7,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=colour14,bg=colour7,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour14] %Y-%m-%d  %H:%M #[fg=colour11,bg=colour14,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour11] #h "
setw -g window-status-format "#[fg=colour14,bg=colour7] #I #[fg=colour14,bg=colour7] #W "
setw -g window-status-current-format "#[fg=colour7,bg=colour14,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour14] #I #[fg=colour7,bg=colour14] #W #[fg=colour14,bg=colour7,nobold,nounderscore,noitalics]"

View File

@@ -0,0 +1,167 @@
// =============================================================================
//
// Waybar configuration
//
// Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
//
// =============================================================================
{
// -------------------------------------------------------------------------
// Global configuration
// -------------------------------------------------------------------------
"layer": "bottom",
"position": "top",
// If height property would be not present, it'd be calculated dynamically
"height": 30,
"modules-left": [
"sway/workspaces"
],
"modules-center": [
"sway/window"
],
"modules-right": [
"battery",
"pulseaudio",
"clock#date",
"clock#time",
"tray"
],
// -------------------------------------------------------------------------
// Modules
// -------------------------------------------------------------------------
"battery": {
"interval": 10,
"states": {
"warning": 30,
"critical": 15
},
// Connected to AC
"format": " {icon} {capacity}%", // Icon: bolt
// Not connected to AC
"format-discharging": "{icon} {capacity}%",
"format-icons": [
"", // Icon: battery-full
"", // Icon: battery-three-quarters
"", // Icon: battery-half
"", // Icon: battery-quarter
"" // Icon: battery-empty
],
"tooltip": true
},
"clock#time": {
"interval": 5,
"format": "{:%I:%M %p}",
"tooltip": false
},
"clock#date": {
"interval": 10,
"format": " {:%a, %e %b}", // Icon: calendar-alt
"tooltip-format": "{:%A, %e %B %Y}"
},
"cpu": {
"interval": 5,
"format": " {load}", // Icon: microchip
"states": {
"warning": 70,
"critical": 90
}
},
"custom/keyboard-layout": {
"exec": "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4",
// Interval set only as a fallback, as the value is updated by signal
"interval": 30,
"format": " {}", // Icon: keyboard
// Signal sent by Sway key binding (~/.config/sway/key-bindings)
"signal": 1, // SIGHUP
"tooltip": false
},
"memory": {
"interval": 5,
"format": " {percentage}% ({used:0.1f})", // Icon: memory
"states": {
"warning": 70,
"critical": 90
}
},
"network": {
"interval": 5,
"format-wifi": " {essid} ({signalStrength}%)", // Icon: wifi
"format-ethernet": " {ifname}: {ipaddr}/{cidr}", // Icon: ethernet
"format-disconnected": "⚠ Disconnected",
"tooltip-format": "{ifname}: {ipaddr}"
},
"sway/window": {
"format": "{}",
"max-length": 120
},
"sway/workspaces": {
"all-outputs": false,
"disable-scroll": false,
"format": "{icon} {name}",
"format-icons": {
"1": "",
"2": "",
"3": "‭ﭮ‬",
"4": "",
"5": "",
"8": "",
"9": "",
"urgent": "",
"focused": "",
"default": ""
}
},
"pulseaudio": {
//"scroll-step": 1,
"format": "{icon} {volume}%",
"format-bluetooth": "{icon} {volume}% ",
"format-muted": " Muted",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
},
"temperature": {
"critical-threshold": 80,
"interval": 5,
"format": "{icon} {temperatureC}°C",
"format-icons": [
"", // Icon: temperature-empty
"", // Icon: temperature-quarter
"", // Icon: temperature-half
"", // Icon: temperature-three-quarters
"" // Icon: temperature-full
],
"tooltip": true
},
"tray": {
"icon-size": 18,
"spacing": 10
}
}

View File

@@ -0,0 +1,193 @@
/* =============================================================================
*
* Waybar configuration
*
* Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
*
* =========================================================================== */
/* -----------------------------------------------------------------------------
* Keyframes
* -------------------------------------------------------------------------- */
@keyframes blink-warning {
70% {
color: white;
}
to {
color: white;
background-color: orange;
}
}
@keyframes blink-critical {
70% {
color: white;
}
to {
color: white;
background-color: red;
}
}
/* -----------------------------------------------------------------------------
* Base styles
* -------------------------------------------------------------------------- */
/* Reset all styles */
* {
border: none;
border-radius: 0;
min-height: 0;
margin: 0;
padding: 0;
}
/* The whole bar */
#waybar {
background: #323232;
color: white;
font-family: SFMono Nerd Font;
font-size: 13px;
}
/* Each module */
#battery,
#clock,
#cpu,
#custom-keyboard-layout,
#memory,
#mode,
#network,
#pulseaudio,
#temperature,
#tray {
padding-left: 10px;
padding-right: 10px;
}
/* -----------------------------------------------------------------------------
* Module styles
* -------------------------------------------------------------------------- */
#battery {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#battery.warning {
color: orange;
}
#battery.critical {
color: red;
}
#battery.warning.discharging {
animation-name: blink-warning;
animation-duration: 3s;
}
#battery.critical.discharging {
animation-name: blink-critical;
animation-duration: 2s;
}
#clock {
font-weight: bold;
}
#cpu {
/* No styles */
}
#cpu.warning {
color: orange;
}
#cpu.critical {
color: red;
}
#memory {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#memory.warning {
color: orange;
}
#memory.critical {
color: red;
animation-name: blink-critical;
animation-duration: 2s;
}
#mode {
background: #64727D;
border-top: 2px solid white;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
}
#network {
/* No styles */
}
#network.disconnected {
color: orange;
}
#pulseaudio {
/* No styles */
}
#pulseaudio.muted {
/* No styles */
}
#custom-spotify {
color: rgb(102, 220, 105);
}
#temperature {
/* No styles */
}
#temperature.critical {
color: red;
}
#tray {
/* No styles */
}
#window {
/* font-weight: bold; */
}
#workspaces button {
border-top: 2px solid transparent;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
color: #888888;
}
#workspaces button.focused {
color: white;
background-color: #859900;
}
#workspaces button.urgent {
border-color: #c9545d;
color: #c9545d;
}

View File

@@ -67,7 +67,7 @@ ocr() {
ocrmypdf -l deu+eng+jpn --output-type pdf $1 OCR_$1
}
conservationmode() {
conservation() {
location='/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode'
if [ -z $1 ]; then
cat $location
@@ -78,7 +78,7 @@ conservationmode() {
fi
}
powermode() {
power() {
location='/sys/firmware/acpi/platform_profile'
if [ -z $1 ]; then
echo "Current:" $(cat $location)

View File

@@ -29,6 +29,9 @@
\usepackage{enumerate}
\usepackage{enumitem}
\setlist{nosep}
\setlist[enumerate, 1]{label=$\bullet$}
\setlist[enumerate, 2]{label=$\bullet$}
\setlist[enumerate, 3]{label=$\bullet$}
%%% cleaner newline indentation
\usepackage[parfill]{parskip}