From d17c0364f1053cf8080a6e8d6438a1d43fc42532 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 19 Jul 2024 12:11:38 +0200 Subject: [sway+i3] pactl and other config adjustments --- .config/i3/config | 18 ++++---- .config/sway/bin/workspace-add | 14 +++++++ .config/sway/config | 8 ++-- .config/waybar/config | 18 ++++---- .config/waybar/style.css | 74 ++++++++++++++++++++++----------- .config/yadm/scripts/bootstrap/packages | 2 +- 6 files changed, 90 insertions(+), 44 deletions(-) create mode 100755 .config/sway/bin/workspace-add diff --git a/.config/i3/config b/.config/i3/config index 7142b96..13ad3d3 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -44,15 +44,19 @@ exec --no-startup-id nm-applet exec --no-startup-id picom -b --no-fading-openclose --fade-in-step=1.0 --fade-out-step=1.0 --fade-delta=0 --shadow-opacity=0.0 --inactive-opacity=1.0 +exec --no-startup-id unclutter + # gnome-keyring exec --no-startup-id nm-applet dbus-update-activation-environment --all -# Use pactl to adjust volume in PulseAudio. +# Use amixer to adjust volume in ALSA. set $refresh_i3status killall -SIGUSR1 i3status -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status +# bindsym XF86AudioMute exec amixer set Master toggle && $refresh_i3status +# bindsym XF86AudioLowerVolume exec amixer set Master 5%- && $refresh_i3status +# bindsym XF86AudioRaiseVolume exec amixer set Master 5%+ && $refresh_i3status +bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -3% && $refresh_i3status +bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +3% && $refresh_i3status # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod @@ -251,8 +255,8 @@ bar { background #00000055 separator #ffffff99 focused_workspace #ffffff99 #000000 #ffffff - active_workspace #ffffff55 #33333399 #ffffff - inactive_workspace #33333399 #33333399 #ffffff + active_workspace #33333399 #33333399 #ffffff + inactive_workspace #55555599 #55555599 #ffffff } } diff --git a/.config/sway/bin/workspace-add b/.config/sway/bin/workspace-add new file mode 100755 index 0000000..42c9e7b --- /dev/null +++ b/.config/sway/bin/workspace-add @@ -0,0 +1,14 @@ +#!/bin/zsh + +CUR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | sort_by(.num) | map(.num) | .[]') + +previous=0 +while IFS= read -r n; do + if (( n != previous + 1 )) ; then + NEW_WORKSPACE=$(( previous + 1 )) + break + fi + previous=$n +done <<< "$CUR_WORKSPACE" + +swaymsg workspace number $NEW_WORKSPACE diff --git a/.config/sway/config b/.config/sway/config index c6ec2ba..f9ebe17 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -119,9 +119,9 @@ include $HOME/.config/sway/input # Audio # - bindsym XF86AudioMute exec amixer set Master toggle - bindsym XF86AudioLowerVolume exec amixer set Master 5%- - bindsym XF86AudioRaiseVolume exec amixer set Master 5%+ + bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -3% + bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +3% # # Screenshot @@ -202,6 +202,8 @@ include $HOME/.config/sway/input bindsym $mod+Shift+Alt+0 move container to workspace number 20 # Note: workspaces can have any name you want, not just numbers. # We just use 1-10 as the default. + + bindsym Alt+Return exec $HOME/.config/sway/bin/workspace-add # # Layout stuff: # diff --git a/.config/waybar/config b/.config/waybar/config index f659a30..13eeadc 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -1,8 +1,8 @@ { "layer": "top", - "modules-left": ["sway/workspaces", "sway/mode"], + "modules-left": ["sway/workspaces", "custom/workspace-add", "sway/mode"], "modules-center": ["sway/window"], - "modules-right": ["tray", "custom/alsa", "network", "clock"], + "modules-right": ["tray", "pulseaudio", "network", "clock"], "sway/workspaces": { "format": "{icon}", "format-icons": { @@ -28,6 +28,10 @@ "20": "二十" } }, + "custom/workspace-add": { + "exec": "echo '+'", + "on-click": "~/.config/sway/bin/workspace-add" + }, "sway/window": { "max-length": 100, "icon": true, @@ -36,13 +40,9 @@ "tray": { "show-passive-items": true }, - "custom/alsa": { - "exec": "amixer get Master | grep '%' | awk -F '[][]' '{print $2}'", - //"exec-if": "alsactl monitor", - "format": "V {}", - "on-scroll-up": "amixer set Master 1%+", - "on-scroll-down": "amixer set Master 1%-", - "interval": 1 + "pulseaudio": { + "format": "V {volume}%", + "on-click-right": "pavucontrol" }, "network": { "format": "{ipaddr}", diff --git a/.config/waybar/style.css b/.config/waybar/style.css index d121dce..81a05be 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -4,34 +4,66 @@ font-size: 0.9rem; } + + widget button { padding: 0; border: none; color: inherit; } -#workspaces { - border: 1px solid rgba(255, 255, 255, 0.25); + + +.modules-center { + padding: 5px 0; +} + + + +.modules-right label, +.modules-right box { + padding: 0 10px; +} + +.modules-right widget:nth-child(odd) label, +.modules-right widget:nth-child(odd) box { + background: rgba(255, 255, 255, 0.2); } + +.modules-right widget:nth-child(even) label, +.modules-right widget:nth-child(even) box { + background: rgba(255, 255, 255, 0.25); +} + + + #workspaces button { color: #fff; - padding: 0; + padding: 0 0.35rem; border-radius: 0; min-height: 0; - min-width: 25px; - font-size: 0.75rem; + font-size: 0.7rem; + background: rgba(85, 85, 85, 0.5); + border: 0.5px solid transparent; +} + +#workspaces button.visible { + background: rgba(51, 51, 51, 0.5); } -#workspaces button.focused { + +#workspaces button.visible.focused { background: rgba(0, 0, 0, 0.8); + border-top-color: #fff; } + #workspaces button:hover { box-shadow: none; - border: inherit; + border-color: #fff; + border-width: 0.5px; background: inherit; + font-weight: inherit; } -#workspaces button + button { - border-left: 1px solid rgba(255, 255, 255, 0.25); -} + #mode { border-bottom: 1px solid #fff; @@ -40,23 +72,17 @@ widget button { padding: 0 5px; } -.modules-center { - padding: 5px 0; -} -.modules-right label, -.modules-right box { - padding: 0 10px; -} -.modules-right widget:nth-child(odd) label, -.modules-right widget:nth-child(odd) box { - background: rgba(255, 255, 255, 0.2); -} -.modules-right widget:nth-child(even) label, -.modules-right widget:nth-child(even) box { - background: rgba(255, 255, 255, 0.25); +#custom-workspace-add { + padding: 0 0.5rem; } + #tray widget + widget image { margin-left: 5px; } + + +#pulseaudio.muted { + text-decoration: line-through; +} diff --git a/.config/yadm/scripts/bootstrap/packages b/.config/yadm/scripts/bootstrap/packages index 679ffce..4930b7a 100755 --- a/.config/yadm/scripts/bootstrap/packages +++ b/.config/yadm/scripts/bootstrap/packages @@ -53,7 +53,7 @@ $(dirname $BASH_SOURCE)/gammastep/bootstrap sudo pacman -Sy \ xorg-xwayland \ i3-wm i3status xorg-xinit xorg-server xclip \ - picom feh rofi scrot redshift gnome-keyring \ + picom feh rofi scrot redshift unclutter gnome-keyring \ xdotool $(dirname $BASH_SOURCE)/nix/bootstrap -- cgit v1.2.3