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_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_poweralert_daemon '[ -x "$(command -v poweralertd)" ] && systemctl --now --user enable poweralertd'
|
||||
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 "$HOME/.config/sway/definitions.d/*.conf"
|
||||
include "$HOME/.config/sway/autostart"
|
||||
include "$HOME/.config/sway/modes/*"
|
||||
include "$HOME/.config/sway/config.d/*.conf"
|
||||
include "$HOME/.config/sway/hosts/`hostname`"
|
||||
include "$sway-config-dir/definitions"
|
||||
include "$sway-config-dir/definitions.d/*.conf"
|
||||
include "$sway-config-dir/autostart"
|
||||
include "$sway-config-dir/modes/*"
|
||||
include "$sway-config-dir/config.d/*.conf"
|
||||
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
|
||||
### Variables
|
||||
#
|
||||
set $theme "$sway-config-dir/themes/dracula"
|
||||
include $theme/theme.conf
|
||||
|
||||
# Logo key. Use Mod1 for Alt and Mod4 for Super.
|
||||
set $mod Mod4
|
||||
set $alt_mod Mod1
|
||||
|
@ -26,10 +29,10 @@ set $term kitty
|
|||
set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)"
|
||||
|
||||
# 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
|
||||
set $brightness /usr/share/sway/scripts/brightness.sh
|
||||
set $brightness $sway-scripts-dir/brightness.sh
|
||||
set $brightness_up $brightness up | $onscreen_bar
|
||||
set $brightness_down $brightness down | $onscreen_bar
|
||||
|
||||
|
@ -83,7 +86,7 @@ include /etc/sway/autostart
|
|||
seat seat0 hide_cursor 5000
|
||||
|
||||
# pulseaudio command
|
||||
set $pulseaudio $once $term_float pulsemixer
|
||||
set $pulseaudio pavucontrol
|
||||
|
||||
# help command
|
||||
set $help /usr/share/sway/scripts/help.sh --toggle
|
||||
|
|
|
@ -13,7 +13,7 @@ mode --pango_markup $mode_recording {
|
|||
}
|
||||
|
||||
## Launch // Recording Mode ##
|
||||
$bindsym $mod+Shift+r mode $mode_recording
|
||||
$bindsym $mod+Shift+Print mode $mode_recording
|
||||
|
||||
## 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 j resize grow 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 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 ##
|
||||
$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
|
||||
target_path=$(xdg-user-dir SCREENSHOT)
|
||||
target_path=$(xdg-user-dir SCREENSHOTS)
|
||||
timestamp=$(date +'recording_%Y%m%d-%H%M%S')
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue