adding idle, idleinhibit waybar stuff, archiving old waybar stuff
This commit is contained in:
@@ -282,11 +282,12 @@ 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
|
exec hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||||
|
|
||||||
# Idle configuration
|
# Idle configuration
|
||||||
#exec swayidle -w \
|
exec swayidle -w \
|
||||||
# timeout 3200 'swaymsg "output * dpms off"' \
|
timeout 300 'swaylock -f' \
|
||||||
# resume 'swaymsg "output * dpms on"' \
|
timeout 600 'swaymsg "output * dpms off"' \
|
||||||
# before-sleep 'swaylock -f'
|
resume 'swaymsg "output * dpms on"' \
|
||||||
# timeout 15 'if pgrep -x swaylock; then swaymsg "output * dpms off"; fi' \
|
before-sleep 'swaylock -f' \
|
||||||
|
timeout 1800 'systemctl suspend'
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# DECORATIONS
|
# DECORATIONS
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"height": 44,
|
"height": 44,
|
||||||
"modules-left": ["sway/workspaces"],
|
"modules-left": ["sway/workspaces"],
|
||||||
"modules-center": ["clock","custom/padd","custom/weather"],
|
"modules-center": ["clock","custom/padd","custom/weather"],
|
||||||
"modules-right": ["custom/l_end","custom/music","custom/padd","pulseaudio","custom/padd","network", "custom/padd","battery","custom/padd", "tray","custom/power","custom/padd"],
|
"modules-right": ["custom/l_end","custom/music","custom/padd","idle_inhibitor","custom/padd","pulseaudio","custom/padd","network", "custom/padd","battery","custom/padd","tray","custom/power","custom/padd"],
|
||||||
"sway/workspaces": {
|
"sway/workspaces": {
|
||||||
"disable-scroll": true,
|
"disable-scroll": true,
|
||||||
"all-outputs": true,
|
"all-outputs": true,
|
||||||
@@ -67,14 +67,13 @@
|
|||||||
"on-scroll-down": "amixer set Master 3%-",
|
"on-scroll-down": "amixer set Master 3%-",
|
||||||
"format": "",
|
"format": "",
|
||||||
"format": "{icon} {volume}%",
|
"format": "{icon} {volume}%",
|
||||||
"format-muted": "",
|
"format-muted": "",
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"headset": "",
|
"headset": "",
|
||||||
"headphone": "",
|
"headphone": "",
|
||||||
"default": ["", "", ""]
|
"default": ["", "", ""]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"custom/power": {
|
"custom/power": {
|
||||||
"format": "",
|
"format": "",
|
||||||
//"exec": "echo ; echo logout",
|
//"exec": "echo ; echo logout",
|
||||||
@@ -123,5 +122,13 @@
|
|||||||
"format": " ",
|
"format": " ",
|
||||||
"interval" : "once",
|
"interval" : "once",
|
||||||
"tooltip": false
|
"tooltip": false
|
||||||
|
},
|
||||||
|
"idle_inhibitor": {
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"activated": "",
|
||||||
|
"deactivated": ""
|
||||||
|
},
|
||||||
|
"timeout": 30.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env guile3.0
|
|
||||||
!#
|
|
||||||
|
|
||||||
(use-modules (ice-9 popen)
|
|
||||||
(ice-9 rdelim))
|
|
||||||
|
|
||||||
;; Function to get playerctl metadata
|
|
||||||
(define (get-playerctl-metadata field)
|
|
||||||
(let* ((command (string-append "playerctl --player=strawberry metadata " field))
|
|
||||||
(port (open-input-pipe command))
|
|
||||||
(output (read-line port)))
|
|
||||||
(close-pipe port)
|
|
||||||
output))
|
|
||||||
|
|
||||||
;; Function to abbreviate a string if it's longer than max-length
|
|
||||||
(define (abbreviate text max-length)
|
|
||||||
(if (> (string-length text) max-length)
|
|
||||||
(string-append (substring text 0 (- max-length 3)) "...")
|
|
||||||
text))
|
|
||||||
|
|
||||||
(define music-note "🎵")
|
|
||||||
|
|
||||||
;; Main logic to display artist and title
|
|
||||||
(let* ((artist (get-playerctl-metadata "artist"))
|
|
||||||
(title (get-playerctl-metadata "title"))
|
|
||||||
(display-text
|
|
||||||
(if (and (string? artist) (string? title))
|
|
||||||
(abbreviate (string-append artist " - " title) 30)
|
|
||||||
#f))) ;; Set to #f if artist or title is not available
|
|
||||||
(if display-text
|
|
||||||
(begin
|
|
||||||
(display music-note) ;; Display the music note icon
|
|
||||||
(display " ")
|
|
||||||
(display display-text)
|
|
||||||
(newline))
|
|
||||||
(display "")))
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
#!/usr/bin/env guile3.0
|
|
||||||
!#
|
|
||||||
|
|
||||||
(use-modules (web client)
|
|
||||||
(json)
|
|
||||||
(rnrs bytevectors)
|
|
||||||
(ice-9 receive))
|
|
||||||
|
|
||||||
(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
|
|
||||||
(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)
|
|
||||||
;; For debugging
|
|
||||||
;;(format #t "Description: ~a ~%" description)
|
|
||||||
|
|
||||||
;; Display the weather information
|
|
||||||
(if temp-c
|
|
||||||
(format #t "~a ~d°C / ~d°F~%"
|
|
||||||
icon temp-c temp-f)
|
|
||||||
(display "Error: Temperature data not available.\n")))))))
|
|
||||||
|
|
||||||
(get-weather)
|
|
||||||
1
archive/waybar
Symbolic link
1
archive/waybar
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../code/opalfiles/.config/waybar
|
||||||
Reference in New Issue
Block a user