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

@@ -15,3 +15,26 @@ $ gsettings get org.gnome.desktop.wm.preferences button-layout
'icon:close' 'icon:close'
$ gsettings set org.gnome.desktop.wm.preferences button-layout '' $ gsettings set org.gnome.desktop.wm.preferences button-layout ''
``` ```
# Dependencies
Font: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip
```
sudo dnf install \
kitty git vim tmux ripgrep fd-find fzf stow \
sway waybar \
brightnessctl \
wofi \
pasystray \
network-manager network-manager-applet \
nextcloud \
keepassxc \
fcitx5 fcitx5-configtool fcitx5-anthy \
```
- https://github.com/ErikReider/SwayNotificationCenter
- https://github.com/moverest/sway-interactive-screenshot
- https://github.com/bjesus/wttrbar
- https://github.com/Ferdi265/wl-mirror

View File

@@ -14,10 +14,10 @@
workspace_layout tabbed workspace_layout tabbed
smart_borders on smart_borders on
set $lock swaylock -i ~/cloud/images/wallpaper/lock.png -s center -u set $lock swaylock -f -c 3D484D
exec swayidle -w \ exec swayidle -w \
timeout 600 '$lock' \ 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' \ timeout 1200 'systemctl suspend' \
before-sleep '$lock' before-sleep '$lock'
@@ -25,7 +25,7 @@
input "type:keyboard" { input "type:keyboard" {
xkb_layout eu xkb_layout eu
xkb_options caps:swapescape xkb_options caps:escape
repeat_delay 250 repeat_delay 250
repeat_rate 100 repeat_rate 100
} }
@@ -53,7 +53,6 @@ bindgesture swipe:4:left focus left
bindsym $mod+Control+BackSpace exec $lock bindsym $mod+Control+BackSpace exec $lock
bindsym $mod+Control+Shift+BackSpace exec systemctl suspend 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+s exec ~/.config/sway/screenshot -s region
bindsym $mod+Shift+c reload 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", // "memory",
// "cpu", // "cpu",
// "temperature", // "temperature",
"custom/weather",
"backlight", "backlight",
// "custom/keyboard-layout", // "custom/keyboard-layout",
"battery", "battery",
"custom/conservation",
"custom/power",
"clock#date", "clock#date",
"clock#time" "clock#time"
], ],
@@ -51,10 +54,11 @@
"critical": 15 "critical": 15
}, },
// Connected to AC // Connected to AC
"format": " {capacity}%", // Icon: bolt // "format": " {capacity}%", // Icon: bolt
"format": "⚡ {capacity}%", // Icon: bolt
// Not connected to AC // Not connected to AC
// "format-discharging": "{icon} {capacity}%", // "format-discharging": "{icon} {capacity}%",
"format-discharging": "{capacity}%", "format-discharging": "🔋 {capacity}%",
"format-icons": [ "format-icons": [
"", // Icon: battery-full "", // Icon: battery-full
"", // Icon: battery-three-quarters "", // Icon: battery-three-quarters
@@ -67,15 +71,15 @@
"backlight": { "backlight": {
"device": "intel_backlight", "device": "intel_backlight",
// "format": "{icon} {percent}%", "format": "{icon} {percent}%",
"format": "{percent}%", // "format": "{percent}%",
"format-icons": ["", ""] "format-icons": ["🔅", "🔆"]
}, },
"clock#time": { "clock#time": {
"interval": 1, "interval": 1,
"format": "{:%H:%M}", "format": "🕒 {:%H:%M}",
"tooltip": false, "tooltip": false,
"on-click": "gnome-clocks" "on-click": "gnome-clocks"
}, },
@@ -83,14 +87,23 @@
"clock#date": { "clock#date": {
"interval": 10, "interval": 10,
// "format": " {:%e %b %Y}", // Icon: calendar-alt // "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}", "tooltip-format": "{:%e %B %Y}",
"on-click": "gnome-calendar" "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": { "cpu": {
"interval": 5, "interval": 30,
"format": " {usage}% ({load})", // Icon: microchip "format": "🧮 {usage}% ({load})", // Icon: microchip
"states": { "states": {
"warning": 70, "warning": 70,
"critical": 90 "critical": 90
@@ -108,8 +121,8 @@
}, },
"memory": { "memory": {
"interval": 5, "interval": 30,
"format": "󰍛 {}%", // Icon: memory "format": "💾 {used} GiB", // Icon: memory
"states": { "states": {
"warning": 70, "warning": 70,
"critical": 90 "critical": 90
@@ -179,6 +192,17 @@
"tray": { "tray": {
"icon-size": 15, "icon-size": 15,
"spacing": 20 "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, #clock,
#cpu, #cpu,
#custom-keyboard-layout, #custom-keyboard-layout,
#custom-weather,
#custom-power,
#memory, #memory,
#mode, #mode,
#network, #network,
@@ -71,6 +73,10 @@
padding-right: 10px; padding-right: 10px;
} }
#custom-conservation {
padding-right: 10px;
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Module styles * Module styles