sway: tweak lock and bar

This commit is contained in:
2024-08-01 23:38:55 +02:00
parent c6ab0cad8f
commit 2c6fb03012
7 changed files with 85 additions and 79 deletions

View File

@@ -14,10 +14,10 @@
workspace_layout tabbed
smart_borders on
set $lock swaylock -i ~/cloud/images/wallpaper/lock.png -s center -u
set $lock swaylock -f -c 3D484D
exec swayidle -w \
timeout 600 '$lock' \
timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
timeout 900 'swaymsg "output * power off"' resume 'swaymsg "output * dpms on"' \
timeout 1200 'systemctl suspend' \
before-sleep '$lock'
@@ -25,7 +25,7 @@
input "type:keyboard" {
xkb_layout eu
xkb_options caps:swapescape
xkb_options caps:escape
repeat_delay 250
repeat_rate 100
}
@@ -53,7 +53,6 @@ bindgesture swipe:4:left focus left
bindsym $mod+Control+BackSpace exec $lock
bindsym $mod+Control+Shift+BackSpace exec systemctl suspend
# https://github.com/moverest/sway-interactive-screenshot
bindsym $mod+Shift+s exec ~/.config/sway/screenshot -s region
bindsym $mod+Shift+c reload

View File

@@ -1,64 +0,0 @@
# Change this according to your device
################
# Variables
################
# Keyboard input name
# keyboard_input_name="1:2:AT_Raw_Set_2_keyboard"
# Date and time
date_and_week=$(date "+%a %d.%b (KW%-V)")
current_time=$(date "+%H:%M")
#############
# Commands
#############
# Battery or charger
battery_charge=$(upower --show-info $(upower --enumerate | grep 'BAT') | egrep "percentage" | awk '{print $2}')
battery_status=$(upower --show-info $(upower --enumerate | grep 'BAT') | egrep "state" | awk '{print $2}')
# Audio and multimedia
audio_volume=$(pamixer --sink `pactl list sinks short | grep RUNNING | awk '{print $1}'` --get-volume)
audio_is_muted=$(pamixer --sink `pactl list sinks short | grep RUNNING | awk '{print $1}'` --get-mute)
loadavg_5min=$(cat /proc/loadavg | awk -F ' ' '{print $2}')
# Brightness
brightness=$(printf %.0f $(light))
# Removed weather because we are requesting it too many times to have a proper
# refresh on the bar
#weather=$(curl -Ss 'https://wttr.in/Pontevedra?0&T&Q&format=1')
if [ $battery_status = "discharging" ];
then
battery_pluggedin='⚠'
else
battery_pluggedin='⚡'
fi
if ! [ $network ]
then
network_active="⛔"
else
network_active="⇆"
fi
if [ $player_status = "Playing" ]
then
song_status='▶'
elif [ $player_status = "Paused" ]
then
song_status='⏸'
else
song_status='⏹'
fi
if [ $audio_is_muted = "true" ]
then
audio_active='🔇'
else
audio_active='🔊'
fi
echo "🏋 $loadavg_5min | $audio_active $audio_volume% | ☀️ $brightness | $battery_pluggedin $battery_charge | $date_and_week 🕘 $current_time"

View File

@@ -32,9 +32,12 @@
// "memory",
// "cpu",
// "temperature",
"custom/weather",
"backlight",
// "custom/keyboard-layout",
"battery",
"custom/conservation",
"custom/power",
"clock#date",
"clock#time"
],
@@ -51,10 +54,11 @@
"critical": 15
},
// Connected to AC
"format": " {capacity}%", // Icon: bolt
// "format": " {capacity}%", // Icon: bolt
"format": "⚡ {capacity}%", // Icon: bolt
// Not connected to AC
// "format-discharging": "{icon} {capacity}%",
"format-discharging": "{capacity}%",
"format-discharging": "🔋 {capacity}%",
"format-icons": [
"", // Icon: battery-full
"", // Icon: battery-three-quarters
@@ -67,15 +71,15 @@
"backlight": {
"device": "intel_backlight",
// "format": "{icon} {percent}%",
"format": "{percent}%",
"format-icons": ["", ""]
"format": "{icon} {percent}%",
// "format": "{percent}%",
"format-icons": ["🔅", "🔆"]
},
"clock#time": {
"interval": 1,
"format": "{:%H:%M}",
"format": "🕒 {:%H:%M}",
"tooltip": false,
"on-click": "gnome-clocks"
},
@@ -83,14 +87,23 @@
"clock#date": {
"interval": 10,
// "format": " {:%e %b %Y}", // Icon: calendar-alt
"format": "{:%e %b %Y}", // Icon: calendar-alt
"format": "🗓️ {:%e. %b %Y (%a)}", // Icon: calendar-alt
"tooltip-format": "{:%e %B %Y}",
"on-click": "gnome-calendar"
},
// https://github.com/bjesus/wttrbar
"custom/weather": {
"format": "{}°C",
"tooltip": true,
"interval": 3600,
"exec": "wttrbar --location Munich",
"return-type": "json"
},
"cpu": {
"interval": 5,
"format": " {usage}% ({load})", // Icon: microchip
"interval": 30,
"format": "🧮 {usage}% ({load})", // Icon: microchip
"states": {
"warning": 70,
"critical": 90
@@ -108,8 +121,8 @@
},
"memory": {
"interval": 5,
"format": "󰍛 {}%", // Icon: memory
"interval": 30,
"format": "💾 {used} GiB", // Icon: memory
"states": {
"warning": 70,
"critical": 90
@@ -179,6 +192,17 @@
"tray": {
"icon-size": 15,
"spacing": 20
},
"custom/conservation": {
"exec": "~/.config/waybar/conservation.sh",
"interval": 10,
"on-click": "~/.config/waybar/conservation-toggle.sh"
},
"custom/power": {
"exec": "echo 💻 $(cat /sys/firmware/acpi/platform_profile)",
"interval": 10,
}
}

View File

@@ -0,0 +1,10 @@
location='/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode'
val=$(cat $location)
if [ "X$val" == "X1" ]; then
echo 0 | sudo tee $location
notify-send "Battery" "Disabled conservation mode" -i battery
else
echo 1 | sudo tee $location
notify-send "Battery" "Enabled conservation mode" -i battery
fi

View File

@@ -0,0 +1,8 @@
location='/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode'
val=$(cat $location)
if [ "X$val" == "X1" ]; then
echo "(On)"
else
echo "(Off)"
fi

View File

@@ -61,6 +61,8 @@
#clock,
#cpu,
#custom-keyboard-layout,
#custom-weather,
#custom-power,
#memory,
#mode,
#network,
@@ -71,6 +73,10 @@
padding-right: 10px;
}
#custom-conservation {
padding-right: 10px;
}
/* -----------------------------------------------------------------------------
* Module styles