From db517a0759d7f5eb1b4b84aa7425131132d964f6 Mon Sep 17 00:00:00 2001 From: opal Date: Tue, 22 Apr 2025 22:08:45 -0700 Subject: [PATCH] trisquel stuff --- .bashrc | 6 +- .config/doom/config.el | 15 ++-- .config/dunst/dunstrc | 3 +- .config/mimeapps.list | 36 +++++----- .config/sway/config | 52 +++++++------- .config/sway/scripts/bar.sh | 12 +++- .config/sway/scripts/weather_swaybar.scm | 91 ++++++++++++++++++++++++ 7 files changed, 158 insertions(+), 57 deletions(-) create mode 100755 .config/sway/scripts/weather_swaybar.scm diff --git a/.bashrc b/.bashrc index 0919ec2..6658cba 100755 --- a/.bashrc +++ b/.bashrc @@ -1,6 +1,8 @@ #!/bin/sh -# If not running interactively, don't do anything +export TERM=xterm-256color + + #If not running interactively, don't do anything [ -z "$PS1" ] && return #Source global definitions @@ -134,7 +136,6 @@ alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' # Translate alias tbr='trans :pt-BR' - ####################################################### # WORK ####################################################### @@ -185,3 +186,4 @@ PS1="${CYAN}[\u@\h ${YELLOW}\w${GREEN}\$(parse_git_branch)${CYAN}]${WHITE}${RESE ####################################################### eval $(keychain --eval --quiet ry_ecdsa) eval $(keychain --eval --quiet id_rsa) + diff --git a/.config/doom/config.el b/.config/doom/config.el index 0808efc..a496b64 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -163,7 +163,7 @@ (defun opal/org-mode-visual-fill () (setq visual-fill-column-width 150 - visual-fill-column-center-text t) + visual-fill-column-center-text t) (visual-fill-column-mode 1)) (use-package visual-fill-column @@ -202,13 +202,16 @@ (global-set-key (kbd "C-c y") 'opal/play-yt-url-at-point) +(setq browse-url-browser-function 'browse-url-generic + browse-url-generic-program "/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community") + ;; Elfeed -(defun opal/elfeed-open-in-firefox () - "Open the current Elfeed entry link in Firefox." +(defun opal/elfeed-open-in-browser () + "Open the current Elfeed entry link in browser (LibreWolf)." (interactive) (let ((link (elfeed-entry-link (elfeed-search-selected :single)))) (if link - (browse-url-firefox link) + (browse-url link) (message "No link to open.")))) (defun opal/elfeed-open-in-eww() @@ -248,8 +251,8 @@ ;; Evil keybindings for Elfeed (evil-define-key 'normal elfeed-search-mode-map - "f" 'opal/elfeed-open-in-firefox ;; Open link in Firefox - "e" 'opal/elfeed-open-in-eww ;; Open link in Firefox + "f" 'opal/elfeed-open-in-browser ;; Open link in Browser + "e" 'opal/elfeed-open-in-eww ;; Open link in eww "r" 'opal/elfeed-mark-all-read ;; Marks all feeds as read "gr" 'elfeed-update ;; Refresh feeds "q" 'quit-window)) ;; Quit Elfeed diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 2b8118f..c31e2eb 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -1,4 +1,5 @@ [global] +geometry = "300x50-10+50" monitor = 0 follow = keyboard indicate_hidden = yes @@ -23,7 +24,7 @@ show_indicators = no icon_position = off sticky_history = yes history_length = 20 -browser = /usr/bin/icecat -new-tab +browser = /usr/bin/abrowser -new-tab always_run_script = true title = Dunst class = Dunst diff --git a/.config/mimeapps.list b/.config/mimeapps.list index c5a6fe4..fd62a29 100644 --- a/.config/mimeapps.list +++ b/.config/mimeapps.list @@ -1,22 +1,22 @@ [Added Associations] -video/mp4=org.videolan.VLC.desktop;org.kde.dragonplayer.desktop;mpv.desktop; -video/quicktime=org.videolan.VLC.desktop;org.kde.dragonplayer.desktop;mpv.desktop; +video/mp4=mpv.desktop; +video/quicktime=mpv.desktop; [Default Applications] -inode/directory=pcmanfm-qt -video/mp4=org.videolan.VLC.desktop; -video/quicktime=org.videolan.VLC.desktop +inode/directory=thunar +video/mp4=mpv.desktop; +video/quicktime=mpv.desktop -text/html=/usr/bin/firefox -application/xhtml+xml=/usr/bin/firefox -application/xml=/usr/bin/firefox -text/xml=/usr/bin/firefox -text/xsl=/usr/bin/firefox -application/rss+xml=/usr/bin/firefox -application/atom+xml=/usr/bin/firefox -x-scheme-handler/http=/usr/bin/firefox -x-scheme-handler/https=/usr/bin/firefox -x-scheme-handler/ftp=/usr/bin/firefox -x-scheme-handler/chrome=/usr/bin/firefox -x-scheme-handler/about=/usr/bin/firefox -x-scheme-handler/mailto=/usr/bin/firefox +text/html=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +application/xhtml+xml=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +application/xml=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +text/xml=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +text/xsl=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +application/rss+xml=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +application/atom+xml=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +x-scheme-handler/http=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +x-scheme-handler/https=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +x-scheme-handler/ftp=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +x-scheme-handler/chrome=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +x-scheme-handler/about=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community +x-scheme-handler/mailto=/var/lib/flatpak/exports/bin/io.gitlab.librewolf-community diff --git a/.config/sway/config b/.config/sway/config index 2c04853..5ac4ded 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -24,7 +24,7 @@ set $menu rofi -show # Start a terminal bindsym $mod+Return exec $term -# Start wofi +# Start rofi bindsym $mod+d exec $menu # Kill focused window @@ -43,6 +43,9 @@ bindsym $mod+Shift+c reload # Exit sway (logs you out of your Wayland session) # bindsym $mod+Shift+x exec swaymsg -r exit +# Reload the configuration file +bindsym $mod+Shift+comma exec /usr/bin/keepassxc + ## Volume bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +2% bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -2% @@ -163,53 +166,43 @@ bindsym $mod+Ctrl+g exec grimshot save window #bindsym $mod+Shift+e exec wlogout -p layer-shell # Bookmarks -bindsym $mod+Insert exec wtype $(grep -v '^#' ~/.local/share/bookmarks/bookmarks | bemenu -p Bookmark: -l 50 -c -M 500 --fn 'Terminus 16' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | cut -d ' ' -f1) +# bindsym $mod+Insert exec wtype $(grep -v '^#' ~/.local/share/bookmarks/bookmarks | bemenu -p Bookmark: -l 50 -c -M 500 --fn 'Terminus 16' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | cut -d ' ' -f1) -bindsym $mod+Shift+Insert exec ~/.local/bin/bookmark_insert +# bindsym $mod+Shift+Insert exec ~/.local/bin/bookmark_insert # Emojis -bindsym $mod+Shift+e exec wtype $(awk '{print $1, $0}' ~/.local/share/chars/emojis* | bemenu -p Emoji: -l 25 -c -M 500 --fn 'Noto Color Emoji,Terminus 16' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | awk '{print $1}') +# bindsym $mod+Shift+e exec wtype $(awk '{print $1, $0}' ~/.local/share/chars/emojis* | bemenu -p Emoji: -l 25 -c -M 500 --fn 'Noto Color Emoji,Terminus 16' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | awk '{print $1}') ####################### # EXECS ####################### -set $cursor-theme breeze_cursors -set $cursor-size 30 # Adjust to your desired size +set $gnome-schema org.gnome.desktop.interface -exec_always { - export XCURSOR_THEME=$cursor-theme - export XCURSOR_SIZE=$cursor-size + # Set GTK/icon theme +exec { + gsettings set $gnome-schema gtk-theme 'Arc-Darker' + gsettings set $gnome-schema icon-theme 'Papirus' + gsettings set $gnome-schema cursor-theme 'breeze_cursors' + gsettings set $gnome-schema cursor-size 30 + gsettings set $schema gtk-application-prefer-dark-theme true } -# set $gnome-schema org.gnome.desktop.interface - -# # Set GTK/icon theme -# exec_always { -# gsettings set $gnome-schema gtk-theme 'ArcDarker' -# gsettings set $gnome-schema icon-theme 'Papirus' -# gsettings set $gnome-schema cursor-theme 'Breeze' -# gsettings set $gnome-schema cursor-size 30 -# } - # Syncthing -exec /usr/bin/syncthing +exec /usr/bin/syncthing & # Notifications -exec_always pgrep -x dunst > /dev/null || dunst - -# Wlsunset (Night Light) -#exec_always pgrep -x wlsunset > /dev/null || wlsunset -l 47.6 -L -122.3 -t 2000 -T 3000 +exec pgrep -x dunst > /dev/null || dunst # Gammastep until wlsunset becomes a thing again: -exec_always pgrep -x gammastep > /dev/null || gammastep -l 47.6062:-122.3321 -t 3000:2500 +exec_always sleep 2 && pgrep -x gammastep > /dev/null || gammastep -l 47.6062:-122.3321 -t 3000:2500 # udiskie - auto usb mounting exec /usr/bin/udiskie & # Network Manager tray applet -exec_always pgrep -x nm-tray || /usr/bin/nm-tray +exec pgrep -x nm-tray || /usr/bin/nm-tray # Bluetooth manager tray applet exec /usr/bin/blueman-applet @@ -221,6 +214,9 @@ exec /usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1 exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK exec hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK +# Weather script (runs every 900 seconds, updates /tmp/weather.txt for swaybar to read from). +exec_always sleep 2 && ~/.config/sway/scripts/weather_swaybar.scm & + # Idle configuration #exec swayidle -w \ # timeout 3200 'swaymsg "output * dpms off"' \ @@ -246,6 +242,8 @@ set $opacity 0.9 for_window [class="Emacs"] opacity $opacity for_window [app_id="foot"] opacity $opacity for_window [app_id="strawberry"] opacity $opacity +for_window [class="KeePassXC"] opacity $opacity +for_window [class="KeePassXC"] floating enable #for_window [app_id="org.kde.polkit-kde-authentication-agent-1"] floating enable #for_window [app_id="bemenu"] floating enable #for_window [app_id="bemenu"] layer top @@ -282,7 +280,7 @@ input "1241:1031:USB-HID_Keyboard_Mouse" { accel_profile "flat" } -seat seat0 xcursor_theme Breeze_Light 30 +seat seat0 xcursor_theme breeze_cursors 30 # Hide mouse cursor after inactivity seat * hide_cursor 10000 diff --git a/.config/sway/scripts/bar.sh b/.config/sway/scripts/bar.sh index ca3b2ed..43e6703 100755 --- a/.config/sway/scripts/bar.sh +++ b/.config/sway/scripts/bar.sh @@ -93,11 +93,17 @@ get_volume() { echo -n " $VOLUME" else # Volume is muted, display mute icon - echo -n " Muted" + echo -n "󰖁 Muted" fi } +get_weather() { + temp=$(cat /tmp/weather.txt) + echo "$temp" +} + + while true; do - echo "$(get_volume) $(get_date) $(get_battery)" - sleep 1 + echo "$(get_weather) $(get_volume) $(get_date) $(get_battery)" + sleep 1 done diff --git a/.config/sway/scripts/weather_swaybar.scm b/.config/sway/scripts/weather_swaybar.scm new file mode 100755 index 0000000..f70f24e --- /dev/null +++ b/.config/sway/scripts/weather_swaybar.scm @@ -0,0 +1,91 @@ +#!/usr/bin/env guile-3.0 +!# + +(use-modules (web client) + (json) + (rnrs bytevectors) + (ice-9 receive) + (srfi srfi-18)) ;; For sleep functionality + +(define api-key "99631af2d6db903d1f689c7d2cb13764") +(define city-id "5809844") +(define units "metric") + +;; Construct the openweathermap URL with API token, city ID, and unit of measurement +(define weather-url + (format #f "http://api.openweathermap.org/data/2.5/weather?id=~a&units=~a&appid=~a" + city-id units api-key)) + +;; Define weather icons as an association list +(define weather-icons + '(("clear sky" . "☀️") + ("few clouds" . "🌤️") + ("scattered clouds" . "🌥️") + ("broken clouds" . "☁️") + ("overcast clouds" . "☁️") + ("shower rain" . "🌦️") + ("light rain" . "🌧️") + ("light intensity drizzle" . "🌧️") + ("rain" . "🌧️") + ("moderate rain" . "🌧️") + ("thunderstorm" . "⛈️") + ("snow" . "❄️") + ("mist" . "🌫️") + ("haze" . "🌫️") + ("smoke" . "🌫️") + ("fog" . "🌫️"))) + +;; Convert Celsius to Fahrenheit +(define (celsius-to-fahrenheit celsius) + (+ (* celsius (/ 9 5)) 32)) + +;; Get weather icon based on description +(define (get-weather-icon description) + (or (assoc-ref weather-icons description) "❓")) + +;; Parse and extract weather data from JSON +(define (extract-weather-data json-data) + (let* ((main (assoc "main" json-data)) + (temp-c (and main + (cdr (assoc "temp" (cdr main))))) + ;; Round and convert to exact integer + (temp-c-value (and temp-c + (inexact->exact + (round temp-c)))) + (weather-description + (cdr (assoc "description" + (vector-ref (cdr (assoc "weather" json-data)) 0))))) + ;; Return temperature (C, F), description, and icon + (values temp-c-value + (and temp-c-value + (inexact->exact + (round (celsius-to-fahrenheit temp-c-value)))) + weather-description + (get-weather-icon weather-description)))) + +;; Fetch and display weather data to a file +(define (get-weather) + ;; Request and parse the data + (receive (response-status response-body) + (http-request weather-url) + (let ((json-data (json-string->scm + (utf8->string response-body)))) + (call-with-values + (lambda () (extract-weather-data json-data)) + (lambda (temp-c temp-f description icon) + ;; Open file for writing + (call-with-output-file "/tmp/weather.txt" + (lambda (port) + ;; Write the weather information to the file + (if temp-c + (format port "~a ~d°C / ~d°F~%" icon temp-c temp-f) + (format port "Error: Temperature data not available.\n"))))))))) + +;; Run the script indefinitely, fetching weather every 900 seconds (15 minutes) +(define (run-indefinitely) + (let loop () + (get-weather) + (sleep 900) ;; Sleep for 900 seconds (15 minutes) + (loop))) + +(run-indefinitely)