diff --git a/.config/sway/autostart b/.config/sway/autostart index 75bdc21..f4c70fa 100644 --- a/.config/sway/autostart +++ b/.config/sway/autostart @@ -36,7 +36,7 @@ set $swayidle swayidle -w \ before-sleep 'exec $locking & sleep $sleep_delay' \ after-resume '/usr/share/sway/scripts/keyboard-backlight-switch.sh on && swaymsg "output * dpms on" && brightnessctl -r' set $disable_nm_applet_autostart '[ -x "$(command -v nm-applet)" ] && [ ! -f $HOME/.config/autostart/nm-applet.desktop ] && cp /etc/xdg/autostart/nm-applet.desktop $HOME/.config/autostart/nm-applet.desktop && echo "Hidden=true" >> $HOME/.config/autostart/nm-applet.desktop' -set $apply_background swaymsg 'output * bg $background fill' +set $apply_background swaymsg 'output * bg $wallpaper fill' ## daemons diff --git a/.config/sway/config.d/90-enable-theme.conf b/.config/sway/config.d/90-enable-theme.conf new file mode 100644 index 0000000..bbe7244 --- /dev/null +++ b/.config/sway/config.d/90-enable-theme.conf @@ -0,0 +1,18 @@ +exec_always { + $sway-script-dir/enable-gtk-theme.sh "$gtk-theme" + gsettings set org.gnome.desktop.interface icon-theme "$icon-theme" + gsettings set org.gnome.desktop.interface cursor-theme "$cursor-theme" + gsettings set org.gnome.desktop.interface font-name "$gui-font" + gsettings set org.gnome.desktop.input-sources show-all-sources true + gsettings set org.gnome.desktop.interface monospace-font-name "$term-font" + $sway-script-dir/fontconfig.sh "monospace" "$term-font" + + gsettings set org.freedesktop.appearance color-scheme "$gtk-color-scheme" + gsettings set org.gnome.desktop.interface color-scheme "$gtk-color-scheme" + + # make sure gtk-4.0 has the theme settings of the currently active theme + + #/usr/share/sway/scripts/generate-bg.sh "$accent-color" "$text-color" "$background-color" + + #kvantummanager --set "$kvantum-theme" +} diff --git a/.config/sway/config.d/98-application-defaults.conf b/.config/sway/config.d/98-application-defaults.conf new file mode 100644 index 0000000..503c2f8 --- /dev/null +++ b/.config/sway/config.d/98-application-defaults.conf @@ -0,0 +1,35 @@ +# don't show gaps if there's only one window on the desktop +smart_gaps on + +# set floating mode for generated windows +for_window [title="(?:Open|Save) (?:File|Folder|As)"] floating enable +for_window [title="(?:Open|Save) (?:File|Folder|As)"] resize set 800 600 +for_window [window_role="pop-up"] floating enable +for_window [window_role="bubble"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="Preferences"] floating enable +for_window [window_type="dialog"] floating enable +for_window [window_type="menu"] floating enable + +# set floating mode for specific applications +for_window [instance="lxappearance"] floating enable +for_window [app_id="pamac-manager"] floating enable +for_window [app_id="blueberry.py"] floating enable +for_window [app_id="dragon-drop"] floating enable, sticky enable +for_window [app_id="firefox" title="^Library$"] floating enable, border pixel 1, sticky enable +for_window [app_id="thunderbird" title=".*Reminder"] floating enable +for_window [app_id="floating_shell"] floating enable, border pixel 1, sticky enable +for_window [app_id="Manjaro.manjaro-settings-manager"] floating enable +for_window [app_id="" title="Picture in picture"] floating enable, sticky enable +for_window [app_id="" title="Picture-in-Picture"] floating enable, sticky enable +for_window [instance="around"] floating enable, sticky enable +for_window [app_id="xsensors"] floating enable +for_window [title="Save File"] floating enable +for_window [title="Firefox .*— Sharing Indicator"] floating enable, sticky enable, move to scratchpad +for_window [app_id="" title=".* is sharing your screen."] floating enable +for_window [title="^wlay$"] floating enable + +# Don't allow applications to inhibit shortcuts, i.e. grab total control of the +# keyboard. Chrome currently abuses this by enabling it for all "--app=..." +# shortcuts. +seat * shortcuts_inhibitor disable diff --git a/.config/sway/config.d/99-autostart-applications.conf b/.config/sway/config.d/99-autostart-applications.conf index d68a8c0..9addf7a 100644 --- a/.config/sway/config.d/99-autostart-applications.conf +++ b/.config/sway/config.d/99-autostart-applications.conf @@ -1,18 +1,43 @@ +# autostart background applications +exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 + # autostarts exec { - $initialize_way_displays + $initialize_way_displays + $initialize_foot_server + $initialize_mounting_daemon + $initialize_poweralert_daemon + $initialize_idlehack_daemon + $initialize_workspace_icons + $initialize_swayr_daemon - $xdg-dirs - $swayidle - $swappy_notify - $flashfocus - $wlsunset - $autotiling - $cliphist_store - $cliphist_watch + $xdg-dirs + $swayidle + $swappy_notify + $autostart_dex + $flashfocus + $wlsunset + $autotiling + $cliphist_store + $cliphist_watch } # commands that "reload" something exec_always { - $initialize_waybar + $initialize_waybar + + $apply_background + $help_menu + $kanshi + $clip-persist + $mako + $auto_xdg_keyboard + $watch_playerctl + $calendar_daemon + $enable_noisetorch + $onscreen_bar --refresh + $create_rofi_config + $update_rofi_theme + #$disable_nm_applet_autostart + #$nm_applet } diff --git a/.config/sway/definitions b/.config/sway/definitions index 87d46d9..6540002 100644 --- a/.config/sway/definitions +++ b/.config/sway/definitions @@ -1,7 +1,7 @@ # shellcheck disable=SC2148,SC2086,SC2154,SC2046,SC2016 ### Variables # -set $theme "$sway-config-dir/themes/dracula" +set $theme "$sway-config-dir/themes/dynamic" include $theme/theme.conf # Logo key. Use Mod1 for Alt and Mod4 for Super. @@ -80,7 +80,7 @@ set $sleep_timeout_ac 3600 set $sleep_delay 2 ### Autostart applications definition. Can be removed soon-ish as it is being imported in userspace. -include /etc/sway/autostart +#include /etc/sway/autostart # hide cursor after 5 seconds of inactivty seat seat0 hide_cursor 5000 diff --git a/.config/sway/generated_background.svg b/.config/sway/generated_background.svg new file mode 100644 index 0000000..319ac98 --- /dev/null +++ b/.config/sway/generated_background.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.config/sway/scripts/valent.py b/.config/sway/scripts/valent.py deleted file mode 100755 index 3058a2d..0000000 --- a/.config/sway/scripts/valent.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/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)) diff --git a/.config/sway/scripts/zeit.sh b/.config/sway/scripts/zeit.sh new file mode 100755 index 0000000..87f285f --- /dev/null +++ b/.config/sway/scripts/zeit.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env sh +tracking=$(zeit tracking --no-colors) + +case $1'' in +'status') + text=$(echo "$tracking" | sed -z 's/\n/\\n/g' | grep -q 'tracking' && echo "tracking" || echo "stopped") + tooltip=$tracking'\r(zeit time tracker)' + echo "{\"text\":\"$text\",\"tooltip\":\"$tooltip\",\"class\":\"$text\",\"alt\":\"$text\"}" + ;; +'click') + if echo "$tracking" | grep -q 'tracking'; then + zeit finish + else + swaymsg exec \$zeit_list + fi + ;; +'track') + input=$(cat -) + task=$(echo $input | pcregrep -io1 '└── (.+) \[.+') + project=$(echo $input | pcregrep -io1 '.+\[(.+)\]') + + if [ "$task" = "" ] || [ "$project" = "" ]; then + notify-send "You did not select a task!" + exit 1 + fi + + zeit track -p "$project" -t "$task" + notify-send "Tracking $task in $project" + ;; +esac diff --git a/.config/sway/themes/dynamic/theme.conf b/.config/sway/themes/dynamic/theme.conf new file mode 100644 index 0000000..7016078 --- /dev/null +++ b/.config/sway/themes/dynamic/theme.conf @@ -0,0 +1,19 @@ +# dynamic +include $HOME/.cache/wal/colors-sway + +#set $fg $color3 +#set $bg $color1 + +set $background-color $color0 +set $text-color $color6 +set $selection-color $color1 +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 diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index 7bd720b..62bbf71 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -18,7 +18,7 @@ "position": "top", "modules-left": ["custom/menu", "sway/workspaces", "custom/scratchpad"], - "modules-center": ["custom/wf-recorder", "sway/mode", "custom/weather"], + "modules-center": ["custom/wf-recorder", "sway/mode"], "modules-right": [ // informational "sway/language", @@ -33,11 +33,10 @@ // connecting "network", "bluetooth", - "custom/valent", // media "custom/playerctl", - "custom/idle_inhibitor", + "custom/idle-inhibitor", "custom/dnd", "pulseaudio", "backlight", @@ -69,7 +68,7 @@ "clock": { "interval": 60, - "format": "{:%e %b %Y %H:%M}", + "format": "{:%a, %b %d %I:%M%p %Z %d/%m/%Y}", "tooltip": true, "tooltip-format": "{:%B %Y}\n{calendar}", "on-click": "swaymsg exec \\$calendar" @@ -159,9 +158,9 @@ "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", + "exec-if": "$HOME/.config/sway/scripts/checkupdates.sh check", + "exec": "$HOME/.config/sway/scripts/checkupdates.sh status", + "on-click": "$HOME/.config/sway/scripts/checkupdates.sh check && swaymsg exec \\$update-manager", "on-click-middle": "waybar-signal pacman", "signal": 14 }, @@ -189,7 +188,7 @@ "one": "󰖯", "many": "󰖲" }, - "exec": "/bin/sh $HOME/.config/scripts/scratchpad.sh", + "exec": "/bin/sh $HOME/.config/sway/scripts/scratchpad.sh", "on-click": "swaymsg 'scratchpad show'", "signal": 7 }, @@ -203,9 +202,9 @@ "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", + "exec": "fallback_latitude=50.1 fallback_longitude=8.7 latitude= longitude= $HOME/.config/sway/scripts/sunset.sh", + "on-click": "$HOME/.config/sway/scripts/sunset.sh toggle", + "exec-if": "$HOME/.config/sway/scripts/sunset.sh check", "signal": 6 }, @@ -279,8 +278,8 @@ "tracking": "󰖷", "stopped": "󰋣" }, - "exec": "$HOME/.config/waybar/scripts/zeit.sh status", - "on-click": "$HOME/.config/scripts/zeit.sh click; waybar-signal zeit", + "exec": "$HOME/.config/sway/scripts/zeit.sh status", + "on-click": "$HOME/.config/sway/scripts/zeit.sh click; waybar-signal zeit", "exec-if": "[ -x \"$(command -v zeit)\" ]", "signal": 10 }, @@ -293,9 +292,9 @@ "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", + "on-click": "$HOME/.config/sway/scripts/dnd.sh toggle; waybar-signal dnd", + "on-click-right": "$HOME/.config/sway/scripts/dnd.sh restore", + "exec": "$HOME/.config/sway/scripts/dnd.sh status", "signal": 11 }, @@ -308,9 +307,9 @@ "on": "󰃡", "off": "󰃠" }, - "exec": "$HOME/.config/scripts/wluma.sh", - "on-click": "$HOME/.config/scripts/wluma.sh toggle", - "exec-if": "$HOME/.config/scripts/wluma.sh check", + "exec": "$HOME/.config/sway/scripts/wluma.sh", + "on-click": "$HOME/.config/sway/scripts/wluma.sh toggle", + "exec-if": "$HOME/.config/sway/scripts/wluma.sh check", "signal": 12 }, @@ -318,7 +317,7 @@ "format": "{icon}", "tooltip": true, "interval": 60, - "exec": "$HOME/.config/scripts/valent.py", + "exec": "$HOME/.config/sway/scripts/valent.py", "exec-if": "[ -x \"$(command -v valent)\" ]", "return-type": "json", "format-icons": { @@ -333,7 +332,7 @@ "signal": 13 }, - "custom/idle_inhibitor": { + "custom/idle-inhibitor": { "interval": 60, "return-type": "json", "format": "{icon}", diff --git a/.config/waybar/style.css b/.config/waybar/style.css index d09cbf5..42dc1dd 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -1,2 +1,95 @@ -@import "/usr/share/sway/templates/waybar/style.css"; +@import url("../../.cache/wal/colors-waybar.css"); + +@define-color warning_color @color15; +@define-color error_color @color14; +@define-color focused_color @color8; + +@keyframes blink-warning { + 70% { + color: @wm_icon_bg; + } + to { + color: @wm_icon_bg; + background-color: @warning_color; + } +} + +@keyframes blink-critical { + 70% { + color: @wm_icon_bg; + } + to { + color: @wm_icon_bg; + background-color: @error_color; + } +} + + +* { + border-radius: 0; + border: none; + margin: 0; + min-height: 0; + padding: 0; + font-family: Font Awesome, "JetBrainsMono NF", "Roboto Mono", "Ubuntu", "Droid", "MesloLGL Nerd Font", Roboto, sans-serif; +} + +window#waybar { + color: @foreground; + background: rgba(0, 0, 0, 0); +} + +.modules-right, +.modules-left { + margin: 0; + padding: 2px 10px; + background-color: alpha(@background, 0.7); +} +.modules-right { + border-radius: 0 0 0 10px; +} +.modules-left { + border-radius: 0 0 10px 0; +} + +#backlight, +#battery, +#bluetooth, +#clock, +#cpu, +#custom-adaptive-light, +#custom-clipboard, +#custom-dnd, +#custom-github, +#custom-idle-inhibitor, +#custom-menu, +#custom-scratchpad, +#custom-sunset, +#custom-weather, +#custom-zeit, +#language, +#memory, +#mode, +#network, +#network, +#pulseaudio, +#temperature, +#tray +{ + padding: 0 10px; +} + +#workspaces button { + padding-bottom: 2px; + color: @foreground; +} + +#workspaces button.focused { + border-color: @focused_color; +} + +#workspaces button.urgent { + border-color: @error_color; + color: @error_color; +}