more sway and some waybar
This commit is contained in:
parent
2ac99db38b
commit
93879b3ef7
21 changed files with 760 additions and 26 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set $initialize_foot_server '[ -x "$(command -v foot)" ] && systemctl --now --user enable foot-server.socket && systemctl --now --user enable foot-server'
|
set $initialize_foot_server '[ -x "$(command -v foot)" ] && systemctl --now --user enable foot-server.socket && systemctl --now --user enable foot-server'
|
||||||
set $initialize_swayr_daemon '[ -x "$(command -v swayrd)" ] && systemctl --now --user enable swayrd'
|
set $initialize_swayr_daemon '[ -x "$(command -v swayrd)" ] && systemctl --now --user enable swayrd'
|
||||||
set $initialize_waybar '[ -x "$(command -v waybar)" ] && (pkill waybar || exit 0) && systemctl --now --user enable waybar && (systemctl --user start waybar || /usr/share/sway/scripts/waybar.sh)'
|
set $initialize_waybar '[ -x "$(command -v waybar)" ] && (pkill waybar || exit 0) && systemctl --now --user enable waybar && (systemctl --user start waybar || $sway-config-dir/scripts/waybar.sh)'
|
||||||
set $initialize_workspace_icons '[ -x "$(command -v sworkstyle)" ] && systemctl --now --user enable sworkstyle'
|
set $initialize_workspace_icons '[ -x "$(command -v sworkstyle)" ] && systemctl --now --user enable sworkstyle'
|
||||||
set $initialize_poweralert_daemon '[ -x "$(command -v poweralertd)" ] && systemctl --now --user enable poweralertd'
|
set $initialize_poweralert_daemon '[ -x "$(command -v poweralertd)" ] && systemctl --now --user enable poweralertd'
|
||||||
set $initialize_idlehack_daemon '[ -x "$(command -v idlehack)" ] && systemctl --now --user enable idlehack'
|
set $initialize_idlehack_daemon '[ -x "$(command -v idlehack)" ] && systemctl --now --user enable idlehack'
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
set $sway-scripts-dir $HOME/.config/sway/scripts
|
set $sway-config-dir $HOME/.config/sway
|
||||||
|
set $sway-scripts-dir $sway-config-dir/scripts
|
||||||
|
|
||||||
include "$HOME/.config/sway/definitions"
|
include "$sway-config-dir/definitions"
|
||||||
include "$HOME/.config/sway/definitions.d/*.conf"
|
include "$sway-config-dir/definitions.d/*.conf"
|
||||||
include "$HOME/.config/sway/autostart"
|
include "$sway-config-dir/autostart"
|
||||||
include "$HOME/.config/sway/modes/*"
|
include "$sway-config-dir/modes/*"
|
||||||
include "$HOME/.config/sway/config.d/*.conf"
|
include "$sway-config-dir/config.d/*.conf"
|
||||||
include "$HOME/.config/sway/hosts/`hostname`"
|
include "$sway-config-dir/hosts/`hostname`"
|
||||||
|
|
18
.config/sway/config.d/99-autostart-applications.conf
Normal file
18
.config/sway/config.d/99-autostart-applications.conf
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# autostarts
|
||||||
|
exec {
|
||||||
|
$initialize_way_displays
|
||||||
|
|
||||||
|
$xdg-dirs
|
||||||
|
$swayidle
|
||||||
|
$swappy_notify
|
||||||
|
$flashfocus
|
||||||
|
$wlsunset
|
||||||
|
$autotiling
|
||||||
|
$cliphist_store
|
||||||
|
$cliphist_watch
|
||||||
|
}
|
||||||
|
|
||||||
|
# commands that "reload" something
|
||||||
|
exec_always {
|
||||||
|
$initialize_waybar
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
# shellcheck disable=SC2148,SC2086,SC2154,SC2046,SC2016
|
# shellcheck disable=SC2148,SC2086,SC2154,SC2046,SC2016
|
||||||
### Variables
|
### Variables
|
||||||
#
|
#
|
||||||
|
set $theme "$sway-config-dir/themes/dracula"
|
||||||
|
include $theme/theme.conf
|
||||||
|
|
||||||
# Logo key. Use Mod1 for Alt and Mod4 for Super.
|
# Logo key. Use Mod1 for Alt and Mod4 for Super.
|
||||||
set $mod Mod4
|
set $mod Mod4
|
||||||
set $alt_mod Mod1
|
set $alt_mod Mod1
|
||||||
|
@ -26,10 +29,10 @@ set $term kitty
|
||||||
set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)"
|
set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)"
|
||||||
|
|
||||||
# onscreen bar
|
# onscreen bar
|
||||||
set $onscreen_bar /usr/share/sway/scripts/wob.sh "$accent-color" "$background-color"
|
set $onscreen_bar $sway-scripts-dir/wob.sh "$accent-color" "$background-color"
|
||||||
|
|
||||||
# brightness control
|
# brightness control
|
||||||
set $brightness /usr/share/sway/scripts/brightness.sh
|
set $brightness $sway-scripts-dir/brightness.sh
|
||||||
set $brightness_up $brightness up | $onscreen_bar
|
set $brightness_up $brightness up | $onscreen_bar
|
||||||
set $brightness_down $brightness down | $onscreen_bar
|
set $brightness_down $brightness down | $onscreen_bar
|
||||||
|
|
||||||
|
@ -83,7 +86,7 @@ include /etc/sway/autostart
|
||||||
seat seat0 hide_cursor 5000
|
seat seat0 hide_cursor 5000
|
||||||
|
|
||||||
# pulseaudio command
|
# pulseaudio command
|
||||||
set $pulseaudio $once $term_float pulsemixer
|
set $pulseaudio pavucontrol
|
||||||
|
|
||||||
# help command
|
# help command
|
||||||
set $help /usr/share/sway/scripts/help.sh --toggle
|
set $help /usr/share/sway/scripts/help.sh --toggle
|
||||||
|
|
|
@ -13,7 +13,7 @@ mode --pango_markup $mode_recording {
|
||||||
}
|
}
|
||||||
|
|
||||||
## Launch // Recording Mode ##
|
## Launch // Recording Mode ##
|
||||||
$bindsym $mod+Shift+r mode $mode_recording
|
$bindsym $mod+Shift+Print mode $mode_recording
|
||||||
|
|
||||||
## Launch // Stop Recording Mode ##
|
## Launch // Stop Recording Mode ##
|
||||||
$bindsym $mod+Escape exec killall -s SIGINT wf-recorder
|
$bindsym $mod+Escape exec killall -s SIGINT wf-recorder
|
|
@ -1,4 +1,5 @@
|
||||||
mode "resize" {
|
set $mode_resize "<b>Resize</b><i>eo</i>"
|
||||||
|
mode --pango_markup $mode_resize {
|
||||||
$bindsym h resize shrink width 10 px or 10 ppt
|
$bindsym h resize shrink width 10 px or 10 ppt
|
||||||
$bindsym j resize grow height 10 px or 10 ppt
|
$bindsym j resize grow height 10 px or 10 ppt
|
||||||
$bindsym k resize shrink height 10 px or 10 ppt
|
$bindsym k resize shrink height 10 px or 10 ppt
|
||||||
|
@ -14,4 +15,4 @@ mode "resize" {
|
||||||
$bindsym Return mode "default"
|
$bindsym Return mode "default"
|
||||||
$bindsym Escape mode "default"
|
$bindsym Escape mode "default"
|
||||||
}
|
}
|
||||||
$bindsym $mod+r mode "resize"
|
$bindsym $mod+r mode $mode_resize
|
||||||
|
|
|
@ -31,4 +31,4 @@ mode --pango_markup $mode_shutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
## Launch // Exit Menu ##
|
## Launch // Exit Menu ##
|
||||||
$bindsym $mod+Shift+e mode $mode_shutdown
|
bindsym $mod+Shift+e mode $mode_shutdown
|
||||||
|
|
13
.config/sway/scripts/dnd.sh
Executable file
13
.config/sway/scripts/dnd.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
case $1'' in
|
||||||
|
'status')
|
||||||
|
printf '{\"alt\":\"%s\",\"tooltip\":\"mode: %s\"}' $(makoctl mode | grep -q 'do-not-disturb' && echo dnd || echo default) $(makoctl mode | tail -1)
|
||||||
|
;;
|
||||||
|
'restore')
|
||||||
|
makoctl restore
|
||||||
|
;;
|
||||||
|
'toggle')
|
||||||
|
makoctl mode | grep 'do-not-disturb' && makoctl mode -r do-not-disturb || makoctl mode -a do-not-disturb
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -20,7 +20,7 @@ notify() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $status != 0 ]; then
|
if [ $status != 0 ]; then
|
||||||
target_path=$(xdg-user-dir SCREENSHOT)
|
target_path=$(xdg-user-dir SCREENSHOTS)
|
||||||
timestamp=$(date +'recording_%Y%m%d-%H%M%S')
|
timestamp=$(date +'recording_%Y%m%d-%H%M%S')
|
||||||
|
|
||||||
notify "Select a region to record" -t 1000
|
notify "Select a region to record" -t 1000
|
||||||
|
|
15
.config/sway/scripts/scratchpad.sh
Executable file
15
.config/sway/scripts/scratchpad.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
tooltip=$(swaymsg -r -t get_tree | jq -r 'recurse(.nodes[]) | first(select(.name=="__i3_scratch")) | .floating_nodes | .[] | "\(.app_id) | \(.name)"')
|
||||||
|
count=$(printf "%s" "$tooltip" | grep -c '^')
|
||||||
|
|
||||||
|
if [ "$count" -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
elif [ "$count" -eq 1 ]; then
|
||||||
|
class="one"
|
||||||
|
elif [ "$count" -gt 1 ]; then
|
||||||
|
class="many"
|
||||||
|
else
|
||||||
|
class="unknown"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '{"text":"%s", "class":"%s", "alt":"%s", "tooltip":"%s"}\n' "$count" "$class" "$class" "$(echo "${tooltip}" | sed -z 's/\n/\\n/g')"
|
8
.config/sway/scripts/screenshot-notify.sh
Executable file
8
.config/sway/scripts/screenshot-notify.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=${XDG_SCREENSHOTS_DIR:-$HOME/Screenshots}
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
mkdir -p "$DIR" && inotifywait -q -e create "$DIR" --format '%w%f' | xargs notify-send "Screenshot saved"
|
||||||
|
done
|
67
.config/sway/scripts/sunset.sh
Executable file
67
.config/sway/scripts/sunset.sh
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
config="$HOME/.config/wlsunset/config"
|
||||||
|
|
||||||
|
#Startup function
|
||||||
|
start() {
|
||||||
|
[ -f "$config" ] && . "$config"
|
||||||
|
temp_low=${temp_low:-"4000"}
|
||||||
|
temp_high=${temp_high:-"6500"}
|
||||||
|
duration=${duration:-"900"}
|
||||||
|
sunrise=${sunrise:-"07:00"}
|
||||||
|
sunset=${sunset:-"19:00"}
|
||||||
|
location=${location:-"on"}
|
||||||
|
fallback_longitude=${fallback_longitude:-"8.7"}
|
||||||
|
fallback_latitude=${fallback_latitude:-"50.1"}
|
||||||
|
|
||||||
|
if [ "${location}" = "on" ]; then
|
||||||
|
if [ -z ${longitude+x} ] || [ -z ${latitude+x} ]; then
|
||||||
|
GEO_CONTENT=$(curl -sL https://manjaro-sway.download/geoip)
|
||||||
|
fi
|
||||||
|
longitude=${longitude:-$(echo "$GEO_CONTENT" | jq -r '.longitude // empty')}
|
||||||
|
longitude=${longitude:-$fallback_longitude}
|
||||||
|
latitude=${latitude:-$(echo "$GEO_CONTENT" | jq -r '.latitude // empty')}
|
||||||
|
latitude=${latitude:-$fallback_latitude}
|
||||||
|
|
||||||
|
echo longitude: "$longitude" latitude: "$latitude"
|
||||||
|
|
||||||
|
wlsunset -l "$latitude" -L "$longitude" -t "$temp_low" -T "$temp_high" -d "$duration" &
|
||||||
|
else
|
||||||
|
wlsunset -t "$temp_low" -T "$temp_high" -d "$duration" -S "$sunrise" -s "$sunset" &
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#Accepts managing parameter
|
||||||
|
case $1'' in
|
||||||
|
'off')
|
||||||
|
pkill -x wlsunset
|
||||||
|
waybar-signal sunset
|
||||||
|
;;
|
||||||
|
'on')
|
||||||
|
start
|
||||||
|
waybar-signal sunset
|
||||||
|
;;
|
||||||
|
'toggle')
|
||||||
|
if pkill -x -0 wlsunset; then
|
||||||
|
pkill -x wlsunset
|
||||||
|
else
|
||||||
|
start
|
||||||
|
fi
|
||||||
|
waybar-signal sunset
|
||||||
|
;;
|
||||||
|
'check')
|
||||||
|
command -v wlsunset
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#Returns a string for Waybar
|
||||||
|
if pkill -x -0 wlsunset; then
|
||||||
|
class="on"
|
||||||
|
text="location-based gamma correction"
|
||||||
|
else
|
||||||
|
class="off"
|
||||||
|
text="no gamma correction"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '{"alt":"%s","tooltip":"%s"}\n' "$class" "$text"
|
97
.config/sway/scripts/valent.py
Executable file
97
.config/sway/scripts/valent.py
Executable file
|
@ -0,0 +1,97 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import dbus
|
||||||
|
import json
|
||||||
|
import logging, sys
|
||||||
|
import os
|
||||||
|
import math
|
||||||
|
|
||||||
|
level = logging.DEBUG if os.environ.get("DEBUG") == "true" else logging.INFO
|
||||||
|
|
||||||
|
logging.basicConfig(stream=sys.stderr, level=level)
|
||||||
|
|
||||||
|
CONNECTIVITY_STRENGTH_SYMBOL = ["", "", "", "", ""]
|
||||||
|
|
||||||
|
BATTERY_PERCENTAGE_SYMBOL = ["", "", "", "", "", "", "", "", "", ""]
|
||||||
|
|
||||||
|
bus = dbus.SessionBus()
|
||||||
|
valent_object = bus.get_object("ca.andyholmes.Valent", "/ca/andyholmes/Valent")
|
||||||
|
valent_interface = dbus.Interface(valent_object, "org.freedesktop.DBus.ObjectManager")
|
||||||
|
managed_objects = valent_interface.GetManagedObjects()
|
||||||
|
|
||||||
|
dangerously_empty = False
|
||||||
|
connected = False
|
||||||
|
no_connectivity = False
|
||||||
|
|
||||||
|
devices = []
|
||||||
|
|
||||||
|
for path in managed_objects:
|
||||||
|
device = {}
|
||||||
|
device["state"] = (
|
||||||
|
"connected"
|
||||||
|
if managed_objects[path].get("ca.andyholmes.Valent.Device", {}).get("State", 0)
|
||||||
|
== 3
|
||||||
|
else "disconnected"
|
||||||
|
)
|
||||||
|
device["id"] = (
|
||||||
|
managed_objects[path].get("ca.andyholmes.Valent.Device", {}).get("Id", 0)
|
||||||
|
)
|
||||||
|
device["name"] = (
|
||||||
|
managed_objects[path].get("ca.andyholmes.Valent.Device", {}).get("Name", 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
device_obj = bus.get_object("ca.andyholmes.Valent", path)
|
||||||
|
device_action_interface = dbus.Interface(device_obj, "org.gtk.Actions")
|
||||||
|
|
||||||
|
battery_state = device_action_interface.Describe("battery.state")[2][0]
|
||||||
|
device["battery_percentage"] = battery_state["percentage"]
|
||||||
|
device["battery_status"] = (
|
||||||
|
"discharging" if battery_state["charging"] == 0 else "charging"
|
||||||
|
)
|
||||||
|
|
||||||
|
connectivity_state = device_action_interface.Describe("connectivity_report.state")[
|
||||||
|
2
|
||||||
|
][0]["signal-strengths"]["1"]
|
||||||
|
device["connectivity_strength"] = connectivity_state["signal-strength"]
|
||||||
|
|
||||||
|
if device["state"] == "connected":
|
||||||
|
connected = True
|
||||||
|
|
||||||
|
if device["connectivity_strength"] <= 1:
|
||||||
|
no_connectivity = True
|
||||||
|
|
||||||
|
if device["battery_percentage"] <= 15 and device["battery_status"] == "discharging":
|
||||||
|
dangerously_empty = True
|
||||||
|
|
||||||
|
devices.append(device)
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
data["alt"] = (
|
||||||
|
"no-devices"
|
||||||
|
if len(devices) == 0
|
||||||
|
else "dangerously-empty"
|
||||||
|
if dangerously_empty
|
||||||
|
else "no-signal"
|
||||||
|
if no_connectivity
|
||||||
|
else "connected"
|
||||||
|
if connected
|
||||||
|
else "disconnected"
|
||||||
|
)
|
||||||
|
data["class"] = data["alt"]
|
||||||
|
data["tooltip"] = ""
|
||||||
|
|
||||||
|
logging.debug(devices)
|
||||||
|
|
||||||
|
tooltip = []
|
||||||
|
|
||||||
|
for device in devices:
|
||||||
|
battery_symbol = math.ceil(round(device["battery_percentage"] / 10, 0))
|
||||||
|
details = (
|
||||||
|
f"\t{CONNECTIVITY_STRENGTH_SYMBOL[device['connectivity_strength']]} {BATTERY_PERCENTAGE_SYMBOL[battery_symbol]} {device['battery_percentage']}% ({device['battery_status']})"
|
||||||
|
if device["state"] == "connected"
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
tooltip.append(f"{device['name']} ({device['state']}){details}")
|
||||||
|
|
||||||
|
data["tooltip"] = "\n".join(tooltip)
|
||||||
|
|
||||||
|
print(json.dumps(data))
|
7
.config/sway/scripts/waybar.sh
Executable file
7
.config/sway/scripts/waybar.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# wrapper script for waybar with args, see https://github.com/swaywm/sway/issues/5724
|
||||||
|
CONFIG_PATH=$HOME/.config/waybar/config.jsonc
|
||||||
|
STYLE_PATH=$HOME/.config/waybar/style.css
|
||||||
|
|
||||||
|
pkill -x waybar
|
||||||
|
waybar -c "${CONFIG_PATH}" -s "${STYLE_PATH}" > $(mktemp -t XXXX.waybar.log)
|
28
.config/sway/scripts/wluma.sh
Executable file
28
.config/sway/scripts/wluma.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
status() {
|
||||||
|
systemctl --user is-active wluma >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
#Accepts managing parameter
|
||||||
|
case $1'' in
|
||||||
|
'toggle')
|
||||||
|
status && systemctl --user stop wluma || systemctl --user --now enable wluma
|
||||||
|
waybar-signal adaptive-brightness
|
||||||
|
;;
|
||||||
|
'check')
|
||||||
|
[ -x "$(command -v wluma)" ] && [ $(ls -A /sys/class/backlight/ | wc -l) -gt 0 ]
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#Returns data for Waybar
|
||||||
|
if status; then
|
||||||
|
class="on"
|
||||||
|
text="adaptive brightness"
|
||||||
|
else
|
||||||
|
class="off"
|
||||||
|
text="static brightness"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '{"alt":"%s","tooltip":"%s"}\n' "$class" "$text"
|
5
.config/sway/themes/dracula/packages
Normal file
5
.config/sway/themes/dracula/packages
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
dracula-gtk-theme
|
||||||
|
dracula-kde-theme-git
|
||||||
|
dracula-icons-git
|
||||||
|
ttf-jetbrains-mono-nerd
|
||||||
|
ttf-roboto
|
46
.config/sway/themes/dracula/theme.conf
Normal file
46
.config/sway/themes/dracula/theme.conf
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# dracula
|
||||||
|
|
||||||
|
# some global theme specific variables
|
||||||
|
set $gtk-theme Dracula
|
||||||
|
set $icon-theme Dracula-icons
|
||||||
|
set $cursor-theme Dracula-cursors
|
||||||
|
set $gui-font Roboto 11
|
||||||
|
set $term-font JetBrainsMono NF
|
||||||
|
set $gtk-color-scheme prefer-dark
|
||||||
|
set $kvantum-theme Dracula-purple-solid
|
||||||
|
set $background $HOME/.config/sway/generated_background.svg
|
||||||
|
|
||||||
|
set $color0 #141a1b
|
||||||
|
set $color1 #282a2b
|
||||||
|
set $color2 #3B758C
|
||||||
|
set $color3 #41535B
|
||||||
|
set $color4 #43a5d5
|
||||||
|
set $color5 #d6d6d6
|
||||||
|
set $color6 #f8f8f2
|
||||||
|
set $color7 #ffffff
|
||||||
|
set $color8 #Cd3f45
|
||||||
|
set $color9 #db7b55
|
||||||
|
set $color10 #e6cd69
|
||||||
|
set $color11 #9fca56
|
||||||
|
set $color12 #bd93f9
|
||||||
|
set $color13 #55b5db
|
||||||
|
set $color14 #a074c4
|
||||||
|
set $color15 #8a553f
|
||||||
|
|
||||||
|
#$color0
|
||||||
|
set $background-color $color0
|
||||||
|
#$color6
|
||||||
|
set $text-color $color6
|
||||||
|
#color1
|
||||||
|
set $selection-color $color1
|
||||||
|
#color12
|
||||||
|
set $accent-color $color12
|
||||||
|
|
||||||
|
# Basic color configuration using the Base16 variables for windows and borders.
|
||||||
|
# Property Name Border BG Text Indicator Child Border
|
||||||
|
client.focused $color12 $color12 $color0 $color6 $color12
|
||||||
|
client.focused_inactive $color1 $color1 $color5 $color3 $color1
|
||||||
|
client.unfocused $color1 $color0 $color5 $color6 $color1
|
||||||
|
client.urgent $color8 $color8 $color0 $color9 $color8
|
||||||
|
client.placeholder $color0 $color0 $color5 $color0 $color0
|
||||||
|
client.background $color7
|
|
@ -5,13 +5,14 @@
|
||||||
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
|
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
|
||||||
# absolute path. No other format is supported.
|
# absolute path. No other format is supported.
|
||||||
#
|
#
|
||||||
XDG_DESKTOP_DIR="$HOME/desktop"
|
XDG_DESKTOP_DIR="$HOME/"
|
||||||
XDG_DOWNLOAD_DIR="$HOME/downloads"
|
XDG_DOWNLOAD_DIR="$HOME/"
|
||||||
XDG_TEMPLATES_DIR="$HOME/templates"
|
XDG_TEMPLATES_DIR="$HOME/"
|
||||||
XDG_PUBLICSHARE_DIR="$HOME/pub"
|
XDG_PUBLICSHARE_DIR="$HOME/"
|
||||||
XDG_DOCUMENTS_DIR="$HOME/docs"
|
XDG_DOCUMENTS_DIR="$HOME/"
|
||||||
XDG_MUSIC_DIR="$HOME/media/music"
|
XDG_MUSIC_DIR="$HOME/"
|
||||||
XDG_PICTURES_DIR="$HOME/media/pictures"
|
XDG_PICTURES_DIR="$HOME/"
|
||||||
XDG_VIDEOS_DIR="$HOME/media/videos"
|
XDG_VIDEOS_DIR="$HOME/"
|
||||||
XDG_CACHE_DIR="$HOME/.cache"
|
XDG_CACHE_DIR="$HOME/.cache"
|
||||||
XDG_SCREENSHOT_DIR="$HOME/screenshots"
|
XDG_SCREENSHOTS_DIR="$HOME/screenshots"
|
||||||
|
XDG_WALLPAPERS_DIR="$HOME/wallpaper"
|
||||||
|
|
349
.config/waybar/config.jsonc
Normal file
349
.config/waybar/config.jsonc
Normal file
|
@ -0,0 +1,349 @@
|
||||||
|
// =============================================================================
|
||||||
|
//
|
||||||
|
// Waybar configuration
|
||||||
|
//
|
||||||
|
// Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
|
||||||
|
//
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
{
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Global configuration
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
"layer": "top",
|
||||||
|
|
||||||
|
// If height property would be not present, it'd be calculated dynamically
|
||||||
|
"height": 30,
|
||||||
|
"position": "top",
|
||||||
|
|
||||||
|
"modules-left": ["custom/menu", "sway/workspaces", "custom/scratchpad"],
|
||||||
|
"modules-center": ["custom/wf-recorder", "sway/mode", "custom/weather"],
|
||||||
|
"modules-right": [
|
||||||
|
// informational
|
||||||
|
"sway/language",
|
||||||
|
"custom/github",
|
||||||
|
"custom/clipboard",
|
||||||
|
"custom/zeit",
|
||||||
|
"cpu",
|
||||||
|
"temperature",
|
||||||
|
"memory",
|
||||||
|
"battery",
|
||||||
|
|
||||||
|
// connecting
|
||||||
|
"network",
|
||||||
|
"bluetooth",
|
||||||
|
"custom/valent",
|
||||||
|
|
||||||
|
// media
|
||||||
|
"custom/playerctl",
|
||||||
|
"custom/idle_inhibitor",
|
||||||
|
"custom/dnd",
|
||||||
|
"pulseaudio",
|
||||||
|
"backlight",
|
||||||
|
|
||||||
|
// system
|
||||||
|
"custom/adaptive-light",
|
||||||
|
"custom/sunset",
|
||||||
|
"custom/pacman",
|
||||||
|
|
||||||
|
"tray",
|
||||||
|
"clock"
|
||||||
|
],
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Modules
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
"battery": {
|
||||||
|
"interval": 30,
|
||||||
|
"states": {
|
||||||
|
"warning": 30,
|
||||||
|
"critical": 15
|
||||||
|
},
|
||||||
|
"format-charging": " {capacity}%",
|
||||||
|
"format": "{icon} {capacity}%",
|
||||||
|
"format-icons": ["", "", "", "", "", "", "", "", "", ""],
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"clock": {
|
||||||
|
"interval": 60,
|
||||||
|
"format": "{:%e %b %Y %H:%M}",
|
||||||
|
"tooltip": true,
|
||||||
|
"tooltip-format": "<big>{:%B %Y}</big>\n<tt>{calendar}</tt>",
|
||||||
|
"on-click": "swaymsg exec \\$calendar"
|
||||||
|
},
|
||||||
|
|
||||||
|
"cpu": {
|
||||||
|
"interval": 10,
|
||||||
|
"format": "",
|
||||||
|
"states": {
|
||||||
|
"warning": 70,
|
||||||
|
"critical": 90
|
||||||
|
},
|
||||||
|
"on-click": "swaymsg exec \\$once \\$term_float htop",
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"memory": {
|
||||||
|
"interval": 10,
|
||||||
|
"format": "",
|
||||||
|
"states": {
|
||||||
|
"warning": 70,
|
||||||
|
"critical": 90
|
||||||
|
},
|
||||||
|
"on-click": "swaymsg exec \\$once \\$term_float htop",
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"network": {
|
||||||
|
"interval": 5,
|
||||||
|
"format-wifi": " ",
|
||||||
|
"format-ethernet": "",
|
||||||
|
"format-disconnected": "",
|
||||||
|
"tooltip-format": "{icon} {ifname}: {ipaddr}",
|
||||||
|
"tooltip-format-ethernet": "{icon} {ifname}: {ipaddr}",
|
||||||
|
"tooltip-format-wifi": "{icon} {ifname} ({essid}): {ipaddr}",
|
||||||
|
"tooltip-format-disconnected": "{icon} disconnected",
|
||||||
|
"tooltip-format-disabled": "{icon} disabled",
|
||||||
|
"on-click": "swaymsg exec \\$once \\$term_float nmtui connect"
|
||||||
|
},
|
||||||
|
|
||||||
|
"sway/mode": {
|
||||||
|
"format": "<span style=\"italic\">{}</span>",
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
|
||||||
|
"backlight": {
|
||||||
|
"format": "{icon} {percent}%",
|
||||||
|
"format-icons": ["", "", ""],
|
||||||
|
"on-scroll-up": "swaymsg exec \\$brightness_up",
|
||||||
|
"on-scroll-down": "swaymsg exec \\$brightness_down"
|
||||||
|
},
|
||||||
|
|
||||||
|
"pulseaudio": {
|
||||||
|
"scroll-step": 5,
|
||||||
|
"format": "{icon} {volume}%{format_source}",
|
||||||
|
"format-muted": " {format_source}",
|
||||||
|
"format-source": "",
|
||||||
|
"format-source-muted": " ",
|
||||||
|
"format-icons": {
|
||||||
|
"headphone": "",
|
||||||
|
"headset": "",
|
||||||
|
"default": ["", "", ""]
|
||||||
|
},
|
||||||
|
"tooltip-format": "{icon} {volume}% {format_source}",
|
||||||
|
"on-click": "swaymsg exec \\$pulseaudio",
|
||||||
|
"on-click-middle": "swaymsg exec \\$volume_mute",
|
||||||
|
"on-scroll-up": "swaymsg exec \\$volume_up",
|
||||||
|
"on-scroll-down": "swaymsg exec \\$volume_down"
|
||||||
|
},
|
||||||
|
|
||||||
|
"temperature": {
|
||||||
|
"critical-threshold": 90,
|
||||||
|
"interval": 5,
|
||||||
|
"format": "{icon}",
|
||||||
|
"tooltip-format": "{temperatureC}°C",
|
||||||
|
"format-icons": ["", "", ""],
|
||||||
|
"tooltip": true,
|
||||||
|
"on-click": "swaymsg exec \"\\$once \\$term_float watch sensors\""
|
||||||
|
},
|
||||||
|
|
||||||
|
"tray": {
|
||||||
|
"icon-size": 21,
|
||||||
|
"spacing": 5
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/pacman": {
|
||||||
|
"format": " {}",
|
||||||
|
"interval": 3600,
|
||||||
|
"return-type": "json",
|
||||||
|
"exec-if": "$HOME/.config/scripts/checkupdates.sh check",
|
||||||
|
"exec": "$HOME/.config/scripts/checkupdates.sh status",
|
||||||
|
"on-click": "$HOME/.config/scripts/checkupdates.sh check && swaymsg exec \\$update-manager",
|
||||||
|
"on-click-middle": "waybar-signal pacman",
|
||||||
|
"signal": 14
|
||||||
|
},
|
||||||
|
|
||||||
|
"bluetooth": {
|
||||||
|
"format": "",
|
||||||
|
"format-disabled": "",
|
||||||
|
"on-click": "swaymsg exec \\$bluetooth",
|
||||||
|
"on-click-right": "rfkill toggle bluetooth",
|
||||||
|
"tooltip-format": "{}"
|
||||||
|
},
|
||||||
|
|
||||||
|
"sway/language": {
|
||||||
|
"format": " {}",
|
||||||
|
"min-length": 5,
|
||||||
|
"tooltip": false,
|
||||||
|
"on-click": "swaymsg input type:keyboard xkb_switch_layout next"
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/scratchpad": {
|
||||||
|
"interval": "once",
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"one": "",
|
||||||
|
"many": ""
|
||||||
|
},
|
||||||
|
"exec": "/bin/sh $HOME/.config/scripts/scratchpad.sh",
|
||||||
|
"on-click": "swaymsg 'scratchpad show'",
|
||||||
|
"signal": 7
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/sunset": {
|
||||||
|
"interval": "once",
|
||||||
|
"tooltip": true,
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"on": "",
|
||||||
|
"off": ""
|
||||||
|
},
|
||||||
|
"exec": "fallback_latitude=50.1 fallback_longitude=8.7 latitude= longitude= $HOME/.config/scripts/sunset.sh",
|
||||||
|
"on-click": "$HOME/.config/scripts/sunset.sh toggle",
|
||||||
|
"exec-if": "$HOME/.config/scripts/sunset.sh check",
|
||||||
|
"signal": 6
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/wf-recorder": {
|
||||||
|
"interval": "once",
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{}",
|
||||||
|
"exec": "echo '{\"class\": \"recording\",\"text\":\"\",\"tooltip\":\"press $mod+Esc to stop recording\"}'",
|
||||||
|
"exec-if": "pgrep wf-recorder",
|
||||||
|
"on-click": "waybar-signal recorder",
|
||||||
|
"signal": 8
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/github": {
|
||||||
|
"interval": 300,
|
||||||
|
"tooltip": false,
|
||||||
|
"return-type": "json",
|
||||||
|
"format": " {}",
|
||||||
|
"exec": "gh api '/notifications' -q '{ text: length }' | cat -",
|
||||||
|
"exec-if": "[ -x \"$(command -v gh)\" ] && gh auth status 2>&1 | grep -q -m 1 'Logged in' && test $(gh api '/notifications' -q 'length') -ne 0",
|
||||||
|
"on-click": "test $(gh api '/notifications' -q 'length') -ne 0 && xdg-open https://github.com/notifications && sleep 30 && waybar-signal github",
|
||||||
|
"signal": 4
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/playerctl": {
|
||||||
|
"interval": "once",
|
||||||
|
"tooltip": true,
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"Playing": "",
|
||||||
|
"Paused": ""
|
||||||
|
},
|
||||||
|
"exec": "playerctl metadata --format '{\"alt\": \"{{status}}\", \"tooltip\": \"{{playerName}}: {{markup_escape(title)}} - {{markup_escape(artist)}}\" }'",
|
||||||
|
"on-click": "playerctl play-pause",
|
||||||
|
"on-click-right": "playerctl next",
|
||||||
|
"on-scroll-up": "playerctl position 10+",
|
||||||
|
"on-scroll-down": "playerctl position 10-",
|
||||||
|
"signal": 5
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/clipboard": {
|
||||||
|
"format": "",
|
||||||
|
"interval": "once",
|
||||||
|
"return-type": "json",
|
||||||
|
"on-click": "swaymsg -q exec '$clipboard'; waybar-signal clipboard",
|
||||||
|
"on-click-right": "swaymsg -q exec '$clipboard-del'; waybar-signal clipboard",
|
||||||
|
"on-click-middle": "rm -f ~/.cache/cliphist/db; waybar-signal clipboard",
|
||||||
|
"exec": "printf '{\"tooltip\":\"%s\"}' $(cliphist list | wc -l)' item(s) in the clipboard\r(Mid click to clear)'",
|
||||||
|
"exec-if": "[ -x \"$(command -v cliphist)\" ] && [ $(cliphist list | wc -l) -gt 0 ]",
|
||||||
|
"signal": 9
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/weather": {
|
||||||
|
"format": "{}",
|
||||||
|
"tooltip": true,
|
||||||
|
"interval": 3600,
|
||||||
|
// accepts -c/--city <city> -t/--temperature <C/F> -d/--distance <km/miles>
|
||||||
|
"exec": "$HOME/.config/waybar/scripts/weather.py -t F",
|
||||||
|
"return-type": "json",
|
||||||
|
"on-click": "xdg-open \"https://wttr.in/$(curl -s https://manjaro-sway.download/geoip | jq -r '.city')\"",
|
||||||
|
"on-click-right": "waybar-signal weathr",
|
||||||
|
"signal": 16
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/zeit": {
|
||||||
|
"return-type": "json",
|
||||||
|
"interval": "once",
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"tracking": "",
|
||||||
|
"stopped": ""
|
||||||
|
},
|
||||||
|
"exec": "$HOME/.config/waybar/scripts/zeit.sh status",
|
||||||
|
"on-click": "$HOME/.config/scripts/zeit.sh click; waybar-signal zeit",
|
||||||
|
"exec-if": "[ -x \"$(command -v zeit)\" ]",
|
||||||
|
"signal": 10
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/dnd": {
|
||||||
|
"interval": "once",
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{}{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"default": "",
|
||||||
|
"dnd": ""
|
||||||
|
},
|
||||||
|
"on-click": "$HOME/.config/scripts/dnd.sh toggle; waybar-signal dnd",
|
||||||
|
"on-click-right": "$HOME/.config/scripts/dnd.sh restore",
|
||||||
|
"exec": "$HOME/.config/scripts/dnd.sh status",
|
||||||
|
"signal": 11
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/adaptive-light": {
|
||||||
|
"interval": "once",
|
||||||
|
"tooltip": true,
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"on": "",
|
||||||
|
"off": ""
|
||||||
|
},
|
||||||
|
"exec": "$HOME/.config/scripts/wluma.sh",
|
||||||
|
"on-click": "$HOME/.config/scripts/wluma.sh toggle",
|
||||||
|
"exec-if": "$HOME/.config/scripts/wluma.sh check",
|
||||||
|
"signal": 12
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/valent": {
|
||||||
|
"format": "{icon}",
|
||||||
|
"tooltip": true,
|
||||||
|
"interval": 60,
|
||||||
|
"exec": "$HOME/.config/scripts/valent.py",
|
||||||
|
"exec-if": "[ -x \"$(command -v valent)\" ]",
|
||||||
|
"return-type": "json",
|
||||||
|
"format-icons": {
|
||||||
|
"no-devices": "",
|
||||||
|
"dangerously-empty": "",
|
||||||
|
"no-signal": "",
|
||||||
|
"connected": "",
|
||||||
|
"disconnected": ""
|
||||||
|
},
|
||||||
|
"on-click": "valent",
|
||||||
|
"on-click-middle": "waybar-signal valent",
|
||||||
|
"signal": 13
|
||||||
|
},
|
||||||
|
|
||||||
|
"custom/idle_inhibitor": {
|
||||||
|
"interval": 60,
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"on": "",
|
||||||
|
"off": ""
|
||||||
|
},
|
||||||
|
"exec": "inhibit-idle",
|
||||||
|
"on-click": "inhibit-idle off; inhibit-idle interactive",
|
||||||
|
"on-click-middle": "inhibit-idle off",
|
||||||
|
"signal": 15
|
||||||
|
}
|
||||||
|
}
|
73
.config/waybar/scripts/weather.py
Executable file
73
.config/waybar/scripts/weather.py
Executable file
|
@ -0,0 +1,73 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
"""Script for the Waybar weather module."""
|
||||||
|
|
||||||
|
import getopt
|
||||||
|
import json
|
||||||
|
import locale
|
||||||
|
import sys
|
||||||
|
import urllib.parse
|
||||||
|
from datetime import datetime
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# see https://docs.python.org/3/library/locale.html#background-details-hints-tips-and-caveats
|
||||||
|
locale.setlocale(locale.LC_ALL, "")
|
||||||
|
current_locale, _ = locale.getlocale(locale.LC_NUMERIC)
|
||||||
|
data = {}
|
||||||
|
city = "auto"
|
||||||
|
temperature = "C"
|
||||||
|
temperature_unit = "celsius"
|
||||||
|
distance = "km"
|
||||||
|
wind_speed_unit = "kmh"
|
||||||
|
|
||||||
|
if current_locale == "en_US":
|
||||||
|
temperature = "F"
|
||||||
|
distance = "miles"
|
||||||
|
|
||||||
|
argument_list = sys.argv[1:]
|
||||||
|
options = "t:c:d:"
|
||||||
|
long_options = ["temperature=", "city=", "distance="]
|
||||||
|
|
||||||
|
try:
|
||||||
|
args, values = getopt.getopt(argument_list, options, long_options)
|
||||||
|
|
||||||
|
for current_argument, current_value in args:
|
||||||
|
if current_argument in ("-t", "--temperature"):
|
||||||
|
temperature = current_value[0].upper()
|
||||||
|
if temperature not in ("C", "F"):
|
||||||
|
msg = "temperature unit is neither (C)elsius, nor (F)ahrenheit"
|
||||||
|
raise RuntimeError(
|
||||||
|
msg,
|
||||||
|
temperature,
|
||||||
|
)
|
||||||
|
|
||||||
|
elif current_argument in ("-d", "--distance"):
|
||||||
|
distance = current_value.lower()
|
||||||
|
if distance not in ("km", "miles"):
|
||||||
|
msg = "distance unit is neither km, nor miles", distance
|
||||||
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
|
else:
|
||||||
|
city = urllib.parse.quote(current_value)
|
||||||
|
|
||||||
|
except getopt.error as err:
|
||||||
|
print(str(err))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if temperature == "F":
|
||||||
|
temperature_unit = "fahrenheit"
|
||||||
|
|
||||||
|
if distance == "miles":
|
||||||
|
wind_speed_unit = "mph"
|
||||||
|
|
||||||
|
try:
|
||||||
|
headers = {"Accept-Language": f"{locale.getlocale()[0].replace("_", "-")},{locale.getlocale()[0].split("_")[0]};q=0.5"}
|
||||||
|
weather = requests.get(f"https://manjaro-sway.download/weather/{city}?temperature_unit={temperature_unit}&wind_speed_unit={wind_speed_unit}", timeout=10, headers=headers).json()
|
||||||
|
except (
|
||||||
|
requests.exceptions.HTTPError,
|
||||||
|
requests.exceptions.ConnectionError,
|
||||||
|
requests.exceptions.Timeout,
|
||||||
|
) as err:
|
||||||
|
print(str(err))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print(json.dumps(weather))
|
2
.config/waybar/style.css
Normal file
2
.config/waybar/style.css
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
@import "/usr/share/sway/templates/waybar/style.css";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue