Commit 844af60
xxwhirlpool
·
2025-06-06 10:15:15 -0400 EDT
parent 5b6b68c
add laptop conky config; minor edit to starship prompt
12 files changed,
+166,
-0
+3,
-0
| ... | ... | @@ -20,6 +20,9 @@ format = '[$user](bold lavender)[@](bold green)' | |
| 20 | 20 | [directory] | |
| 21 | 21 | style = "bold green" | |
| 22 | 22 | ||
| 23 | + | [[battery.display]] | |
| 24 | + | threshold = 0 | |
| 25 | + | ||
| 23 | 26 | [palettes.catppuccin_frappe] | |
| 24 | 27 | rosewater = "#f2d5cf" | |
| 25 | 28 | flamingo = "#eebebe" |
+3,
-0
| ... | ... | @@ -0,0 +1,3 @@ | |
| 1 | + | # laptop conky widget | |
| 2 | + | ||
| 3 | + | this widget is adapted from an existing widget on github, [now clocking](https://github.com/foxfirecodes/now-clocking), but with both widgets displayed at once using two systemd services (provided in this directory), and the music widget backend swapped to a custom script that leverages the lastFM API. |
+5,
-0
| ... | ... | @@ -0,0 +1,5 @@ | |
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | cd /home/kat/now-clocking | |
| 4 | + | ||
| 5 | + | conky -c /home/kat/now-clocking/widgets/np.lua |
+5,
-0
| ... | ... | @@ -0,0 +1,5 @@ | |
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | cd /home/kat/now-clocking | |
| 4 | + | ||
| 5 | + | conky -c /home/kat/now-clocking/widgets/npart.lua |
+42,
-0
| ... | ... | @@ -0,0 +1,42 @@ | |
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | URL="https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${USER}&api_key=${API_KEY}&format=json&limit=1" | |
| 4 | + | ||
| 5 | + | artist=$(curl -s ${URL} | jq -r '.recenttracks.track[0].artist."#text"') | |
| 6 | + | track=$(curl -s ${URL} | jq -r '.recenttracks.track[0].name') | |
| 7 | + | art=$(curl -s $URL | jq -r '.recenttracks.track[0].image[2]."#text"') | |
| 8 | + | ||
| 9 | + | tmp="/tmp" | |
| 10 | + | img_path="$tmp/lastfm-conky.png" | |
| 11 | + | ||
| 12 | + | getimg() { | |
| 13 | + | if [ -n "$art" ]; then | |
| 14 | + | if [[ "$art" = http* ]] || [[ "$art" = file:* ]]; then | |
| 15 | + | curl -s "$art" -o "$img_path" | |
| 16 | + | elif [ -f "$art" ]; then | |
| 17 | + | cp "$art" "$img_path" | |
| 18 | + | else | |
| 19 | + | echo "something wrong with art" | |
| 20 | + | exit 1 | |
| 21 | + | fi | |
| 22 | + | fi | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | showimg() { | |
| 26 | + | getimg | |
| 27 | + | if [ -f "$img_path" ] && [ "$(wc -c "$img_path" | awk '{print $1}')" -gt 0 ]; then | |
| 28 | + | echo "\${image $img_path -p 0,0 -s 125x125 -n}" | |
| 29 | + | else | |
| 30 | + | echo "\${image ./placeholder.png -p 0,0 -s 125x125}" | |
| 31 | + | fi | |
| 32 | + | } | |
| 33 | + | ||
| 34 | + | if [ "$1" == "artist" ]; then | |
| 35 | + | echo $artist | |
| 36 | + | elif [ "$1" == "track" ]; then | |
| 37 | + | echo $track | |
| 38 | + | elif [ "$1" == "art" ]; then | |
| 39 | + | showimg | |
| 40 | + | else | |
| 41 | + | exit 1 | |
| 42 | + | fi |
+0,
-0
Binaries are not rendered as diffs.
| ... | ... | @@ -0,0 +1,15 @@ | |
| 1 | + | [Unit] | |
| 2 | + | Description=Conky | |
| 3 | + | After=network.target | |
| 4 | + | ||
| 5 | + | [Service] | |
| 6 | + | Type=simple | |
| 7 | + | User=kat | |
| 8 | + | Group=kat | |
| 9 | + | Environment="DISPLAY=:0" | |
| 10 | + | ExecStart=/usr/bin/conky-start.sh | |
| 11 | + | Restart=always | |
| 12 | + | RuntimeMaxSec=30m | |
| 13 | + | ||
| 14 | + | [Install] | |
| 15 | + | WantedBy=multi-user.target |
| ... | ... | @@ -0,0 +1,15 @@ | |
| 1 | + | [Unit] | |
| 2 | + | Description=Conky | |
| 3 | + | After=network.target | |
| 4 | + | ||
| 5 | + | [Service] | |
| 6 | + | Type=simple | |
| 7 | + | User=kat | |
| 8 | + | Group=kat | |
| 9 | + | Environment="DISPLAY=:0" | |
| 10 | + | ExecStart=/usr/bin/conky-start2.sh | |
| 11 | + | Restart=always | |
| 12 | + | RuntimeMaxSec=30m | |
| 13 | + | ||
| 14 | + | [Install] | |
| 15 | + | WantedBy=multi-user.target |
| ... | ... | @@ -0,0 +1,39 @@ | |
| 1 | + | local M = {} | |
| 2 | + | ||
| 3 | + | ---extends the base config with the given overrides | |
| 4 | + | ---@param overrides table | |
| 5 | + | function M.extend_config(overrides) | |
| 6 | + | local config = { | |
| 7 | + | -- load common funcs | |
| 8 | + | lua_load = './widgets/lib/funcs.lua', | |
| 9 | + | ||
| 10 | + | -- run settings | |
| 11 | + | total_run_times = 0, | |
| 12 | + | update_interval = 1, | |
| 13 | + | ||
| 14 | + | -- positioning | |
| 15 | + | alignment = 'bottom_left', | |
| 16 | + | xinerama_head = tonumber(os.getenv("NOW_CLOCKING_DISPLAY") or 0), | |
| 17 | + | ||
| 18 | + | -- draw settings | |
| 19 | + | double_buffer = true, | |
| 20 | + | draw_shades = false, | |
| 21 | + | draw_blended = false, | |
| 22 | + | ||
| 23 | + | -- compositor settings | |
| 24 | + | own_window = true, | |
| 25 | + | own_window_argb_visual = true, | |
| 26 | + | own_window_argb_value = 0, | |
| 27 | + | own_window_transparent = true, | |
| 28 | + | own_window_type = 'desktop', | |
| 29 | + | own_window_hints = 'undecorated,below,skip_taskbar,sticky,skip_pager', | |
| 30 | + | } | |
| 31 | + | ||
| 32 | + | for k, v in pairs(overrides) do | |
| 33 | + | config[k] = v | |
| 34 | + | end | |
| 35 | + | ||
| 36 | + | return config | |
| 37 | + | end | |
| 38 | + | ||
| 39 | + | return M |
| ... | ... | @@ -0,0 +1,10 @@ | |
| 1 | + | function conky_now() | |
| 2 | + | -- current day of month | |
| 3 | + | local day_of_month = os.date("*t").day | |
| 4 | + | local suffix = day_of_month == 1 and "st" or day_of_month == 2 and "nd" or day_of_month == 3 and "rd" or "th" | |
| 5 | + | return os.date("%B " .. tostring(day_of_month) .. suffix .. " %Y") | |
| 6 | + | end | |
| 7 | + | ||
| 8 | + | function conky_textcolor() | |
| 9 | + | return "${color " .. (os.getenv("NOW_CLOCKING_TEXT_COLOR") or "#ffffff") .. "}" | |
| 10 | + | end |
+18,
-0
| ... | ... | @@ -0,0 +1,18 @@ | |
| 1 | + | conky.config = require("widgets.lib.common").extend_config { | |
| 2 | + | -- positioning | |
| 3 | + | gap_x = 50 + tonumber(os.getenv("NOW_CLOCKING_OFFSET_X") or 0), | |
| 4 | + | gap_y = 85 + tonumber(os.getenv("NOW_CLOCKING_OFFSET_Y") or 0), | |
| 5 | + | minimum_height = 200, | |
| 6 | + | ||
| 7 | + | -- text settings | |
| 8 | + | uppercase = true, | |
| 9 | + | use_xft = true, | |
| 10 | + | override_utf8_locale = true, | |
| 11 | + | }; | |
| 12 | + | ||
| 13 | + | conky.text = [[ | |
| 14 | + | ${eval ${lua textcolor}}${font JetBrains Mono:pixelsize=80}${time %H:%M:%S}${font JetBrains Mono:pixelsize=65} | |
| 15 | + | ${eval ${lua textcolor}}${font JetBrains Mono:pixelsize=35}${lua now} | |
| 16 | + | ${eval ${lua textcolor}}${font JetBrains Mono:pixelsize=44} ${font JetBrains Mono:style=bold:pixelsize=46}${exec ../lastfm.sh artist}${font Gotham:style=bold:pixelsize=10} | |
| 17 | + | ${eval ${lua textcolor}}${font JetBrains Mono:pixelsize=44} ${font JetBrains Mono:pixelsize=23}${exec ../lastfm.sh track} | |
| 18 | + | ]]; |
+11,
-0
| ... | ... | @@ -0,0 +1,11 @@ | |
| 1 | + | conky.config = require("widgets.lib.common").extend_config { | |
| 2 | + | -- positioning | |
| 3 | + | gap_x = 50 + tonumber(os.getenv("NOW_CLOCKING_OFFSET_X") or 0), | |
| 4 | + | gap_y = 115 + tonumber(os.getenv("NOW_CLOCKING_OFFSET_Y") or 0), | |
| 5 | + | minimum_width = 100, | |
| 6 | + | minimum_height = 100, | |
| 7 | + | }; | |
| 8 | + | ||
| 9 | + | conky.text = [[ | |
| 10 | + | ${execp ../lastfm.sh art} | |
| 11 | + | ]]; |