Archived
1
0
Fork 0

all: Add config files for sway desktop

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2022-12-26 21:11:15 +01:00
parent 76c7c9757c
commit b2c178f263
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF
13 changed files with 419 additions and 1 deletions

1
mako/config Normal file
View file

@ -0,0 +1 @@
default-timeout=5000

166
sway/config Normal file
View file

@ -0,0 +1,166 @@
set $mod Mod4
set $left d
set $down h
set $up t
set $right n
set $term alacritty
set $menu wofi --show drun --insensitive | xargs swaymsg exec --
set $swayexit 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'
set $vienna_lat 48.2
set $vienna_long 16.4
set $wlsunset wlsunset -l $vienna_lat -L $vienna_long -t 2500
output * background ~/.config/sway/background.png fill #5fb2d0
# Idle/screenlock
exec swayidle -w \
timeout 300 swaylock \
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep swaylock
# Display temperature
exec $wlsunset
# Inputs
input "type:touchpad" {
dwt enabled
tap enabled
natural_scroll enabled
}
input "type:keyboard" {
xkb_layout us,at
xkb_options grp:alt_space_toggle,caps:escape
repeat_delay 250
repeat_rate 35
}
# Layout
gaps outer 2
gaps inner 10
default_border none
# Key bindings
bindsym $mod+Return exec $term
bindsym $mod+space exec $menu
bindsym $mod+Shift+e exec $swayexit
# Kill focused window
bindsym $mod+Shift+q kill
# Reload the configuration file
bindsym $mod+Shift+c reload
bindsym $mod+w exec pgrep wlsunset || $wlsunset
bindsym $mod+Shift+w exec pkill wlsunse
# 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
# Movement
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 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
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
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
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
# Switch the current container between different layout styles
bindsym $mod+s layout toggle stacking tabbed split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+g floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+g focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
# Scratchpad:
# 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
# Media
bindsym XF86AudioRaiseVolume exec ~/.config/sway/helpers/set-sink-volume.sh +5%
bindsym XF86AudioLowerVolume exec ~/.config/sway/helpers/set-sink-volume.sh -5%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#
# Resizing containers:
#
mode "resize" {
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
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"
bar {
swaybar_command waybar
}
include /etc/sway/config.d/*
include ~/.config/sway/config.d/`hostname`

View file

@ -0,0 +1,3 @@
input "type:keyboard" {
xkb_layout us(dvorak),at
}

View file

@ -0,0 +1,11 @@
workspace 1 output DP-1
workspace 2 output DP-1
workspace 3 output DP-1
workspace 4 output DP-1
workspace 5 output DP-1
workspace 6 output DP-2
workspace 7 output DP-2
workspace 8 output DP-2
workspace 9 output DP-2
workspace 10 output DP-2

23
sway/helpers/set-sink-volume.sh Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env sh
MAX_VOLUME=100
default_sink="$(pactl get-default-sink)"
IFS=$'\n'
channels=($(pactl -f json list sinks | \
jq -r ".[] | select(.name == \"$default_sink\") | .volume[].value_percent | sub(\"%\"; \"\")"))
# Calculate max of all channels
volume=$(echo $channels | awk '{max=0; for(i=1;i<=NF;i++) if($i>max) max=$i; print max;}')
# Add the passed inc-/decrement
volume=$(( $volume ${1::1} ${1:1:-1} ))
# Clamp to positive value
volume=$(( $volume < 0 ? 0 : $volume ))
# Clamp to max volume
volume=$(( $volume > $MAX_VOLUME ? $MAX_VOLUME : $volume ))
exec pactl set-sink-volume "$default_sink" $volume%

14
sway/run.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env sh
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland-egl
export CLUTTER_BACKEND=wayland
export ECORE_EVAS_ENGINE=wayland-egl
export ELM_ENGINE=wayland_egl
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export NO_AT_BRIDGE=1
[ -n "$SSH_AGENT_PID" ] || eval "$(ssh-agent -s)"
exec systemd-cat sway

5
swaylock/config Normal file
View file

@ -0,0 +1,5 @@
daemonize
ignore-empty-password
image=~/.config/swaylock/background.png
scaling=fill
show-keyboard-layout

View file

@ -11,10 +11,14 @@ $RSYNC $HOME/.gitconfig gitconfig
$RSYNC $HOME/.latexmkrc latexmkrc
$RSYNC $HOME/.zshrc zshrc
for d in alacritty; do
for d in alacritty waybar mako wofi; do
$RSYNC $HOME/.config/$d .
done
for d in sway swaylock; do
$RSYNC --exclude background.png $HOME/.config/$d .
done
$RSYNC --exclude plugins $HOME/.config/tmux .
$RSYNC \

73
waybar/config Normal file
View file

@ -0,0 +1,73 @@
{
"position": "top",
"modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": [],
"modules-right": ["tray", "custom/spotify", "backlight", "pulseaudio", "network", "battery", "idle_inhibitor", "sway/language", "clock"],
"sway/mode": {
"format": " {}"
},
"sway/workspaces": {
"format": "{name}",
"disable-scroll": true
},
"clock": {
"format": "{:%a %d %b %H:%M}",
"tooltip": false
},
"battery": {
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"format-charging": "{capacity}% ",
"interval": 10,
"states": {
"warning": 20,
"critical": 10
}
},
"network": {
"format": "{icon}",
"format-disconnected": "",
"format-icons": {
"wifi": "",
"ethernet": "",
},
"tooltip-format": "{ifname}: {ipaddr}/{cidr} via {gwaddr}",
"tooltip-format-wifi": "{ifname}: {ipaddr}/{cidr} via {gwaddr}\nAP: {essid} ({signalStrength}%"
},
"pulseaudio": {
"format": "{volume}% {icon}",
"format-muted": "",
"format-icons": {
"phone": [" ", " ", " ", " "],
"default": ["", "", ""]
},
"scroll-step": 10,
"on-click": "pavucontrol",
"tooltip": false
},
"custom/spotify": {
"interval": 1,
"return-type": "json",
"exec": "~/.config/waybar/modules/spotify.sh",
"exec-if": "pgrep spotify",
"escape": true
},
"backlight": {
"format": "{percent}% {icon}",
"format-icons": [""]
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
},
"tooltip": false
},
"sway/language": {
"tooltip-format": "{long}"
},
"tray": {
"icon-size": 18
}
}

18
waybar/modules/spotify.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env sh
class=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
icon=""
if [[ $class == "playing" ]]; then
info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}')
if [[ ${#info} > 40 ]]; then
info=$(echo $info | cut -c1-40)"..."
fi
text=$info" "$icon
elif [[ $class == "paused" ]]; then
text=$icon
elif [[ $class == "stopped" ]]; then
text=""
fi
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"

58
waybar/style.css Normal file
View file

@ -0,0 +1,58 @@
* {
border: none;
border-radius: 0;
font-family: "Source Code Pro", "Font Awesome 6 Free Solid";
font-size: 15px;
box-shadow: none;
text-shadow: none;
transition-duration: 0s;
}
window {
color: rgba(217, 216, 216, 1);
background: rgba(35, 31, 32, 0.8);
}
#workspaces {
margin: 0 5px;
}
#workspaces button {
padding: 0 5px;
color: rgba(217, 216, 216, 0.4);
}
#workspaces button.visible {
color: rgba(217, 216, 216, 1);
}
#workspaces button.focused {
border-top: 3px solid rgba(217, 216, 216, 1);
}
#workspaces button:hover {
background: rgba(167, 171, 176, 0.6);
color: rgba(255, 255, 255, 1);
}
#workspaces button.urgent {
color: rgba(238, 46, 36, 1);
}
#mode, #battery, #cpu, #memory, #network, #pulseaudio, #idle_inhibitor, #backlight, #custom-spotify {
margin: 0px 6px 0px 10px;
min-width: 25px;
}
#clock {
margin: 0px 16px 0px 10px;
min-width: 140px;
}
#battery.warning {
color: rgba(255, 210, 4, 1);
}
#battery.critical {
color: rgba(238, 46, 36, 1);
}

1
wofi/config Normal file
View file

@ -0,0 +1 @@
drun-print_command=true

41
wofi/style.css Normal file
View file

@ -0,0 +1,41 @@
/* Based on https://github.com/sachahjkl/wofi-arc-dark */
*{
font-family: monospace;
}
window {
background-color: #7c818c;
}
#input {
margin: 5px;
border-radius: 0px;
border: none;
border-bottom: 3px solid black;
background-color: #383c4a;
color: white;
}
#inner-box {
background-color: #383C4A;
}
#outer-box {
margin: 5px;
padding:20px;
background-color: #383C4A;
}
#text {
padding: 5px;
color: white;
}
#entry:nth-child(even){
background-color: #404552;
}
#entry:selected {
background-color: #5291e2;
}