Compare commits

..
63 Commits
Author SHA1 Message Date
Daniele Fucini be065bef95 picom: never unredirect for mpv
Fullscreen mpv was unredirected and left the HDMI output (reverse PRIME sink) black, as i3lock did.
2026-11-21 15:11:38 +01:00
Daniele Fucini 9e2b6d52bb gamemode: add config, keep the powersave governor
The performance governor didn't lower temps or improve smoothness, since the CPU is heat-limited at 95 °C anyway.
2026-11-21 11:07:23 +01:00
Daniele Fucini 85796d4c39 picom: never unredirect for i3lock
With unredir-if-possible, the fullscreen i3lock window made picom unredirect, which left the HDMI output (reverse PRIME sink) black while locked.
2026-11-20 08:32:39 +01:00
Daniele Fucini 6e587622f0 picom: unredirect fullscreen windows
Fullscreen games bypass the compositor, saving CPU work and latency.
2026-11-19 19:02:32 +01:00
Daniele Fucini 5fa637ef79 MangoHud: add 60/30 fps cap toggle, show only the NVIDIA GPU
Shift_L+F1 cycles 60, 30 and unlimited. Drop GPU power and fan, which the laptop doesn't report.
2026-11-19 19:02:26 +01:00
Daniele Fucini a5f7d9507f fish: drop cookie and calcurse from shell startup
New interactive shells no longer print a fortune or the 7-day calcurse agenda; the xmobar calcurse widget and the daily reminder cover upcoming events.
2026-11-19 17:12:27 +01:00
Daniele Fucini 394e1d4d58 MangoHud: add thermal-focused overlay config
Starts hidden; Shift_R+F12 toggles it. Shows GPU/CPU load, temperature and clock, plus GPU power, fan and throttling, VRAM/RAM, FPS and frame time.
2026-11-19 17:11:39 +01:00
Daniele Fucini 108f71e711 xmonad: fix urgency marker and ws 3 focus, simplify hooks
Enable withUrgencyHook so ppUrgent works, focus ws 3 when it opens on HDMI, and
make ppOrder total. Track discover-overlay windows instead of scanning the tree
on every log hook. Group manage rules with classIn, deduplicate the layouts and
scratchpads, and use wpctl for all volume keys.
2026-11-17 21:47:48 +01:00
Daniele Fucini 7e8328bf60 xmonad: swap the RiseupVPN scratchpad for Windscribe
Windscribe moves itself to a saved position after mapping, so an event hook
drops its move requests (resizes still apply) to keep it at the scratchpad's spot.
2026-11-17 18:42:27 +01:00
Daniele Fucini 49141ef177 xmobar: show NVIDIA GPU load and temperature
Add gpu.sh, which reads both values from nvidia-smi and colors them like the CPU ones (load 25/75, temp 75/90), and show it between CPU and memory.
2026-11-16 21:42:30 +01:00
Daniele Fucini 478e4d391e Retry i3lock when a keyboard grab blocks it
i3lock exits if another client holds a grab, leaving the screen blanked but
unlocked. Close gcr-prompter (ssh passphrase dialog) first, retry every 2s up
to 30 times and log failures to the journal (tag screen-lock).
2026-11-16 20:57:18 +01:00
Daniele Fucini e2fd3e4aa9 xmonad: restore floating windows after leaving fullscreen
Remember each window's float rect when it goes fullscreen and put it back on exit,
instead of always sinking it (Viewnior after F5). Windows with no record are still sunk.
2026-11-14 19:43:37 +01:00
Daniele Fucini 4a96319bb2 Merge the database dump scripts into db-dump
garmin-dump, weather-dump and library-dump differed only in project, database and rotation; one
db-dump PROJECT DATABASE week|day replaces them. The units keep their names and only change ExecStart.
2026-11-14 15:49:48 +01:00
Daniele Fucini faad434dad aurb: keep ThinLTO cache entries until the size cap
lld expires entries unused for a week by default, which empties the cache between most package rebuilds; prune_after=0s leaves only the 10 GB cap.
2026-11-13 21:27:56 +01:00
Daniele Fucini 9896d9bb21 xmobar: draw the weather icon larger
Add a 13 pt additional font and use it for the weather icon only, so the
rest of the bar and its height are unchanged.
2026-11-13 18:39:53 +01:00
Daniele Fucini 248a9b7d1f xmobar: treat CAVOK/NSC weather reports as clear
NOAA's decoded METAR has no sky conditions line for CAVOK or NSC, so the
weather showed a generic cloud icon and "Unknown"; read them from the raw
observation as clear.
2026-11-13 18:23:14 +01:00
Daniele Fucini 216e1bff0f xmobar: toggle mute on volume click
Left-clicking the volume widget toggles mute on the default sink, so it
works for speakers and headphones alike.
2026-11-12 21:26:39 +01:00
Daniele Fucini 472bf7246b xmobar: show current weather details on click
Clicking the weather now runs weather.sh notify, which shows the
description and temperature; the forecast keeps its ens-forecast week
notification.
2026-11-12 19:24:15 +01:00
Daniele Fucini 0d1cb6cf2a xmonad: fix Signal not moving to the chat workspace
Signal 8.x sets its WM_CLASS to lowercase "signal", so the case-sensitive "Signal" rule no longer matched. Merge it with the discord rule into a case-insensitive classIn.
2026-11-12 18:58:39 +01:00
Daniele Fucini 96903a4d22 Show a weather condition icon in xmobar
Replace the Weather plugin with weather.sh, which picks an icon from the METAR weather/sky and uses moon icons when the sun is down.
2026-11-12 16:54:08 +01:00
Daniele Fucini ce1cd479df Remove gsimplecal calendar popup from xmobar date
Drop the click action on the date and its xmonad float rule; delete the gsimplecal config.
2026-11-12 16:38:42 +01:00
Daniele Fucini c103510786 xmobar: show the next calcurse appointment
Time of today's next appointment, or an icon for a whole-day event today or an appointment tomorrow; click lists both days, right-click opens the calcurse scratchpad. Uptime dropped and the date shortened to make room.
2026-11-12 16:03:00 +01:00
Daniele Fucini 3053b35f26 calcurse: enable automatic note garbage collection
Removes note files no longer linked to any item on each save, instead of running calcurse -g by hand.
2026-11-12 15:40:55 +01:00
Daniele Fucini a260a42352 calcurse: tag appointment alerts with app name and icon
Matches the other calcurse notifications, so dunst rules can target them.
2026-11-12 15:38:16 +01:00
Daniele Fucini 566ac562bd calcurse: one-click Google login renewal
On expiry calcurse-sync starts calcurse-relogin, a notification that opens the consent page when clicked and catches the OAuth code on 127.0.0.1:8749. dunst's left-click now runs a notification's action before closing it.
2026-11-12 14:35:56 +01:00
Daniele Fucini 3bb25669ea calcurse: sync with Google Calendar via calcurse-caldav
Hourly timer started from xmonad, plus UI hooks that sync before load and after exit. calcurse-sync notifies once when the OAuth login expires and restarts the daemon after imports, since it never re-reads its files.
2026-11-12 14:16:36 +01:00
Daniele Fucini 84eec8c855 calcurse: notify whole-day events every morning
The calcurse daemon only alerts timed appointments, so birthdays went unnoticed. A daily 09:00 timer, started from xmonad and persistent across suspend, sends today's events through notify-send.
2026-11-12 11:27:30 +01:00
Daniele Fucini f6015f8d98 xmobar: use the ens-forecast brief subcommand 2026-11-10 18:52:46 +01:00
Daniele Fucini 7aa423b6d6 Update cursor 2026-11-07 10:44:05 +01:00
Daniele Fucini b5c268ae7d xmobar: show reboot and .pacnew markers in the updates segment
Red R until the reboot, blue P until the files are merged, read from
update-notify's pending file; markers show alone when there are no updates.
2026-11-07 10:41:36 +01:00
Daniele Fucini 0ec1272df6 Remove unused clean-aurutils-cache alias 2026-11-06 20:07:54 +01:00
Daniele Fucini 6f4aa3806f xmonad: keep the wallpaper on login and monitor hotplug
Startup and hotplug now pass --keep-wallpaper to screen-layout, so only fehbg.timer picks new random wallpapers.
2026-11-05 17:36:19 +01:00
Daniele Fucini 9da7cc8105 xmobar: show forecast frost/snow/heat probabilities as icons
The bar's forecast line now uses Nerd Font weather glyphs instead of the
words, like the rain drop; the week notification keeps the words.
2026-11-05 17:03:53 +01:00
Daniele Fucini 93b5bcbf30 claude-rc: add the ens-forecast MCP server
Register ens-forecast-mcp, allow its tools in the shared session and document the weather_ro login it needs.
2026-11-05 09:50:42 +01:00
Daniele Fucini 4c5ca29f6e lf: open HTML files in the browser 2026-11-05 09:50:35 +01:00
Daniele Fucini 8bfd577b20 xmobar: raise color thresholds for temps and memory
CPU temp 70/90, memory 50/80, weather 0/30 with orange instead of red for hot weather.
2026-11-01 11:50:09 +01:00
Daniele Fucini 3a2d2b7c37 Add the shared Claude Remote Control setup
Units, settings and setup README for the claude-rc user, which serves my projects' read-only MCP servers to the Claude app (negsplit for now).
2026-11-01 11:06:58 +01:00
Daniele Fucini 51b2bbeff8 Fix mutt's urlscan and HTML view macros
Use <pipe-message> for urlscan (pipe-entry doesn't exist in the pager) and bind it in the index too. Open HTML attachments in Zen instead of Vivaldi, from ~/.cache/mutt/html, which the firejail profiles share. Prune cached messages deleted on the server.
2026-11-01 08:15:00 +01:00
Daniele Fucini b76ae5c3f6 Enlarge the gsimplecal calendar opened from the xmobar date
gsimplecal has no size option, so launch it with GDK_DPI_SCALE=1.25 to scale it up for that process only.
2026-10-31 21:43:52 +01:00
Daniele Fucini 90a81ea960 Add a weekly dump of the Weather database
weather-dump.timer runs weather-dump weekly, keeping the two newest ISO weeks in
~/.local/share/ens-forecast/dumps, which simple_backup then copies; the login comes
from ~/.config/ens-forecast/dump.cnf (not tracked).
2026-10-31 19:00:06 +01:00
Daniele Fucini 5b6e381c89 Raise dunst's maximum notification height to 600 px
The xmobar click list of pending updates was cut off at 300 px.
2026-10-31 11:33:17 +01:00
Daniele Fucini 10bfc025c3 Open a gsimplecal calendar by clicking the xmobar date
Float gsimplecal in xmonad; its config opens it at the mouse and closes it on unfocus.
2026-10-31 11:31:32 +01:00
Daniele Fucini 831238e040 Add a weekly dump of the Garmin database
garmin-dump.timer runs garmin-dump weekly, keeping the two newest ISO weeks in
~/.local/share/negsplit/dumps, which simple_backup then copies; the login comes
from ~/.config/negsplit/dump.cnf (not tracked).
2026-10-31 11:30:03 +01:00
Daniele Fucini cc8eaebd5f Switch keyboard layout by clicking the xmobar indicator
Left-click cycles it -> us -> sk(qwerty), right-click cycles backwards, via a
new kbd_cycle.sh that calls setxkbmap like the M-i/M-u/M-s keys.
2026-10-30 21:25:57 +01:00
Daniele Fucini a41afe4983 Enlarge xmobar font to 10 and fit the bar's contents to its width
Workspaces show only their icon, layouts show an icon instead of their name, and window titles share a 60-character budget (8–30 each), so more windows get shorter titles instead of overflowing the bar.
2026-10-28 19:50:11 +01:00
Daniele Fucini 4e431d6710 Make xmobar and trayer 24px tall and match trayer's background to xmobar
xmobar was auto-sized (17px) and trayer 18px; both are now 24px. trayer only
honours --tint with --transparent, so it drew the GTK background instead.
2026-10-26 17:55:26 +01:00
Daniele Fucini 68bbcaeb82 Add a keybinding list on M-F1; match games by class pattern; update workspace icons
All keys get descriptions (NamedActions) and M-F1 lists them in dmenu. Proton
and Wine games go to ws 3 by class prefix/suffix instead of one rule per game;
GIMP and Audacity go to ws 5; small tools float; new icons for ws 2-7.
2026-10-26 17:49:04 +01:00
Daniele Fucini efea899ccb Pause dunst while the screen is locked; add notification history keys
screen-lock holds notifications until unlock, and M-S-l now goes through
loginctl lock-session so it uses the same locker. M-S-n pops dunst history,
M-C-n closes all notifications.
2026-10-26 17:31:03 +01:00
Daniele Fucini 15e6dfebb7 Hide the NSP workspace in xmobar while it's empty 2026-10-25 21:23:41 +01:00
Daniele Fucini 5d8620560a Strip stock example comments from kitty, mpd, ncmpcpp, picom and mutt configs
Keep only the active settings; behaviour is unchanged apart from dropping an empty picom rule. kitty keeps its theme markers.
2026-10-25 21:18:47 +01:00
Daniele Fucini 496c16ab07 Lighten mpv rendering and trim mpv.conf
Use high-quality instead of the deprecated gpu-hq, drop the expensive ewa_lanczossharp chroma scaling, switch to hwdec=auto-safe and remove the stock example comments.
2026-10-25 21:10:09 +01:00
Daniele Fucini d0684b5200 Drop mpris-proxy so headphone buttons reach playerctld
mpris-proxy registers every MPRIS player with BlueZ, which then sends AVRCP
commands to one of them (mpd). With it disabled, BlueZ sends the buttons as
media keys, which xmonad passes to playerctl.
2026-10-25 20:58:03 +01:00
Daniele Fucini 5e8fa266d7 Control media players with playerctl from media keys and headphones
Run playerctld as a dbus unit with Restart=on-failure, start it through that
unit on D-Bus activation, tie mpris-proxy to it, and bind the XF86 media keys
to playerctl in xmonad.
2026-10-25 19:41:22 +01:00
Daniele Fucini cd439be109 Add a daily dump of the Library database
library-dump.timer writes Library-<weekday>.sql.gz to
~/.local/share/library_manager/dumps, which simple_backup then copies;
the login comes from ~/.config/library_manager/dump.cnf (not tracked).
2026-10-25 19:05:24 +01:00
Daniele Fucini 2718d8531e Let fehbg.service write the wallpaper cache
ProtectHome=read-only stopped the timer from writing ~/.cache/wallpapers, so it failed without a cache and otherwise kept redrawing the same images.
2026-10-25 15:16:44 +01:00
Daniele Fucini 12affc76f7 Add an xmobar indicator and daily reminder for overdue backups
backup.sh shows the days since the last simple_backup (orange from 7,
red from 14); backup-reminder.timer notifies daily once it is overdue.
2026-10-25 12:40:38 +01:00
Daniele Fucini ffe2039de5 Clean downloaded sources from AUR clones after aurs
After a successful sync, aurb runs git clean -fx in each clone under the aurutils sync folder, removing downloaded sources and build logs while keeping tracked files and VCS source folders.
2026-10-24 22:17:23 +02:00
Daniele Fucini 638f7e3dd9 Run discover-overlay-wait as a user unit and rework the vidthumb cache
vidthumb names thumbnails by a hash of path, size and mtime instead of a jq index that broke on quotes in filenames; systemd-tmpfiles removes ones unused for 30 days. discover-overlay-wait now runs from a systemd user unit started by xmonad and logs to the journal.
2026-10-24 22:08:49 +02:00
Daniele Fucini 3e5824a590 Keep the games workspace on the HDMI screen
Wine games lose the mouse when their window moves between screens. safeView replaces greedyView for mod-N, xmobar clicks and mpv so workspace 3 always opens on screen 0 and is never swapped away; safeRescreen keeps a hidden workspace 3 off the laptop screen when screens change.
2026-10-24 20:27:52 +02:00
Daniele Fucini b10970bf36 Keep the wallpaper when movie restores the screen layout
.fehbg now saves its random picks to ~/.cache/wallpapers and redraws them with
--keep; screen-layout passes this through with --keep-wallpaper, used by movie.
2026-10-24 16:31:02 +02:00
Daniele Fucini 12ba85b83b Replace xautolock with xss-lock, xidle-dim and xidle-inhibit
The screen dims after 590s and locks 10s later with i3lock-color through the new
screen-lock script; DPMS turns it off after 15 minutes.
2026-10-24 16:31:02 +02:00
Daniele Fucini 3ff5c20cb5 Clarify that kernel PKGBUILDs set their own toolchain in aurutils-makepkg.conf 2026-10-24 16:30:56 +02:00
Daniele Fucini 43758f2c0e Add README 2026-10-18 22:47:02 +02:00
71 changed files with 1373 additions and 4116 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
Xcursor.theme: Dracula Xcursor.theme: Dracula-cursors
*.Dialog.bodyFont: Jetbrains Mono Nerd Font *.Dialog.bodyFont: Jetbrains Mono Nerd Font
*.Dialog.headingFont: Jetbrains Mono Nerd Font *.Dialog.headingFont: Jetbrains Mono Nerd Font
+1 -3
View File
@@ -1,6 +1,5 @@
# Aliases # Aliases
alias cat='bat' alias cat='bat'
alias clean-aurutils-cache='find ~/.cache/aurutils/sync -type d -name .git -execdir git clean -xi \;'
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
alias cookie='fortune /usr/share/fortune/asoiaf /usr/share/fortune/startrek | cowthink | lolcat -p 2.0 -F 0.3 -a -d 1' alias cookie='fortune /usr/share/fortune/asoiaf /usr/share/fortune/startrek | cowthink | lolcat -p 2.0 -F 0.3 -a -d 1'
alias fastfetch='hyfetch --distro=arch' alias fastfetch='hyfetch --distro=arch'
@@ -15,8 +14,7 @@ alias sort='sort -n'
alias scrcpy='scrcpy --disable-screensaver' alias scrcpy='scrcpy --disable-screensaver'
alias ssh='kitten ssh' alias ssh='kitten ssh'
alias sudo='doas' alias sudo='doas'
#alias trayer='trayer -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --transparent true --tint 0x232634 --height 18 --monitor 1' alias trayer='trayer -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --transparent true --alpha 0 --tint 0x24283b --height 24 --monitor 1'
alias trayer='trayer -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x232634 --height 18 --monitor 1'
alias trc='trash-empty' alias trc='trash-empty'
alias trl='trash-list' alias trl='trash-list'
alias trm='trash-rm' alias trm='trash-rm'
+29
View File
@@ -0,0 +1,29 @@
# Thermal-focused overlay; starts hidden, Shift_R+F12 toggles it.
no_display
toggle_hud=Shift_R+F12
position=top-left
font_size=20
background_alpha=0.4
# Divisors of 60 Hz only; Shift_L+F1 cycles 60 -> 30 -> unlimited.
fps_limit=60,30,0
toggle_fps_limit=Shift_L+F1
fps_limit_method=late
# GPU0 is the Intel iGPU (no temp, power or VRAM); only show the NVIDIA one.
gpu_list=1
gpu_stats
gpu_temp
gpu_core_clock
throttling_status
cpu_stats
cpu_temp
cpu_mhz
vram
ram
fps
frametime
frame_timing
+1 -1
View File
@@ -2,4 +2,4 @@
# Here rather than in LDFLAGS: old libtool (<2.4.7) drops -fuse-ld=lld, and these then reach GNU ld. # Here rather than in LDFLAGS: old libtool (<2.4.7) drops -fuse-ld=lld, and these then reach GNU ld.
-fuse-ld=lld -fuse-ld=lld
-Wl,--thinlto-cache-dir=/home/fuxino/.cache/thinlto -Wl,--thinlto-cache-dir=/home/fuxino/.cache/thinlto
-Wl,--thinlto-cache-policy=cache_size_bytes=10g -Wl,--thinlto-cache-policy=cache_size_bytes=10g:prune_after=0s
+2 -2
View File
@@ -168,8 +168,8 @@ SRCEXT='.src.tar.gz'
export CCACHE_DIR=/home/fuxino/.cache/ccache export CCACHE_DIR=/home/fuxino/.cache/ccache
# clang + lld + ThinLTO, only when aurb prepends AURB_CLANG=1 (its default; `aurb --gcc` doesn't). # clang + lld + ThinLTO, only when aurb prepends AURB_CLANG=1 (its default; `aurb --gcc` doesn't).
# update-kernel uses this file as is, so the kernels stay on gcc. Linker flags live in clang.cfg # update-kernel uses this file as is; the kernels' toolchain is set only by their PKGBUILDs (LLVM=1).
# (lld + ThinLTO cache); aurb bind-mounts its dir and the ThinLTO cache dir. # Linker flags live in clang.cfg (lld + ThinLTO cache); aurb bind-mounts its dir and the ThinLTO cache dir.
if [[ -n ${AURB_CLANG-} ]]; then if [[ -n ${AURB_CLANG-} ]]; then
export CC="clang --config=/home/fuxino/.config/aurb/clang.cfg" export CC="clang --config=/home/fuxino/.config/aurb/clang.cfg"
export CXX="clang++ --config=/home/fuxino/.config/aurb/clang.cfg" export CXX="clang++ --config=/home/fuxino/.config/aurb/clang.cfg"
+2 -2
View File
@@ -20,7 +20,7 @@ format.notifytime=%T
format.appointmenttime=%H:%M format.appointmenttime=%H:%M
format.outputdate=%F format.outputdate=%F
format.dayheading=%B %e, %Y format.dayheading=%B %e, %Y
general.autogc=no general.autogc=yes
general.autosave=yes general.autosave=yes
general.confirmdelete=yes general.confirmdelete=yes
general.confirmquit=yes general.confirmquit=yes
@@ -28,6 +28,6 @@ general.firstdayofweek=monday
general.multipledays=yes general.multipledays=yes
general.periodicsave=0 general.periodicsave=0
general.systemevents=yes general.systemevents=yes
notification.command=calcurse --next | xargs -0 notify-send "Appointment" notification.command=calcurse --next | xargs -0 notify-send -a calcurse -i x-office-calendar "Appointment"
notification.notifyall=all notification.notifyall=all
notification.warning=3600 notification.warning=3600
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
# Sync the UI's saved changes once it exits (syncing while it runs would change files under it).
[ "$(ps -o args= -p "$PPID")" = calcurse ] && [ "$(ps -o tty= -p "$PPID" | tr -d ' ')" != '?' ] || exit 0
# shellcheck disable=SC2016 # $1 expands in the inner shell
setsid -f sh -c 'while kill -0 "$1" 2>/dev/null; do sleep 1; done; systemctl --user start calcurse-sync.service' \
sh "$PPID" >/dev/null 2>&1
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
# Sync with Google before the UI loads. Non-interactive calls (-Q, -d, -i, calcurse-caldav's own) run this hook
# too, so act only for the UI: a bare "calcurse" with a terminal (the daemon is bare too, but has none).
[ "$(ps -o args= -p "$PPID")" = calcurse ] && [ "$(ps -o tty= -p "$PPID" | tr -d ' ')" != '?' ] || exit 0
calcurse-sync --now 2>&1 | systemd-cat -t calcurse-sync
+88
View File
@@ -0,0 +1,88 @@
# Always-on Remote Control
Reference copy of a machine setup: Claude Code Remote Control running as its own system user `claude-rc`, so my
projects' read-only MCP servers (now: negsplit, ens-forecast) can be used from the Claude app on the phone. One user and one
session (`data`) for all projects. The user holds only read-only database logins; Bash runs sandboxed without
network and can't read them (only the MCP servers, which run outside the sandbox, do). Nothing secret in this
folder: the ntfy topic lives only in `/etc/claude-rc-notify.env`.
Needs `claude-code`, `bubblewrap`, `socat` and each project's MCP server installed. Per project:
- negsplit: the installed `negsplit` (with `python-mcp`) and the `garmin_ro` grants from its
`sql/garmin_ro_grants.sql`. A per-user query limit is a useful safety net (the session can lift it):
```
mariadb -u root -p -e "ALTER USER 'garmin_ro'@'localhost' WITH MAX_STATEMENT_TIME 30;"
```
- ens-forecast: the installed `ens-forecast-mcp` (with `python-mcp` and `python-mysqlclient`) and the `weather_ro`
grant from its `sql/weather_grants.sql`; the same safety net:
```
mariadb -u root -p -e "ALTER USER 'weather_ro'@'localhost' WITH MAX_STATEMENT_TIME 30;"
```
## Setup
Run from this folder. User and folders:
```
doas useradd --system --create-home --home-dir /var/lib/claude-rc --shell /usr/bin/nologin claude-rc
doas chmod 700 /var/lib/claude-rc
doas install -d -o claude-rc -g claude-rc -m 700 /var/lib/claude-rc/.config /var/lib/claude-rc/.claude /var/lib/claude-rc/data /var/lib/claude-rc/data/.claude
doas install -o claude-rc -g claude-rc -m 644 mcp.json /var/lib/claude-rc/data/.mcp.json
doas install -o claude-rc -g claude-rc -m 644 project-settings.json /var/lib/claude-rc/data/.claude/settings.json
doas install -o claude-rc -g claude-rc -m 644 user-settings.json /var/lib/claude-rc/.claude/settings.json
```
`strictAllowlist` must stay in the user settings: in project settings it has no effect.
Each project's config holds only a `[readonly]` section. negsplit (`garmin_ro`):
```
doas install -d -o claude-rc -g claude-rc -m 700 /var/lib/claude-rc/.config/negsplit
doas install -o claude-rc -g claude-rc -m 600 config.toml /var/lib/claude-rc/.config/negsplit/config.toml
```
ens-forecast (`weather_ro`): only the `[readonly]` section of my own config, so the password never shows:
```
doas install -d -o claude-rc -g claude-rc -m 700 /var/lib/claude-rc/.config/ens-forecast
awk '/^\[/ { keep = ($0 == "[readonly]") } keep' ~/.config/ens-forecast/config.toml | doas install -o claude-rc -g claude-rc -m 600 /dev/stdin /var/lib/claude-rc/.config/ens-forecast/config.toml
```
Log in, trust the folder and enable Remote Control once, interactively:
```
doas -u claude-rc sh -c 'cd /var/lib/claude-rc/data && exec claude auth login'
doas -u claude-rc sh -c 'cd /var/lib/claude-rc/data && exec claude'
doas -u claude-rc sh -c 'cd /var/lib/claude-rc/data && exec claude remote-control --name data --spawn session'
```
ntfy topic for the failure alert (subscribe to it on ntfy.sh), then the units:
```
doas sh -c 'umask 077; printf "NTFY_TOPIC=claude-rc-%s\n" "$(openssl rand -hex 16)" > /etc/claude-rc-notify.env'
doas install -m 644 claude-rc.service claude-rc-notify.service claude-rc-recover.service claude-rc-recover.timer -t /etc/systemd/system/
doas systemctl daemon-reload
doas systemctl enable --now claude-rc.service claude-rc-recover.timer
```
The service restarts with a growing delay (30 s to 10 min); after about 50 minutes of failures it gives up and
sends the alert. The timer restarts it every 3 hours if it gave up, so a long network outage doesn't stop it for
good. After upgrading a project's MCP server, or changing `mcp.json` or the settings, restart `claude-rc.service`
so phone sessions use the new version.
## Adding a project
Add its server to `mcp.json` and `mcp__<server>` to the `allow` list in `project-settings.json` (plus a `Read` rule
for its chart folder, if any), install its `[readonly]` config as above, reinstall the changed files and restart
the service.
## Dead login
```
doas systemctl stop claude-rc.service
doas -u claude-rc sh -c 'cd /var/lib/claude-rc/data && exec claude auth login'
doas systemctl reset-failed claude-rc.service
doas systemctl start claude-rc.service
```
@@ -0,0 +1,13 @@
[Unit]
Description=Notify via ntfy that Claude Remote Control stopped
[Service]
Type=oneshot
DynamicUser=yes
# NTFY_TOPIC=...: root-only (0600), the topic is the only secret
EnvironmentFile=/etc/claude-rc-notify.env
TimeoutStartSec=10min
ExecStart=/usr/bin/curl -fsS -m 30 --retry 5 --retry-delay 60 --retry-all-errors \
-H "Title: Claude Remote Control stopped" -H "Tags: warning" \
-d "%H: claude-rc.service keeps failing (dead login?). Retried every 3 h; fix at home: claude auth login as claude-rc." \
https://ntfy.sh/${NTFY_TOPIC}
@@ -0,0 +1,8 @@
[Unit]
Description=Restart Claude Remote Control if it gave up (e.g. after a long network outage)
[Service]
Type=oneshot
ExecCondition=/usr/bin/systemctl is-failed --quiet claude-rc.service
ExecStart=/usr/bin/systemctl reset-failed claude-rc.service
ExecStart=/usr/bin/systemctl start --no-block claude-rc.service
@@ -0,0 +1,9 @@
[Unit]
Description=Every 3 h, restart Claude Remote Control if it gave up
[Timer]
OnBootSec=1h
OnUnitActiveSec=3h
[Install]
WantedBy=timers.target
+39
View File
@@ -0,0 +1,39 @@
[Unit]
Description=Claude Code Remote Control (read-only MCP servers)
Wants=network-online.target
After=network-online.target mariadb.service
# about 50 min of failed starts (back-off below): give up and notify
StartLimitIntervalSec=1h
StartLimitBurst=8
OnFailure=claude-rc-notify.service
[Service]
User=claude-rc
Group=claude-rc
WorkingDirectory=/var/lib/claude-rc/data
# strips credentials from subprocess environments; on Linux also sandboxes ! shell commands
Environment=CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1
ExecStart=/usr/bin/claude remote-control --name data --spawn session
Restart=always
RestartSec=30s
RestartSteps=4
RestartMaxDelaySec=10min
ProtectSystem=strict
ProtectHome=yes
ReadWritePaths=/var/lib/claude-rc
PrivateTmp=yes
NoNewPrivileges=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelLogs=yes
ProtectClock=yes
ProtectHostname=yes
CapabilityBoundingSet=
RestrictSUIDSGID=yes
RestrictRealtime=yes
LockPersonality=yes
# no RestrictNamespaces/MemoryDenyWriteExecute: the Bash sandbox (bubblewrap) needs user namespaces
[Install]
WantedBy=multi-user.target
+11
View File
@@ -0,0 +1,11 @@
{
"mcpServers": {
"negsplit": {
"command": "negsplit",
"args": ["mcp"]
},
"ens-forecast": {
"command": "ens-forecast-mcp"
}
}
}
+37
View File
@@ -0,0 +1,37 @@
{
"permissions": {
"defaultMode": "default",
"disableBypassPermissionsMode": "disable",
"disableAutoMode": "disable",
"allow": [
"mcp__negsplit",
"mcp__ens-forecast",
"Read(~/.local/share/negsplit/charts/**)"
],
"deny": [
"Read(~/.config/**)",
"Read(~/.claude/**)",
"Read(~/.claude.json)",
"Edit(~/.config/**)",
"Edit(~/.claude/**)",
"Edit(~/.claude.json)",
"Edit(./.claude/**)",
"Edit(./.mcp.json)",
"WebFetch",
"WebSearch"
]
},
"sandbox": {
"enabled": true,
"failIfUnavailable": true,
"allowUnsandboxedCommands": false,
"autoAllowBashIfSandboxed": true,
"filesystem": {
"denyRead": ["~/.config", "~/.claude", "~/.claude.json"],
"denyWrite": ["./.claude", "./.mcp.json"]
},
"network": {
"allowedDomains": []
}
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"theme": "dark",
"sandbox": {
"network": {
"strictAllowlist": true,
"allowedDomains": []
}
}
}
+2 -2
View File
@@ -27,7 +27,7 @@
width = (300, 500) width = (300, 500)
# The maximum height of a single notification, excluding the frame. # The maximum height of a single notification, excluding the frame.
height = (0, 300) height = (0, 600)
# Position the notification in the top right corner # Position the notification in the top right corner
origin = top-right origin = top-right
@@ -300,7 +300,7 @@
# * context_all: Open context menu for all notifications. # * context_all: Open context menu for all notifications.
# These values can be strung together for each mouse event, and # These values can be strung together for each mouse event, and
# will be executed in sequence. # will be executed in sequence.
mouse_left_click = close_current mouse_left_click = do_action, close_current
mouse_middle_click = do_action, close_current mouse_middle_click = do_action, close_current
mouse_right_click = close_all mouse_right_click = close_all
-4
View File
@@ -9,10 +9,6 @@ if status is-interactive
fastfetch fastfetch
cookie
calcurse -d 7
starship init fish | source starship init fish | source
end end
+5
View File
@@ -0,0 +1,5 @@
[general]
inhibit_screensaver=1
renice=10
; performance gave no gain: the CPU is heat-limited at 95 °C either way
desiredgov=powersave
+1 -1
View File
@@ -13,4 +13,4 @@ gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1 gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1 gtk-xft-antialias=1
gtk-xft-hinting=1 gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull gtk-xft-hintstyle=hintmedium
File diff suppressed because it is too large. Load diff
+1
View File
@@ -36,6 +36,7 @@ set cleaner ~/.config/lf/lf_kitty_clean
# text files and a file opener for the rest. # text files and a file opener for the rest.
cmd open &{{ cmd open &{{
case $(file --mime-type -Lb $f) in case $(file --mime-type -Lb $f) in
text/html) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
text/*) lf -remote "send $id \$$EDITOR \$fx";; text/*) lf -remote "send $id \$$EDITOR \$fx";;
application/json) lf -remote "send $id \$$EDITOR \$fx";; application/json) lf -remote "send $id \$$EDITOR \$fx";;
video/*) movie $fx > /dev/null 2> /dev/null;; video/*) movie $fx > /dev/null 2> /dev/null;;
+3 -399
View File
@@ -1,425 +1,29 @@
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "~/Music" music_directory "~/Music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory "~/.local/share/mpd/playlists" playlist_directory "~/.local/share/mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file "~/.local/share/mpd/database" db_file "~/.local/share/mpd/database"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
#log_file "~/.config/mpd/log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
#pid_file "~/.config/mpd/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
state_file "~/.local/share/mpd/state" state_file "~/.local/share/mpd/state"
#
# The location of the sticker database. This is a database which
# manages dynamic information attached to songs.
#
sticker_file "~/.local/share/mpd/sticker.sql" sticker_file "~/.local/share/mpd/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
#user "nobody"
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group "nogroup"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon.
#
# For network
bind_to_address "127.0.0.1" bind_to_address "127.0.0.1"
#
# And for Unix Socket
bind_to_address "~/.local/share/mpd/socket" bind_to_address "~/.local/share/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port "6600"
#
# This setting controls the type of information which is logged. Available
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level "default"
#
# If you have a problem with your MP3s ending abruptly it is recommended that
# you set this argument to "no" to attempt to fix the problem. If this solves
# the problem, it is highly recommended to fix the MP3 files with vbrfix
# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
# point gapless MP3 playback can be enabled.
#
#gapless_mp3_playback "yes"
#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
#
restore_paused "yes" restore_paused "yes"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. The complete list of possible values can be
# found in the mpd.conf man page.
#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This setting enables automatic update of MPD's database when files in
# music_directory are changed.
#
auto_update "yes" auto_update "yes"
# replaygain "auto"
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself. There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################
# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
#follow_inside_symlinks "yes"
#
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
#zeroconf_name "Music Player"
#
###############################################################################
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions "read,add,control,admin"
#
###############################################################################
# Database #######################################################################
#
#database {
# plugin "proxy"
# host "other.mpd.host"
# port "6600"
#}
# Input #######################################################################
#
input { input {
plugin "curl" plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
} }
#
###############################################################################
# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
#audio_output {
# type "alsa"
# name "My ALSA Device"
# device "hw:0,0" # optional
# mixer_type "software" # optional
## mixer_device "default" # optional
## mixer_control "PCM" # optional
## mixer_index "0" # optional
#}
#
audio_output { audio_output {
type "pipewire" type "pipewire"
name "Pipewire MPD" name "Pipewire MPD"
} }
# Feeds ncmpcpp's visualizer
audio_output { audio_output {
type "fifo" type "fifo"
name "my_fifo" name "my_fifo"
path "/tmp/mpd.fifo" path "/tmp/mpd.fifo"
format "44100:16:2" format "44100:16:2"
} }
#
# An example of an OSS output:
#
#audio_output {
# type "oss"
# name "My OSS Device"
## device "/dev/dsp" # optional
## mixer_type "hardware" # optional
## mixer_device "/dev/mixer" # optional
## mixer_control "PCM" # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
# type "shout"
# encoding "ogg" # optional
# name "My Shout Stream"
# host "localhost"
# port "8000"
# mount "/mpd.ogg"
# password "hackme"
# quality "5.0"
# bitrate "128"
# format "44100:16:1"
## protocol "icecast2" # optional
## user "source" # optional
## description "My Stream Description" # optional
## url "http://example.com" # optional
## genre "jazz" # optional
## public "no" # optional
## timeout "2" # optional
## mixer_type "software" # optional
#}
#
# An example of a recorder output:
#
#audio_output {
# type "recorder"
# name "My recorder"
# encoder "vorbis" # optional, vorbis or lame
# path "/var/lib/mpd/recorder/mpd.ogg"
## quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
#audio_output {
# type "httpd"
# name "My HTTP Stream"
# encoder "vorbis" # optional, vorbis or lame
# port "8000"
# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
## quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
# max_clients "0" # optional 0=no limit
#}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
#
#audio_output {
# type "pulse"
# name "My Pulse Output"
## server "remote_server" # optional
## sink "remote_server_sink" # optional
#}
#
# An example of a winmm output (Windows multimedia API).
#
#audio_output {
# type "winmm"
# name "My WinMM output"
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
# or
## device "0" # optional
## mixer_type "hardware" # optional
#}
#
# An example of an openal output.
#
#audio_output {
# type "openal"
# name "My OpenAL output"
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
#}
#
## Example "pipe" output:
#
#audio_output {
# type "pipe"
# name "my pipe"
# command "aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
# command "AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
# command "nc example.org 8765"
# format "44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
# type "null"
# name "My Null Output"
# mixer_type "none" # optional
#}
#
# If MPD has been compiled with libsamplerate support, this setting specifies
# the sample rate converter to use. Possible values can be found in the
# mpd.conf man page or the libsamplerate documentation. By default, this is
# setting is disabled.
#
#samplerate_converter "Fastest Sinc Interpolator"
#
###############################################################################
# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "off", "album", "track" or "auto". "auto" is a special mode that
# chooses between "track" and "album" depending on the current state of
# random playback. If random playback is enabled then "track" mode is used.
# See <http://www.replaygain.org> for more details about ReplayGain.
# This setting is off by default.
#
replaygain "auto"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp "0"
#
# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
# By default this setting is disabled.
#
#replaygain_missing_preamp "0"
#
# This setting enables or disables ReplayGain limiting.
# MPD calculates actual amplification based on the ReplayGain tags
# and replaygain_preamp / replaygain_missing_preamp setting.
# If replaygain_limit is enabled MPD will never amplify audio signal
# above its original level. If replaygain_limit is disabled such amplification
# might occur. By default this setting is enabled.
#
#replaygain_limit "yes"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has
# equal "loudness". This setting is disabled by default.
#
#volume_normalization "no"
#
###############################################################################
# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you
# may need to modify this setting.
#
#filesystem_charset "UTF-8"
#
# This setting controls the encoding that ID3v1 tags should be converted from.
#
#id3v1_encoding "ISO-8859-1"
#
###############################################################################
# SIDPlay decoder #############################################################
#
# songlength_database:
# Location of your songlengths file, as distributed with the HVSC.
# The sidplay plugin checks this for matching MD5 fingerprints.
# See http://www.c64.org/HVSC/DOCUMENTS/Songlengths.faq
#
# default_songlength:
# This is the default playing time in seconds for songs not in the
# songlength database, or in case you're not using a database.
# A value of 0 means play indefinitely.
#
# filter:
# Turns the SID filter emulation on or off.
#
#decoder {
# plugin "sidplay"
# songlength_database "/media/C64Music/DOCUMENTS/Songlengths.txt"
# default_songlength "120"
# filter "true"
#}
#
###############################################################################
+5 -139
View File
@@ -1,148 +1,14 @@
# # Video
# Example mpv configuration file
#
# Warning:
#
# The commented example options usually do _not_ set the default values. Call
# mpv with --list-options to see the default values for most options. There is
# no builtin or example mpv.conf with all the defaults.
#
#
# Configuration files are read system-wide from /usr/local/etc/mpv.conf
# and per-user from ~/.config/mpv/mpv.conf, where per-user settings override
# system-wide settings, all of which are overridden by the command line.
#
# Configuration file settings and the command line options use the same
# underlying mechanisms. Most options can be put into the configuration file
# by dropping the preceding '--'. See the man page for a complete list of
# options.
#
# Lines starting with '#' are comments and are ignored.
#
# See the CONFIGURATION FILES section in the man page
# for a detailed description of the syntax.
#
# Profiles should be placed at the bottom of the configuration file to ensure
# that settings wanted as defaults are not restricted to specific profiles.
##################
# video settings #
##################
# Start in fullscreen mode by default.
fs=yes fs=yes
profile=high-quality
hwdec=auto-safe
# force starting with centered window # Smooth playback: match video speed to the display refresh rate and blend frames
#geometry=50%:50%
# don't allow a new window to have a size larger than 90% of the screen size
#autofit-larger=90%x90%
# Do not close the window on exit.
#keep-open=yes
# Do not wait with showing the video window until it has loaded. (This will
# resize the window once video is loaded. Also always shows a window with
# audio.)
#force-window=immediate
# Disable the On Screen Controller (OSC).
#osc=no
# Keep the player window on top of all other windows.
#ontop=yes
# Specify high quality video rendering preset (for --vo=gpu only)
# Can cause performance problems with some drivers and GPUs.
profile=gpu-hq
scale=ewa_lanczossharp
cscale=ewa_lanczossharp
video-sync=display-resample video-sync=display-resample
interpolation interpolation
tscale=oversample tscale=oversample
# Force video to lock on the display's refresh rate, and change video and audio
# speed to some degree to ensure synchronous playback - can cause problems
# with some drivers and desktop environments.
#video-sync=display-resample
# Enable hardware decoding if available. Often, this does not work with all
# video outputs, but should work well with default settings on most systems.
# If performance or energy usage is an issue, forcing the vdpau or vaapi VOs
# may or may not help.
hwdec=auto
ytdl-format=bestvideo[height<=1080]+bestaudio/best[height<=1080] ytdl-format=bestvideo[height<=1080]+bestaudio/best[height<=1080]
################## # Audio
# audio settings #
##################
#ao=alsa
volume=100 volume=100
# Specify default audio device. You can list devices with: --audio-device=help
# The option takes the device string (the stuff between the '...').
#audio-device=alsa/default
# Do not filter audio to keep pitch when changing playback speed.
#audio-pitch-correction=no
# Output 5.1 audio natively, and upmix/downmix audio with a different format.
#audio-channels=5.1
# Disable any automatic remix, _if_ the audio output accepts the audio format.
# of the currently played file. See caveats mentioned in the manpage.
# (The default is "auto-safe", see manpage.)
#audio-channels=auto
##################
# other settings #
##################
# Pretend to be a web browser. Might fix playback with some streaming sites,
# but also will break with shoutcast streams.
#user-agent="Mozilla/5.0"
# cache settings
#
# Use a large seekable RAM cache even for local input.
#cache=yes
#
# Use extra large RAM cache (needs cache=yes to make it useful).
#demuxer-max-bytes=500M
#demuxer-max-back-bytes=100M
#
# Disable the behavior that the player will pause if the cache goes below a
# certain fill size.
#cache-pause=no
#
# Store cache payload on the hard disk instead of in RAM. (This may negatively
# impact performance unless used for slow input such as network.)
#cache-dir=~/.cache/
#cache-on-disk=yes
# Display English subtitles if available.
#slang=en
# Play Finnish audio if available, fall back to English otherwise.
#alang=fi,en
# Change subtitle encoding. For Arabic subtitles use 'cp1256'.
# If the file seems to be valid UTF-8, prefer UTF-8.
# (You can add '+' in front of the codepage to force it.)
#sub-codepage=cp1256
# You can also include other configuration files.
#include=/path/to/the/file/you/want/to/include
############
# Profiles #
############
# The options declared as part of profiles override global default settings,
# but only take effect when the profile is active.
# The following profile can be enabled on the command line with: --profile=eye-cancer
#[eye-cancer]
#sharpen=5
-99
View File
@@ -1,114 +1,15 @@
# -*-muttrc-*- # -*-muttrc-*-
#
# Command formats for gpg.
#
# Some of the older commented-out versions of the commands use gpg-2comp from:
# http://70t.de/download/gpg-2comp.tar.gz
#
# %p The empty string when no passphrase is needed,
# the string "PGPPASSFD=0" if one is needed.
#
# This is mostly used in conditional % sequences.
#
# %f Most PGP commands operate on a single file or a file
# containing a message. %f expands to this file's name.
#
# %s When verifying signatures, there is another temporary file
# containing the detached signature. %s expands to this
# file's name.
#
# %a In "signing" contexts, this expands to the value of the
# configuration variable $pgp_sign_as, if set, otherwise
# $pgp_default_key. You probably need to
# use this within a conditional % sequence.
#
# %r In many contexts, mutt passes key IDs to pgp. %r expands to
# a list of key IDs.
# Section A: Key Management
# The default key for encryption (used by $pgp_self_encrypt and
# $postpone_encrypt).
#
# It will also be used for signing unless $pgp_sign_as is set to a
# key.
#
# Unless your key does not have encryption capability, uncomment this
# line and replace the keyid with your own.
#
# set pgp_default_key="0x12345678"
# If you have a separate signing key, or your key _only_ has signing
# capability, uncomment this line and replace the keyid with your
# signing keyid.
#
# set pgp_sign_as="0x87654321"
# Section B: Commands
# Note that we explicitly set the comment armor header since GnuPG, when used
# in some localiaztion environments, generates 8bit data in that header, thereby
# breaking PGP/MIME.
# decode application/pgp
set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f" set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"
# verify a pgp/mime signature
set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f" set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f"
# decrypt a pgp/mime attachment
set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f" set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"
# create a pgp/mime signed attachment
# set pgp_sign_command="gpg-2comp --comment '' --no-verbose --batch --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f" set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
# create a application/pgp signed (old-style) message
# set pgp_clearsign_command="gpg-2comp --comment '' --no-verbose --batch --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f" set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
# create a pgp/mime encrypted attachment
# set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
# create a pgp/mime encrypted and signed attachment
# set pgp_encrypt_sign_command="pgpewrap gpg-2comp %?p?--passphrase-fd 0? -v --batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_sign_command="pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" set pgp_encrypt_sign_command="pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
# import a key into the public key ring
set pgp_import_command="gpg --no-verbose --import %f" set pgp_import_command="gpg --no-verbose --import %f"
# export a key from the public key ring
set pgp_export_command="gpg --no-verbose --export --armor %r" set pgp_export_command="gpg --no-verbose --export --armor %r"
# verify a key
set pgp_verify_key_command="gpg --verbose --batch --fingerprint --check-sigs %r" set pgp_verify_key_command="gpg --verbose --batch --fingerprint --check-sigs %r"
# read in the public key ring
# note: the second --with-fingerprint adds fingerprints to subkeys
set pgp_list_pubring_command="gpg --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-keys %r" set pgp_list_pubring_command="gpg --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-keys %r"
# read in the secret key ring
# note: the second --with-fingerprint adds fingerprints to subkeys
set pgp_list_secring_command="gpg --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-secret-keys %r" set pgp_list_secring_command="gpg --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-secret-keys %r"
# fetch keys
# set pgp_getkeys_command="pkspxycwrap %r"
# pattern for good signature - may need to be adapted to locale!
# set pgp_good_sign="^gpgv?: Good signature from "
# OK, here's a version which uses gnupg's message catalog:
# set pgp_good_sign="`gettext -d gnupg -s 'Good signature from "' | tr -d '"'`"
# This version uses --status-fd messages
set pgp_good_sign="^\\[GNUPG:\\] GOODSIG" set pgp_good_sign="^\\[GNUPG:\\] GOODSIG"
# pattern to verify a decryption occurred
# This is now deprecated by pgp_check_gpg_decrypt_status_fd:
# set pgp_decryption_okay="^\\[GNUPG:\\] DECRYPTION_OKAY"
set pgp_check_gpg_decrypt_status_fd set pgp_check_gpg_decrypt_status_fd
+2 -2
View File
@@ -1,3 +1,3 @@
macro pager \cb <pipe-entry>'urlscan'<enter> 'Follow links with urlview' macro index,pager \cb "<pipe-message>urlscan<enter>" "Follow links with urlscan"
macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook" macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook"
macro attach V "<pipe-entry>iconv -c --to-code=UTF8 > ~/.cache/mutt/mail.html<enter><shell-escape>vivaldi-stable ~/.cache/mutt/mail.html<enter>" macro attach V "<pipe-entry>iconv -c --to-code=UTF8 > ~/.cache/mutt/html/mail.html<enter><shell-escape>zen-browser ~/.cache/mutt/html/mail.html >/dev/null 2>&1<enter>" "Open attachment in Zen"
+1
View File
@@ -29,6 +29,7 @@ bind editor <Tab> complete-query
# Other settings # Other settings
set header_cache = "~/.cache/mutt" set header_cache = "~/.cache/mutt"
set message_cachedir = "~/.cache/mutt" set message_cachedir = "~/.cache/mutt"
set message_cache_clean = yes
set timeout = 30 set timeout = 30
set editor = "vim" set editor = "vim"
-87
View File
@@ -1,116 +1,29 @@
# This is a complete list of sidebar-related configuration.
# --------------------------------------------------------------------------
# VARIABLES - shown with their default values
# --------------------------------------------------------------------------
# Should the Sidebar be shown?
set sidebar_visible = yes set sidebar_visible = yes
# How wide should the Sidebar be in screen columns?
# Note: Some characters, e.g. Chinese, take up two columns each.
set sidebar_width = 20 set sidebar_width = 20
# Should the mailbox paths be abbreviated?
set sidebar_short_path = yes set sidebar_short_path = yes
# When abbreviating mailbox path names, use any of these characters as path
# separators. Only the part after the last separators will be shown.
# For file folders '/' is good. For IMAP folders, often '.' is useful.
set sidebar_delim_chars = '/.' set sidebar_delim_chars = '/.'
# If the mailbox path is abbreviated, should it be indented?
set sidebar_folder_indent = no set sidebar_folder_indent = no
# Indent mailbox paths with this string.
set sidebar_indent_string = ' ' set sidebar_indent_string = ' '
# Make the Sidebar only display mailboxes that contain new, or flagged,
# mail.
set sidebar_new_mail_only = no set sidebar_new_mail_only = no
# Any mailboxes that are whitelisted will always be visible, even if the
# sidebar_new_mail_only option is enabled.
sidebar_whitelist '/home/user/mailbox1' sidebar_whitelist '/home/user/mailbox1'
sidebar_whitelist '/home/user/mailbox2' sidebar_whitelist '/home/user/mailbox2'
# When searching for mailboxes containing new mail, should the search wrap
# around when it reaches the end of the list?
set sidebar_next_new_wrap = no set sidebar_next_new_wrap = no
# The character to use as the divider between the Sidebar and the other Mutt
# panels.
# Note: Only the first character of this string is used.
set sidebar_divider_char = '|' set sidebar_divider_char = '|'
# Enable extended buffy mode to calculate total, new, and flagged
# message counts for each mailbox.
set mail_check_stats set mail_check_stats
# Display the Sidebar mailboxes using this format string.
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S' set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'
# Sort the mailboxes in the Sidebar using this method:
# count - total number of messages
# flagged - number of flagged messages
# new - number of new messages
# path - mailbox path
# unsorted - do not sort the mailboxes
set sidebar_sort_method = 'unsorted' set sidebar_sort_method = 'unsorted'
# --------------------------------------------------------------------------
# FUNCTIONS - shown with an example mapping
# --------------------------------------------------------------------------
# Move the highlight to the previous mailbox
bind index,pager \Cp sidebar-prev bind index,pager \Cp sidebar-prev
# Move the highlight to the next mailbox
bind index,pager \Cn sidebar-next bind index,pager \Cn sidebar-next
# Open the highlighted mailbox
bind index,pager \Co sidebar-open bind index,pager \Co sidebar-open
# Move the highlight to the previous page
# This is useful if you have a LOT of mailboxes.
bind index,pager <F3> sidebar-page-up bind index,pager <F3> sidebar-page-up
# Move the highlight to the next page
# This is useful if you have a LOT of mailboxes.
bind index,pager <F4> sidebar-page-down bind index,pager <F4> sidebar-page-down
# Move the highlight to the previous mailbox containing new, or flagged,
# mail.
bind index,pager <F5> sidebar-prev-new bind index,pager <F5> sidebar-prev-new
# Move the highlight to the next mailbox containing new, or flagged, mail.
bind index,pager <F6> sidebar-next-new bind index,pager <F6> sidebar-next-new
# Toggle the visibility of the Sidebar.
bind index,pager B sidebar-toggle-visible bind index,pager B sidebar-toggle-visible
# --------------------------------------------------------------------------
# COLORS - some unpleasant examples are given
# --------------------------------------------------------------------------
# Note: All color operations are of the form:
# color OBJECT FOREGROUND BACKGROUND
# Color of the current, open, mailbox
# Note: This is a general Mutt option which colors all selected items.
color indicator cyan black color indicator cyan black
# Color of the highlighted, but not open, mailbox.
color sidebar_highlight black color8 color sidebar_highlight black color8
# Color of the divider separating the Sidebar from Mutt panels
color sidebar_divider color8 black color sidebar_divider color8 black
# Color to give mailboxes containing flagged mail
color sidebar_flagged red black color sidebar_flagged red black
# Color to give mailboxes containing new mail
color sidebar_new green black color sidebar_new green black
# --------------------------------------------------------------------------
# vim: syntax=muttrc
+8 -574
View File
@@ -1,598 +1,32 @@
##############################################################
## This is an example configuration file. Copy it to ##
## $XDG_CONFIG_HOME/ncmpcpp/config or $HOME/.ncmpcpp/config ##
## and set up your preferences. ##
##############################################################
#
##### directories ######
##
## Directory for storing ncmpcpp related files. Changing it is useful if you
## want to store everything somewhere else and provide command line setting for
## alternative location to config file which defines that while launching
## ncmpcpp.
##
#
ncmpcpp_directory = ~/.config/ncmpcpp ncmpcpp_directory = ~/.config/ncmpcpp
#
##
## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other
## MPD clients (eg. ncmpc) also use that location.
##
#
lyrics_directory = ~/.local/share/mpd/lyrics lyrics_directory = ~/.local/share/mpd/lyrics
#
##### connection settings ##### # MPD
#
mpd_host = localhost mpd_host = localhost
#
mpd_port = 6600 mpd_port = 6600
#
#mpd_connection_timeout = 5
#
## Needed for tag editor and file operations to work.
##
mpd_music_dir = ~/Music mpd_music_dir = ~/Music
#
mpd_crossfade_time = 10 mpd_crossfade_time = 10
#
# Exclude pattern for random song action # Visualizer (reads mpd's "my_fifo" output)
# http://www.boost.org/doc/libs/1_46_1/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html
#random_exclude_pattern = "^(temp|midi_songs).*"
#
##### music visualizer #####
##
## In order to make music visualizer work with MPD you need to use the fifo
## output. Its format parameter has to be set to 44100:16:1 for mono
## visualization or 44100:16:2 for stereo visualization. As an example here is
## the relevant section for mpd.conf:
##
## audio_output {
## type "fifo"
## name "Visualizer feed"
## path "/tmp/mpd.fifo"
## format "44100:16:2"
## }
##
## If the visualization on occasion diverges from the audio output, please set
## 'buffer_time' parameter of your audio output in mpd.conf to '100000' (100ms)
## or less to prevent that from happening.
##
## Note: If you're using Mopidy, an address of a udpsink gstreamer's output is
## also accepted. For example, the following section in mopidy.conf:
##
## [audio]
## output = tee name=t ! queue ! autoaudiosink t.
## ! queue ! audio/x-raw,rate=44100,channels=2,format=S16LE
## ! udpsink host=localhost port=5555
##
## will make localhost:5555 available as a source of data for the stereo
## visualizer.
##
#
visualizer_data_source = /tmp/mpd.fifo visualizer_data_source = /tmp/mpd.fifo
#
##
## Note: Below parameter is needed for ncmpcpp to determine which output
## provides data for visualizer and reset it at the beginning of visualization
## to synchronize with audio.
##
#
visualizer_output_name = "my_fifo" visualizer_output_name = "my_fifo"
#
##
## If you set format to 44100:16:2, make it 'yes'.
##
visualizer_in_stereo = yes visualizer_in_stereo = yes
#
##
## Note: set below to >=10 only if you have synchronization issues with
## visualization and audio.
##
#
#visualizer_sync_interval = 0
#
##
## Note: To enable spectrum frequency visualization you need to compile ncmpcpp
## with fftw3 support.
##
#
## Available values: spectrum, wave, wave_filled, ellipse.
##
visualizer_type = spectrum visualizer_type = spectrum
#
#visualizer_fps = 60
#
#visualizer_autoscale = no
#
visualizer_look = ●▮ visualizer_look = ●▮
#
#visualizer_color = blue, cyan, green, yellow, magenta, red # Interface
#
## Alternative subset of 256 colors for terminals that support it.
##
#visualizer_color = 47, 83, 119, 155, 191, 227, 221, 215, 209, 203, 197, 161
#
##
## Note: The next few visualization options apply to the spectrum visualizer.
##
#
## Use unicode block characters for a smoother, more continuous look.
## This will override the visualizer_look option. With transparent terminals
## and visualizer_in_stereo set, artifacts may be visible on the bottom half of
## the visualization.
#
#visualizer_spectrum_smooth_look = yes
#
## A value between 1 and 5 inclusive. Specifying a larger value makes the
## visualizer look at a larger slice of time, which results in less jumpy
## visualizer output.
#
#visualizer_spectrum_dft_size = 2
#
#visualizer_spectrum_gain = 10
#
## Left-most frequency of visualizer in Hz, must be less than HZ MAX
#
#visualizer_spectrum_hz_min = 20
#
## Right-most frequency of visualizer in Hz, must be greater than HZ MIN
#
#visualizer_spectrum_hz_max = 20000
#
##### system encoding #####
##
## ncmpcpp should detect your charset encoding but if it failed to do so, you
## can specify charset encoding you are using here.
##
## Note: You can see whether your ncmpcpp build supports charset detection by
## checking output of `ncmpcpp --version`.
##
## Note: Since MPD uses UTF-8 by default, setting this option makes sense only
## if your encoding is different.
##
#
#system_encoding = ""
#
##### delays #####
#
## Time of inactivity (in seconds) after playlist highlighting will be disabled
## (0 = always on).
##
#playlist_disable_highlight_delay = 5
#
## Defines how long messages are supposed to be visible.
##
#message_delay_time = 5
#
##### song format #####
##
## For a song format you can use:
##
## %l - length
## %f - filename
## %D - directory
## %a - artist
## %A - album artist
## %t - title
## %b - album
## %y - date
## %n - track number (01/12 -> 01)
## %N - full track info (01/12 -> 01/12)
## %g - genre
## %c - composer
## %p - performer
## %d - disc
## %C - comment
## %P - priority
## $R - begin right alignment
##
## If you want to make sure that a part of the format is displayed only when
## certain tags are present, you can archieve it by grouping them with brackets,
## e.g. '{%a - %t}' will be evaluated to 'ARTIST - TITLE' if both tags are
## present or '' otherwise. It is also possible to define a list of
## alternatives by providing several groups and separating them with '|',
## e.g. '{%t}|{%f}' will be evaluated to 'TITLE' or 'FILENAME' if the former is
## not present.
##
## Note: If you want to set limit on maximal length of a tag, just put the
## appropriate number between % and character that defines tag type, e.g. to
## make album take max. 20 terminal cells, use '%20b'.
##
## In addition, formats support markers used for text attributes. They are
## followed by character '$'. After that you can put:
##
## - 0 - default window color (discards all other colors)
## - 1 - black
## - 2 - red
## - 3 - green
## - 4 - yellow
## - 5 - blue
## - 6 - magenta
## - 7 - cyan
## - 8 - white
## - 9 - end of current color
## - b - bold text
## - u - underline text
## - r - reverse colors
## - a - use alternative character set
##
## If you don't want to use a non-color attribute anymore, just put it again,
## but this time insert character '/' between '$' and attribute character,
## e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag or filename with
## reversed colors.
##
## If you want to use 256 colors and/or background colors in formats (the naming
## scheme is described below in section about color definitions), it can be done
## with the syntax $(COLOR), e.g. to set the artist tag to one of the
## non-standard colors and make it have yellow background, you need to write
## $(197_yellow)%a$(end). Note that for standard colors this is interchangable
## with attributes listed above.
##
## Note: colors can be nested.
##
#
#song_list_format = {%a - }{%t}|{$8%f$9}$R{$3%l$9}
#
#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
#
#song_library_format = {%n - }{%t}|{%f}
#
#alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b
#
#alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}
#
#current_item_prefix = $(yellow)$r
#
#current_item_suffix = $/r$(end)
#
#current_item_inactive_column_prefix = $(white)$r
#
#current_item_inactive_column_suffix = $/r$(end)
#
#now_playing_prefix = $b
#
#now_playing_suffix = $/b
#
#browser_playlist_prefix = "$2playlist$9 "
#
#selected_item_prefix = $6
#
#selected_item_suffix = $9
#
#modified_item_prefix = $3> $9
#
##
## Note: attributes are not supported for the following variables.
##
#song_window_title_format = {%a - }{%t}|{%f}
##
## Note: Below variables are used for sorting songs in browser. The sort mode
## determines how songs are sorted, and can be used in combination with a sort
## format to specify a custom sorting format. Available values for
## browser_sort_mode are "type", "name", "mtime", "format" and "none".
##
#
#browser_sort_mode = type
#
#browser_sort_format = {%a - }{%t}|{%f} {%l}
#
##### columns settings #####
##
## syntax of song columns list format is "column column etc."
##
## - syntax for each column is:
##
## (width of the column)[color of the column]{displayed tag}
##
## Note: Width is by default in %, if you want a column to have fixed size, add
## 'f' after the value, e.g. (10)[white]{a} will be the column that take 10% of
## screen (so the real width will depend on actual screen size), whereas
## (10f)[white]{a} will take 10 terminal cells, no matter how wide the screen
## is.
##
## - color is optional (if you want the default one, leave the field empty).
##
## Note: You can give a column additional attributes by putting appropriate
## character after displayed tag character. Available attributes are:
##
## - r - column will be right aligned
## - E - if tag is empty, empty tag marker won't be displayed
##
## You can also:
##
## - give a column custom name by putting it after attributes, separated with
## character ':', e.g. {lr:Length} gives you right aligned column of lengths
## named "Length".
##
## - define sequence of tags, that have to be displayed in case predecessor is
## empty in a way similar to the one in classic song format, i.e. using '|'
## character, e.g. {a|c|p:Owner} creates column named "Owner" that tries to
## display artist tag and then composer and performer if previous ones are not
## available.
##
#
#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
#
##### various settings #####
#
##
## Note: Custom command that will be executed each time song changes. Useful for
## notifications etc.
##
#execute_on_song_change =
#
##
## Note: Custom command that will be executed each time player state
## changes. The environment variable MPD_PLAYER_STATE is set to the current
## state (either unknown, play, pause, or stop) for its duration.
##
#
#execute_on_player_state_change =
#
#playlist_show_mpd_host = no
#
#playlist_show_remaining_time = no
#
#playlist_shorten_total_times = no
#
#playlist_separate_albums = no
#
##
## Note: Possible display modes: classic, columns.
##
#playlist_display_mode = columns
#
#browser_display_mode = classic
#
#search_engine_display_mode = classic
#
#playlist_editor_display_mode = classic
#
#discard_colors_if_item_is_selected = yes
#
#show_duplicate_tags = yes
#
#incremental_seeking = yes
#
#seek_time = 1
#
#volume_change_step = 2
#
#autocenter_mode = no
#
#centered_cursor = no
#
##
## Note: You can specify third character which will be used to build 'empty'
## part of progressbar.
##
#progressbar_look = =>
#
## Available values: database, playlist.
##
#default_place_to_search_in = database
#
## Available values: classic, alternative.
##
user_interface = alternative user_interface = alternative
#
#data_fetching_delay = yes
#
## Available values: artist, album_artist, date, genre, composer, performer.
##
media_library_primary_tag = album_artist media_library_primary_tag = album_artist
#
#media_library_albums_split_by_date = yes
#
#media_library_hide_album_dates = no
#
## Available values: wrapped, normal.
##
#default_find_mode = wrapped
#
#default_tag_editor_pattern = %n - %t
#
#header_visibility = yes
#
#statusbar_visibility = yes
#
## Show the "Connected to ..." message on startup
#connected_message_on_startup = yes
#
#titles_visibility = yes
#
#header_text_scrolling = yes
#
#cyclic_scrolling = no
#
lyrics_fetchers = musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, genius, azlyrics, internet lyrics_fetchers = musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, genius, azlyrics, internet
#
#follow_now_playing_lyrics = no
#
#fetch_lyrics_for_current_song_in_background = no
#
#store_lyrics_in_song_dir = no
#
#generate_win32_compatible_filenames = yes
#
#allow_for_physical_item_deletion = no
#
##
## Note: If you set this variable, ncmpcpp will try to get info from last.fm in
## language you set and if it fails, it will fall back to english. Otherwise it
## will use english the first time.
##
## Note: Language has to be expressed as an ISO 639 alpha-2 code.
##
#lastfm_preferred_language = en
#
#space_add_mode = add_remove
#
#show_hidden_files_in_local_browser = no
#
##
## How shall screen switcher work?
##
## - "previous" - switch between the current and previous screen.
## - "screen1,...,screenN" - switch between given sequence of screens.
##
## Screens available for use: help, playlist, browser, search_engine,
## media_library, playlist_editor, tag_editor, outputs, visualizer, clock,
## lyrics, last_fm.
##
#screen_switcher_mode = playlist, browser
#
##
## Note: You can define startup screen by choosing screen from the list above.
##
startup_screen = media_library startup_screen = media_library
#
##
## Note: You can define startup slave screen by choosing screen from the list
## above or an empty value for no slave screen.
##
#startup_slave_screen = playlist
#
#startup_slave_screen_focus = no
#
##
## Default width of locked screen (in %). Acceptable values are from 20 to 80.
##
#
#locked_screen_width_part = 60
#
#ask_for_locked_screen_width_part = yes
#
#jump_to_now_playing_song_at_start = yes
#
#ask_before_clearing_playlists = yes
#
#clock_display_seconds = no
#
#display_volume_level = yes
#
#display_bitrate = no
#
#display_remaining_time = no
#
## Available values: none, basic, extended, perl.
##
#regular_expressions = perl
#
##
## Note: if below is enabled, ncmpcpp will ignore leading "The" word while
## sorting items in browser, tags in media library, etc.
##
ignore_leading_the = yes ignore_leading_the = yes
#
##
## Note: if below is enabled, ncmpcpp will ignore diacritics while searching and
## filtering lists. This takes an effect only if boost was compiled with ICU
## support.
##
#ignore_diacritics = no
#
#block_search_constraints_change_if_items_found = yes
#
#mouse_support = yes
#
#mouse_list_scroll_whole_page = no
#
#lines_scrolled = 5
#
#empty_tag_marker = <empty>
#
#tags_separator = " | "
#
#tag_editor_extended_numeration = no
#
#media_library_sort_by_mtime = no
#
#enable_window_title = yes
#
##
## Note: You can choose default search mode for search engine. Available modes
## are:
##
## - 1 - use mpd built-in searching (no regexes, pattern matching)
##
## - 2 - use ncmpcpp searching (pattern matching with support for regexes, but
## if your mpd is on a remote machine, downloading big database to process
## it can take a while
##
## - 3 - match only exact values (this mode uses mpd function for searching in
## database and local one for searching in current playlist)
##
#
#search_engine_default_search_mode = 1
#
external_editor = vim external_editor = vim
#
## Note: set to yes if external editor is a console application.
##
use_console_editor = yes use_console_editor = yes
#
##### colors definitions ##### # Colors
##
## It is possible to set a background color by setting a color value
## "<foreground>_<background>", e.g. red_black will set foregound color to red
## and background color to black.
##
## In addition, for terminals that support 256 colors it is possible to set one
## of them by using a number in range [1, 256] instead of color name,
## e.g. numerical value corresponding to red_black is 2_1. To find out if the
## terminal supports 256 colors, run ncmpcpp and check out the bottom of the
## help screen for list of available colors and their numerical values.
##
## What is more, there are two special values for the background color:
## "transparent" and "current". The first one explicitly sets the background to
## be transparent, while the second one allows you to preserve current
## background color and change only the foreground one. It's used implicitly
## when background color is not specified.
##
## Moreover, it is possible to attach format information to selected color
## variables by appending to their end a colon followed by one or more format
## flags, e.g. black:b or red:ur. The following variables support this syntax:
## visualizer_color, color1, color2, empty_tag_color, volume_color,
## state_line_color, state_flags_color, progressbar_color,
## progressbar_elapsed_color, player_state_color, statusbar_time_color,
## alternative_ui_separator_color.
##
## Note: due to technical limitations of older ncurses version, if 256 colors
## are used there is a possibility that you'll be able to use only colors with
## transparent background.
#
colors_enabled = yes colors_enabled = yes
#
#empty_tag_color = cyan
#
header_window_color = 226 header_window_color = 226
#
#volume_color = default
#
#state_line_color = default
#
#state_flags_color = default:b
#
main_window_color = 160 main_window_color = 160
#
#color1 = white
#
#color2 = green
#
#progressbar_color = black:b
#
progressbar_elapsed_color = 226:b progressbar_elapsed_color = 226:b
#
statusbar_color = 226 statusbar_color = 226
#
#statusbar_time_color = default:b
#
#player_state_color = default:b
#
#alternative_ui_separator_color = black:b
#
window_border_color = 226 window_border_color = 226
#
#active_window_border = red
#
+10 -276
View File
@@ -1,287 +1,26 @@
################################# backend = "xrender"
# Shadows # dithered-present = false;
################################# use-damage = true;
# Fullscreen games bypass picom: less CPU work and latency.
unredir-if-possible = true;
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
#
# Can be set per-window using rules.
#
# Default: false
shadow = true; shadow = true;
# The blur radius for shadows, in pixels.
#
# Default: 12
shadow-radius = 7; shadow-radius = 7;
# The opacity of shadows.
#
# Range: 0.0 - 1.0
# Default: 0.75
# shadow-opacity = .75
# The left offset for shadows, in pixels.
#
# Default: -15
shadow-offset-x = -7; shadow-offset-x = -7;
# The top offset for shadows, in pixels.
#
# Default: -15
shadow-offset-y = -7; shadow-offset-y = -7;
# Hex string color value of shadow. Formatted like "#RRGGBB", e.g. "#C0FFEE".
#
# Default: #000000
# shadow-color = "#000000"
# Crop shadow of a window fully on a particular monitor to that monitor. This is
# currently implemented using the X RandR extension.
#
# Default: false
# crop-shadow-to-monitor = false
#################################
# Fading #
#################################
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used. Can be set per-window using rules.
#
# Default: false
fading = true; fading = true;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
fade-in-step = 0.03; fade-in-step = 0.03;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
fade-out-step = 0.03; fade-out-step = 0.03;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
# fade-delta = 10
# Do not fade on window open/close.
# no-fading-openclose = false
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
# no-fading-destroyed-argb = false
#################################
# Transparency / Opacity #
#################################
# Opacity of window titlebars and borders.
#
# Range: 0.1 - 1.0
# Default: 1.0 (disabled)
frame-opacity = 0.9; frame-opacity = 0.9;
# Use fixed inactive dim value, instead of adjusting according to window opacity.
#
# Default: false
# inactive-dim-fixed = true
#################################
# Corners #
#################################
# Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows. Does not interact well with
# `transparent-clipping`.
#
# Default: 0 (disabled)
corner-radius = 0 corner-radius = 0
#################################
# Blur #
#################################
# Parameters for background blurring, see BLUR section in the man page for more information.
# blur-method =
# blur-size = 12
#
# blur-deviation = false
#
# blur-strength = 5
# Blur background of semi-transparent / ARGB windows.
# Can be set per-window using rules.
#
# Default: false
# blur-background = false
# Blur background of windows when the window frame is not opaque.
# Implies:
# blur-background
#
# Default: false
# blur-background-frame = false
# Use fixed blur strength rather than adjusting according to window opacity.
#
# Default: false
# blur-background-fixed = false
# Specify the blur convolution kernel, with the following format:
# example:
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
# Can also be a pre-defined kernel, see the man page.
#
# Default: ""
blur-kern = "3x3box"; blur-kern = "3x3box";
#################################
# General Settings #
#################################
# Enable remote control via D-Bus. See the man page for more details.
#
# Default: false
# dbus = true
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
# daemon = false
# Specify the backend to use: `xrender`, `glx`, or `egl`.
#
# Default: "xrender"
backend = "xrender"
# Use higher precision during rendering, and apply dither when presenting the
# rendered screen. Reduces banding artifacts, but may cause performance
# degradation. Only works with OpenGL.
dithered-present = false;
# Enable/disable VSync.
#
# Default: false
# vsync = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
#
# Has nothing to do with `corner-radius`.
#
# Default: false
detect-rounded-corners = true; detect-rounded-corners = true;
# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
#
# Default: false
detect-client-opacity = true; detect-client-opacity = true;
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. May be more accurate,
# provided that the WM supports it.
#
# Default: false
# use-ewmh-active-win = false
# Unredirect all windows if a full-screen opaque window is detected,
# to maximize performance for full-screen windows. Known to cause flickering
# when redirecting/unredirecting windows.
#
# Default: false
# unredir-if-possible = false
# Delay before unredirecting the window, in milliseconds.
#
# Default: 0.
# unredir-if-possible-delay = 0
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
# in the same group focused at the same time.
#
# Default: false
detect-transient = true; detect-transient = true;
# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
# group focused at the same time. This usually means windows from the same application
# will be considered focused or unfocused at the same time.
# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
#
# Default: false
# detect-client-leader = false
# Use of damage information for rendering. This cause the only the part of the
# screen that has actually changed to be redrawn, instead of the whole screen
# every time. Should improve performance.
#
# Default: false
use-damage = true;
# Use X Sync fence to wait for the completion of rendering of other windows,
# before using their content to render the current screen.
#
# Required for explicit sync drivers, such as nvidia.
#
# Default: false
# xrender-sync-fence = false
# GLX backend: Use specified GLSL fragment shader for rendering window
# contents. Read the man page for a detailed explanation of the interface.
#
# Can be set per-window using rules.
#
# window-shader-fg = "default"
# Force all windows to be painted with blending. Useful if you
# have a `window-shader-fg` that could turn opaque pixels transparent.
#
# Default: false
# force-win-blend = false
# Do not use EWMH to detect fullscreen windows.
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
#
# Default: false
# no-ewmh-fullscreen = false
# Dimming bright windows so their brightness doesn't exceed this set value.
# Brightness of a window is estimated by averaging all pixels in the window,
# so this could comes with a performance hit.
# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled.
#
# Default: 1.0 (disabled)
# max-brightness = 1.0
# Make transparent windows clip other windows like non-transparent windows do,
# instead of blending on top of them. e.g. placing a transparent window on top
# of another window will cut a "hole" in that window, and show the desktop background
# underneath.
#
# Default: false
# transparent-clipping = false
# Set the log level. Possible values are:
# "trace", "debug", "info", "warn", "error"
# in increasing level of importance. Case insensitive.
# If using the "TRACE" log level, it's better to log into a file
# using *--log-file*, since it can generate a huge stream of logs.
#
# Default: "warn"
# log-level = "warn";
# Set the log file.
# If *--log-file* is never specified, logs will be written to stderr.
# Otherwise, logs will to written to the given file, though some of the early
# logs might still be written to the stderr.
# When setting this option from the config file, it is recommended to use an absolute path.
#
# log-file = "/path/to/your/log/file"
# Write process ID to a file.
# write-pid-path = "/path/to/your/log/file"
# Rule-based per-window options.
#
# See WINDOW RULES section in the man page for how these work.
rules: ({ rules: ({
match = "window_type = 'tooltip'"; match = "window_type = 'tooltip'";
fade = false; fade = false;
@@ -293,9 +32,6 @@ rules: ({
"window_type = 'desktop' || " "window_type = 'desktop' || "
"_GTK_FRAME_EXTENTS@"; "_GTK_FRAME_EXTENTS@";
blur-background = false; blur-background = false;
}, {
match = "window_type != 'dock'";
# shader = "my_shader.frag";
}, { }, {
match = "window_type = 'dock' || " match = "window_type = 'dock' || "
"window_type = 'desktop'"; "window_type = 'desktop'";
@@ -307,11 +43,9 @@ rules: ({
"class_g = 'Cairo-clock' || " "class_g = 'Cairo-clock' || "
"_GTK_FRAME_EXTENTS@"; "_GTK_FRAME_EXTENTS@";
shadow = false; shadow = false;
}, {
# Unredirecting fullscreen i3lock/mpv left the HDMI output (reverse PRIME sink) black.
match = "class_g = 'i3lock' || "
"class_g = 'mpv'";
unredir = false;
}) })
# `@include` directive can be used to include additional configuration files.
# Relative paths are search either in the parent of this configuration file
# (when the configuration is loaded through a symlink, the symlink will be
# resolved first). Or in `$XDG_CONFIG_HOME/picom/include`.
#
# @include "extra.conf"
@@ -0,0 +1,11 @@
[Unit]
Description=Notify when the last simple_backup is 14 days old or more
StartLimitIntervalSec=2h
StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.config/xmobar/backup.sh remind
# no notification daemon yet (e.g. caught up right after login)? retry a few times
Restart=on-failure
RestartSec=5min
@@ -0,0 +1,9 @@
[Unit]
Description=Check daily whether a backup is overdue
[Timer]
OnCalendar=*-*-* 10:00:00
Persistent=true
[Install]
WantedBy=timers.target
@@ -0,0 +1,7 @@
[Unit]
Description=Ask to renew the calcurse Google Calendar login
[Service]
# simple: the prompt waits for a click without a start timeout
Type=simple
ExecStart=%h/.local/bin/calcurse-relogin --prompt
@@ -0,0 +1,6 @@
[Unit]
Description=Sync calcurse with Google Calendar
[Service]
Type=oneshot
ExecStart=%h/.local/bin/calcurse-sync
+7
View File
@@ -0,0 +1,7 @@
[Unit]
Description=Sync calcurse with Google Calendar hourly
[Timer]
OnActiveSec=1min
OnCalendar=hourly
Persistent=true
@@ -0,0 +1,7 @@
[Unit]
Description=Notify today's calcurse events
After=calcurse-sync.service
[Service]
Type=oneshot
ExecStart=%h/.local/bin/calcurse-today
@@ -0,0 +1,6 @@
[Unit]
Description=Notify today's calcurse events every morning
[Timer]
OnCalendar=*-*-* 09:00
Persistent=true
@@ -0,0 +1,7 @@
[Unit]
Description=Run discover-overlay while Discord is running
[Service]
ExecStart=%h/.local/bin/discover-overlay-wait
Restart=on-failure
RestartSec=5
+1
View File
@@ -6,3 +6,4 @@ ExecStart=/home/fuxino/.fehbg
Type=simple Type=simple
Restart=no Restart=no
ProtectHome=read-only ProtectHome=read-only
ReadWritePaths=%C
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=Dump the Garmin database to ~/.local/share/negsplit/dumps
StartLimitIntervalSec=2h
StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.local/bin/db-dump negsplit Garmin week
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
Restart=on-failure
RestartSec=5min
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Dump the Garmin database weekly
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=Dump the Library database to ~/.local/share/library_manager/dumps
StartLimitIntervalSec=2h
StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.local/bin/db-dump library_manager Library day
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
Restart=on-failure
RestartSec=5min
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Dump the Library database daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
@@ -1,2 +0,0 @@
[Unit]
After=mpd-mpris.service
@@ -0,0 +1,5 @@
[Service]
Type=dbus
ExecStart=
ExecStart=/usr/bin/playerctld
Restart=on-failure
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=Dump the Weather database to ~/.local/share/ens-forecast/dumps
StartLimitIntervalSec=2h
StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.local/bin/db-dump ens-forecast Weather week
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
Restart=on-failure
RestartSec=5min
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Dump the Weather database weekly
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target
+2
View File
@@ -0,0 +1,2 @@
# Remove vidthumb thumbnails (and leftover temp files) not used for 30 days; %C is $XDG_CACHE_HOME.
e %C/vidthumb - - - 30d
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# Days since the last simple_backup for xmobar, e.g. " 9d | ": hidden under 7 days, orange from 7, red from 14
# Reads simple_backup's state file and the journal (versions before the state file only log there), whichever is newer.
# With "list": show the date in a notification (for a click on the bar)
# With "remind": notify only when a backup is overdue (run daily by backup-reminder.timer)
warn=7 overdue=14
state="${XDG_STATE_HOME:-$HOME/.local/state}/simple_backup/last_backup"
last=0 dir=""
if [[ -r $state ]]; then
{ read -r time; read -r dir; } < "$state"
last=$(date -d "$time" +%s 2>/dev/null) || last=0
fi
# The journal drops old entries, so after a long gap there may be nothing left to find
line=$(journalctl -q -t /usr/bin/simple_backup -r -o short-unix 2>/dev/null | grep -m1 'Backup completed')
jlast=${line%%.*}
if [[ $jlast =~ ^[0-9]+$ ]] && (( jlast > last )); then
last=$jlast dir=""
fi
days=$(( ($(date +%s) - last) / 86400 ))
age() {
case $days in
0) echo "today" ;;
1) echo "1 day ago" ;;
*) echo "$days days ago" ;;
esac
}
case ${1:-} in
list)
if (( last )); then
body="$(date -d "@$last" '+%Y-%m-%d %H:%M') ($(age))"
[[ -n $dir ]] && body+=$'\n'"$dir"
else
body="No backup found"
fi
notify-send "Last backup" "$body"
exit ;;
remind)
(( last && days < overdue )) && exit 0
if (( last )); then
body="Last backup $(age) ($(date -d "@$last" '+%Y-%m-%d'))"
else
body="No backup found"
fi
# A failure (e.g. no notification daemon yet) makes the service retry
exec notify-send "Backup overdue" "$body. Plug in the backup disk." ;;
esac
(( last && days < warn )) && exit 0
icon=$'\xef\x82\xa0' # nf-fa-hdd_o, as UTF-8 bytes so the locale doesn't matter
if (( ! last )); then
text="<fc=#f7768e>$icon ?</fc>"
elif (( days >= overdue )); then
text="<fc=#f7768e>$icon ${days}d</fc>"
else
text="<fc=#ffb86c>$icon ${days}d</fc>"
fi
echo "$text | "
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
# Next calcurse item for xmobar: pink " 10:15 | " for an appointment later today, a cyan icon for a whole-day
# event today, a pink icon alone when the next appointment is tomorrow; empty otherwise.
# With "list": show today's and tomorrow's items in a notification (for a click on the bar)
set -uo pipefail
icon=$'\xf3\xb0\x83\xad' # nf-md-calendar, as UTF-8 bytes so the locale doesn't matter
today=$(date +%F)
query() {
calcurse -Q --filter-type cal --days 2 --output-datefmt %F "$@"
}
if [[ ${1:-} == list ]]; then
tomorrow=$(date -d tomorrow +%F)
body=$(query --format-apt '%S–%E %m\n' --format-recur-apt '%S–%E %m\n' \
--format-event 'all day %m\n' --format-recur-event 'all day %m\n' |
sed -e 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' -e "s/^$today:$/Today:/; s/^$tomorrow:$/Tomorrow:/")
notify-send -a calcurse -i x-office-calendar "Calendar" "${body:-Nothing today or tomorrow}"
exit
fi
now=$(date +%s)
day="" next="" event=false
while read -r kind start; do
case $kind in
*:) day=${kind%:} ;;
A) [[ -z $next ]] && ((start > now)) && next=$start ;;
E) [[ $day == "$today" ]] && event=true ;;
esac
done < <(query --format-apt 'A %s\n' --format-recur-apt 'A %s\n' --format-event 'E\n' --format-recur-event 'E\n')
if [[ -n $next && $(date -d "@$next" +%F) == "$today" ]]; then
text="<fc=#ff79c6>$icon $(date -d "@$next" +%H:%M)</fc>"
elif $event; then
text="<fc=#8be9fd>$icon</fc>"
elif [[ -n $next ]]; then
text="<fc=#ff79c6>$icon</fc>"
else
exit 0
fi
echo "$text | "
+5 -3
View File
@@ -13,7 +13,7 @@ declare -A LABEL=([ncep_gefs025]=GEFS [icon_seamless_eps]=ICON [google_weatherne
pick() { pick() {
local m l head first="" first_model="" err="" local m l head first="" first_model="" err=""
for m in "${MODELS[@]}"; do for m in "${MODELS[@]}"; do
if ! l=$(ens-forecast --brief "$1" --model "$m" 2>&1); then if ! l=$(ens-forecast brief "$1" --model "$m" 2>&1); then
[[ -z $err ]] && err=$l [[ -z $err ]] && err=$l
continue continue
fi fi
@@ -47,9 +47,11 @@ if [ "$1" = "week" ]; then
fi fi
pick 1 2>/dev/null || exit 0 pick 1 2>/dev/null || exit 0
read -r day temps rain <<< "${line#*: }" read -r day temps rain extra <<< "${line#*: }"
# Probabilities as nf-weather icons: frost snowflake_cold, snow, heat hot
extra=${extra//frost /$'\xee\x8d\xaf' } extra=${extra//snow /$'\xee\x8c\x9a' } extra=${extra//heat /$'\xee\x8d\xab' }
label="" label=""
[[ $model != "${MODELS[0]}" ]] && label="${LABEL[$model]:-$model} " [[ $model != "${MODELS[0]}" ]] && label="${LABEL[$model]:-$model} "
stale="" stale=""
[[ ${line%%: *} == *STALE* ]] && stale=" <fc=#f7768e>!</fc>" [[ ${line%%: *} == *STALE* ]] && stale=" <fc=#f7768e>!</fc>"
echo "$label$day ${temps%C} "$''" $rain$stale" echo "$label$day ${temps%C} "$''" $rain${extra:+ $extra}$stale"
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# NVIDIA GPU load and temperature for xmobar, e.g. "<icon> 9% 68°C", colored like the CPU ones.
# Load 25/75 as MultiCpu; temperature 75/90 (GTX 1050 Ti Mobile: target 94°C, ~65°C driving the HDMI output).
color() { # value low high
if (( $1 > $3 )); then c='#ff5555'; elif (( $1 > $2 )); then c='#ffb86c'; else c='#50fa7b'; fi
printf '<fc=%s>%s</fc>' "$c" "$4"
}
icon=$'\U000f08ae'
IFS=', ' read -r load temp < <(nvidia-smi --query-gpu=utilization.gpu,temperature.gpu --format=csv,noheader,nounits 2>/dev/null)
if [[ ! $load =~ ^[0-9]+$ || ! $temp =~ ^[0-9]+$ ]]; then
echo "$icon N/A"
exit
fi
echo "$icon $(color "$load" 25 75 "$load%") $(color "$temp" 75 90 "$temp°C")"
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Cycle keyboard layout it -> us -> sk(qwerty); "prev" cycles backwards.
current=$(setxkbmap -query | awk '/^layout:/ {split($2, a, ","); print a[1]}')
if [[ "$1" == "prev" ]]; then
case "$current" in
it) next=sk ;;
us) next=it ;;
*) next=us ;;
esac
else
case "$current" in
it) next=us ;;
us) next=sk ;;
*) next=it ;;
esac
fi
if [[ "$next" == "sk" ]]; then
setxkbmap -layout sk -variant qwerty
else
setxkbmap -layout "$next" -variant ""
fi
+17 -7
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Pending updates for xmobar from update-notify's pending list, e.g. " 15/3 | " (repo/AUR), empty when none # Pending updates for xmobar from update-notify's pending list, e.g. " 15/3 | " (repo/AUR), empty when none
# Entries already installed are dropped, so the count falls right after an upgrade. Orange from the threshold # Entries already installed are dropped, so the count falls right after an upgrade. Orange from the threshold
# on, red "K" when a custom kernel needs a rebuild. # on, red "K" when a custom kernel needs a rebuild, red "R" when a reboot is needed, blue "P" for .pacnew files.
# With "list": show the pending packages in a notification (for a click on the bar) # With "list": show the pending packages in a notification (for a click on the bar)
file="${XDG_STATE_HOME:-$HOME/.local/state}/update-notify/pending" file="${XDG_STATE_HOME:-$HOME/.local/state}/update-notify/pending"
@@ -11,7 +11,7 @@ mapfile -t entries < "$file"
names=() names=()
for e in "${entries[@]}"; do for e in "${entries[@]}"; do
read -r src pkg _ <<< "$e" read -r src pkg _ <<< "$e"
[[ $src != threshold ]] && names+=("$pkg") case $src in repo|aur|kernel) names+=("$pkg") ;; esac
done done
declare -A installed declare -A installed
@@ -21,10 +21,15 @@ if (( ${#names[@]} )); then
done < <(pacman -Q "${names[@]}" 2>/dev/null) done < <(pacman -Q "${names[@]}" 2>/dev/null)
fi fi
threshold=0 repo=() aur=() kernel=() threshold=0 repo=() aur=() kernel=() pacnew=() reboot=""
running=$(uname -r)
for e in "${entries[@]}"; do for e in "${entries[@]}"; do
read -r src pkg new <<< "$e" read -r src pkg new <<< "$e"
[[ $src == threshold ]] && { threshold=$pkg; continue; } case $src in
threshold) threshold=$pkg; continue ;;
pacnew) [[ -e ${e#pacnew } ]] && pacnew+=("${e#pacnew }"); continue ;; # gone once merged
reboot) [[ $pkg == "$running" ]] && reboot=$pkg; continue ;; # gone after the reboot
esac
have=${installed[$pkg]:-} have=${installed[$pkg]:-}
[[ -z $have ]] && continue # removed since the last run [[ -z $have ]] && continue # removed since the last run
case $src in case $src in
@@ -39,14 +44,19 @@ if [[ ${1:-} == list ]]; then
(( ${#repo[@]} )) && { printf -v l '%s\n' "${repo[@]}"; body+="Repo:"$'\n'"$l"; } (( ${#repo[@]} )) && { printf -v l '%s\n' "${repo[@]}"; body+="Repo:"$'\n'"$l"; }
(( ${#aur[@]} )) && { printf -v l '%s\n' "${aur[@]}"; body+="AUR:"$'\n'"$l"; } (( ${#aur[@]} )) && { printf -v l '%s\n' "${aur[@]}"; body+="AUR:"$'\n'"$l"; }
(( ${#kernel[@]} )) && { printf -v l 'Rebuild %s\n' "${kernel[@]}"; body+="$l"; } (( ${#kernel[@]} )) && { printf -v l 'Rebuild %s\n' "${kernel[@]}"; body+="$l"; }
(( ${#pacnew[@]} )) && { printf -v l '%s\n' "${pacnew[@]}"; body+="Merge with pacdiff:"$'\n'"$l"; }
[[ -n $reboot ]] && body+="Reboot (running $reboot)"$'\n'
body=${body%$'\n'} body=${body%$'\n'}
notify-send "Pending updates" "${body:-None}" notify-send "Pending updates" "${body:-None}"
exit exit
fi fi
total=$(( ${#repo[@]} + ${#aur[@]} )) total=$(( ${#repo[@]} + ${#aur[@]} ))
(( total + ${#kernel[@]} )) || exit 0 (( total + ${#kernel[@]} + ${#pacnew[@]} )) || [[ -n $reboot ]] || exit 0
text=$'\xef\x92\x87'" ${#repo[@]}/${#aur[@]}" # nf-oct-package, as UTF-8 bytes so the locale doesn't matter text=$'\xef\x92\x87' # nf-oct-package, as UTF-8 bytes so the locale doesn't matter
(( total >= threshold )) && text="<fc=#ffb86c>$text</fc>" (( total )) && text+=" ${#repo[@]}/${#aur[@]}" # markers alone: no "0/0"
(( total && total >= threshold )) && text="<fc=#ffb86c>$text</fc>"
(( ${#kernel[@]} )) && text+=" <fc=#f7768e>K</fc>" (( ${#kernel[@]} )) && text+=" <fc=#f7768e>K</fc>"
[[ -n $reboot ]] && text+=" <fc=#f7768e>R</fc>"
(( ${#pacnew[@]} )) && text+=" <fc=#7aa2f7>P</fc>"
echo "$text | " echo "$text | "
+81
View File
@@ -0,0 +1,81 @@
#!/bin/bash
# Current weather for xmobar, e.g. "<icon> 7°C": NOAA's decoded METAR (the source of xmobar's Weather plugin)
# Icon from the weather, else the sky conditions; clear/partly/mostly cloudy get moon icons when the sun is down.
# Temperature colors match the plugin's -L 0 -H 30: low up to 0, high above 30.
# With "notify": show the description (e.g. "Light drizzle, mist") and temperature in a notification instead.
STATION=LZIB LAT=48.2 LON=17.2
declare -A ICON=(
[thermometer]=$'\xef\x8b\x89' [day_sunny]=$'\xee\x8c\x8d' [night_clear]=$'\xee\x8c\xab'
[day_cloudy]=$'\xee\x8c\x82' [night_partly_cloudy]=$'\xee\x8d\xb9' [day_sunny_overcast]=$'\xee\x8c\x8c'
[night_cloudy]=$'\xee\x8d\xbe' [cloudy]=$'\xee\x8c\x92' [cloud]=$'\xee\x8c\xbd'
[thunderstorm]=$'\xee\x8c\x9d' [rain_mix]=$'\xee\x8c\x96' [snow]=$'\xee\x8c\x9a' [showers]=$'\xee\x8c\x99'
[rain]=$'\xee\x8c\x98' [sprinkle]=$'\xee\x8c\x9b' [fog]=$'\xee\x8c\x93' [smoke]=$'\xee\x8d\x9c'
[dust]=$'\xee\x8d\x9d'
)
report=$(curl -sf --max-time 20 https://tgftp.nws.noaa.gov/data/observations/metar/decoded/"$STATION".TXT)
temp=$(sed -n 's/^Temperature: .*(\([-0-9.]*\) C).*/\1/p' <<< "$report")
if [[ -z $temp ]]; then
if [[ $1 == notify ]]; then notify-send "Weather" "No report from $STATION"; else echo "<fn=1>${ICON[thermometer]}</fn> N/A"; fi
exit 0
fi
# Phenomena "in the vicinity" aren't at the station; the rest are e.g. "light drizzle; mist"
wx=$(sed -n 's/^Weather: //p' <<< "$report" | tr ';' '\n' | sed 's/^ *//' | grep -v vicinity)
wx=${wx,,}
sky=$(sed -n 's/^Sky conditions: //p' <<< "$report")
# CAVOK/NSC (no cloud below 5000 ft) have no sky line in the decoded report
[[ -z $sky ]] && grep -qE '^ob: .* (CAVOK|NSC) ' <<< "$report" && sky=clear
sky=${sky,,}
# Sun above the horizon (elevation > -0.833°, as for sunrise/sunset) right now, from the low-precision solar position
sun_up() {
awk -v t="$(date +%s)" -v lat="$LAT" -v lon="$LON" 'BEGIN {
r = atan2(0, -1) / 180; d = t / 86400 - 10957.5
g = (357.529 + 0.98560028 * d) * r
l = (280.459 + 0.98564736 * d + 1.915 * sin(g) + 0.020 * sin(2 * g)) * r
e = (23.439 - 0.00000036 * d) * r
ra = atan2(cos(e) * sin(l), cos(l)); s = sin(e) * sin(l); dec = atan2(s, sqrt(1 - s * s))
h = (280.46061837 + 360.98564736629 * d + lon) * r - ra
exit !(sin(lat * r) * sin(dec) + cos(lat * r) * cos(dec) * cos(h) > sin(-0.833 * r))
}'
}
case $wx in
*thunder*) icon=thunderstorm ;;
*freezing*|*sleet*|*ice\ pellets*|*hail*) icon=rain_mix ;;
*snow*rain*|*rain*snow*|*snow*drizzle*|*drizzle*snow*) icon=rain_mix ;;
*snow*) icon=snow ;;
*showers*) icon=showers ;;
*rain*) icon=rain ;;
*drizzle*) icon=sprinkle ;;
*fog*|*mist*) icon=fog ;;
*haze*|*smoke*) icon=smoke ;;
*dust*|*sand*) icon=dust ;;
*)
case $sky in
clear*) if sun_up; then icon=day_sunny; else icon=night_clear; fi ;;
"mostly clear"*|"partly cloudy"*) if sun_up; then icon=day_cloudy; else icon=night_partly_cloudy; fi ;;
"mostly cloudy"*) if sun_up; then icon=day_sunny_overcast; else icon=night_cloudy; fi ;;
overcast*|obscured*) icon=cloudy ;;
*) icon=cloud ;;
esac
;;
esac
if awk -v t="$temp" 'BEGIN { exit !(t > 30) }'; then color="#ffb86c"
elif awk -v t="$temp" 'BEGIN { exit !(t > 0) }'; then color="#50fa7b"
else color="#8be9fd"
fi
if [[ $1 == notify ]]; then
if [[ -n $wx ]]; then desc=$(paste -sd, <<< "$wx" | sed 's/,/, /g')
elif [[ $icon == day_sunny ]]; then desc=sunny
else desc=${sky:-unknown}
fi
notify-send "${ICON[$icon]} Weather" "${desc^}, $temp°C"
exit 0
fi
echo "<fn=1>${ICON[$icon]}</fn> <fc=$color>$temp</fc>°C"
+13 -19
View File
@@ -1,21 +1,15 @@
Config { overrideRedirect = True Config { overrideRedirect = True
, lowerOnStart = True , lowerOnStart = True
, font = "Jetbrains Mono Nerd Font Bold 9" , font = "Jetbrains Mono Nerd Font Bold 10"
, additionalFonts = ["Jetbrains Mono Nerd Font Bold 13"]
, bgColor = "#24283b" , bgColor = "#24283b"
, fgColor = "#737aa2" , fgColor = "#737aa2"
, position = Top , position = TopH 24
, border = NoBorder , border = NoBorder
, borderColor = "#24283b" , borderColor = "#24283b"
, allDesktops = True , allDesktops = True
, pickBroadest = True , pickBroadest = True
, commands = [ Run Weather "LZIB" , commands = [ Run Com "/home/fuxino/.config/xmobar/weather.sh" [] "weather" 9000
[ "--template", "\xf2c9 <tempC>°C"
, "-L", "5"
, "-H", "25"
, "--low" , "#8be9fd"
, "--normal" , "#50fa7b"
, "--high" , "#ff5555"
] 9000
, Run MultiCpu , Run MultiCpu
[ "--template" , "\xf4bc <total>%" [ "--template" , "\xf4bc <total>%"
, "--Low" , "25" , "--Low" , "25"
@@ -26,16 +20,17 @@ Config { overrideRedirect = True
] 10 ] 10
, Run CoreTemp , Run CoreTemp
[ "--template" , "<core0>°C" [ "--template" , "<core0>°C"
, "--Low" , "60" , "--Low" , "70"
, "--High" , "85" , "--High" , "90"
, "--low" , "#50fa7b" , "--low" , "#50fa7b"
, "--normal" , "#ffb86c" , "--normal" , "#ffb86c"
, "--high" , "#ff5555" , "--high" , "#ff5555"
] 50 ] 50
, Run Com "/home/fuxino/.config/xmobar/gpu.sh" [] "gpu" 50
, Run Memory , Run Memory
[ "--template" , "\xefc5 <usedratio>%" [ "--template" , "\xefc5 <usedratio>%"
, "--Low" , "33" , "--Low" , "50"
, "--High" , "66" , "--High" , "80"
, "--low" , "#50fa7b" , "--low" , "#50fa7b"
, "--normal" , "#ffb86c" , "--normal" , "#ffb86c"
, "--high" , "#ff5555" , "--high" , "#ff5555"
@@ -45,16 +40,15 @@ Config { overrideRedirect = True
, ("us" , "<fc=#ffb86c>US</fc>") , ("us" , "<fc=#ffb86c>US</fc>")
, ("sk(qwerty)" , "<fc=#ff5555>SK</fc>") , ("sk(qwerty)" , "<fc=#ff5555>SK</fc>")
] ]
, Run Date "\xf133 %a %Y-%m-%d <fc=#ff79c6>%H:%M</fc>" "date" 10 , Run Date "\xf133 %a %d/%m <fc=#ff79c6>%H:%M</fc>" "date" 10
, Run Uptime
[ "--template" , "\xf017 <days>d <hours>h"
] 600
, Run Com "/home/fuxino/.config/xmobar/pactl_volume.sh" [] "pactl_volume" 10 , Run Com "/home/fuxino/.config/xmobar/pactl_volume.sh" [] "pactl_volume" 10
, Run Com "/home/fuxino/.config/xmobar/ens_brief.sh" [] "ens_brief" 18000 , Run Com "/home/fuxino/.config/xmobar/ens_brief.sh" [] "ens_brief" 18000
, Run Com "/home/fuxino/.config/xmobar/updates.sh" [] "updates" 600 , Run Com "/home/fuxino/.config/xmobar/updates.sh" [] "updates" 600
, Run Com "/home/fuxino/.config/xmobar/backup.sh" [] "backup" 3600
, Run Com "/home/fuxino/.config/xmobar/calcurse.sh" [] "calcurse" 600
, Run UnsafeXMonadLog , Run UnsafeXMonadLog
] ]
, sepChar = "%" , sepChar = "%"
, alignSep = "}{" , alignSep = "}{"
, template = "  | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% |  %kbd% { <action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% " , template = "  | %UnsafeXMonadLog% } %multicpu% %coretemp% | %gpu% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/calcurse.sh list` button=1><action=`xdotool key super+shift+a` button=3>%calcurse%</action></action><action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/weather.sh notify`>%weather%</action> <fc=#565f89>·</fc> <action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%ens_brief%</action> | <action=`pactl set-sink-mute @DEFAULT_SINK@ toggle` button=1>%pactl_volume%</action> | %date% "
} }
+13 -19
View File
@@ -1,21 +1,15 @@
Config { overrideRedirect = True Config { overrideRedirect = True
, lowerOnStart = True , lowerOnStart = True
, font = "Jetbrains Mono Nerd Font Bold 9" , font = "Jetbrains Mono Nerd Font Bold 10"
, additionalFonts = ["Jetbrains Mono Nerd Font Bold 13"]
, bgColor = "#24283b" , bgColor = "#24283b"
, fgColor = "#737aa2" , fgColor = "#737aa2"
, position = Top , position = TopH 24
, border = NoBorder , border = NoBorder
, borderColor = "#24283b" , borderColor = "#24283b"
, allDesktops = True , allDesktops = True
, pickBroadest = True , pickBroadest = True
, commands = [ Run Weather "LZIB" , commands = [ Run Com "/home/fuxino/.config/xmobar/weather.sh" [] "weather" 9000
[ "--template", "\xf2c9 <tempC>°C"
, "-L", "5"
, "-H", "25"
, "--low" , "#8be9fd"
, "--normal" , "#50fa7b"
, "--high" , "#ff5555"
] 9000
, Run MultiCpu , Run MultiCpu
[ "--template" , "\xf4bc <total>%" [ "--template" , "\xf4bc <total>%"
, "--Low" , "25" , "--Low" , "25"
@@ -26,16 +20,17 @@ Config { overrideRedirect = True
] 10 ] 10
, Run CoreTemp , Run CoreTemp
[ "--template" , "<core0>°C" [ "--template" , "<core0>°C"
, "--Low" , "60" , "--Low" , "70"
, "--High" , "85" , "--High" , "90"
, "--low" , "#50fa7b" , "--low" , "#50fa7b"
, "--normal" , "#ffb86c" , "--normal" , "#ffb86c"
, "--high" , "#ff5555" , "--high" , "#ff5555"
] 50 ] 50
, Run Com "/home/fuxino/.config/xmobar/gpu.sh" [] "gpu" 50
, Run Memory , Run Memory
[ "--template" , "\xefc5 <usedratio>%" [ "--template" , "\xefc5 <usedratio>%"
, "--Low" , "33" , "--Low" , "50"
, "--High" , "66" , "--High" , "80"
, "--low" , "#50fa7b" , "--low" , "#50fa7b"
, "--normal" , "#ffb86c" , "--normal" , "#ffb86c"
, "--high" , "#ff5555" , "--high" , "#ff5555"
@@ -45,17 +40,16 @@ Config { overrideRedirect = True
, ("us" , "<fc=#ffb86c>US</fc>") , ("us" , "<fc=#ffb86c>US</fc>")
, ("sk(qwerty)" , "<fc=#ff5555>SK</fc>") , ("sk(qwerty)" , "<fc=#ff5555>SK</fc>")
] ]
, Run Date "\xf133 %a %Y-%m-%d <fc=#ff79c6>%H:%M</fc>" "date" 10 , Run Date "\xf133 %a %d/%m <fc=#ff79c6>%H:%M</fc>" "date" 10
, Run Uptime
[ "--template" , "\xf017 <days>d <hours>h"
] 600
, Run XPropertyLog "_XMONAD_TRAYPAD" , Run XPropertyLog "_XMONAD_TRAYPAD"
, Run Com "/home/fuxino/.config/xmobar/pactl_volume.sh" [] "pactl_volume" 10 , Run Com "/home/fuxino/.config/xmobar/pactl_volume.sh" [] "pactl_volume" 10
, Run Com "/home/fuxino/.config/xmobar/ens_brief.sh" [] "ens_brief" 18000 , Run Com "/home/fuxino/.config/xmobar/ens_brief.sh" [] "ens_brief" 18000
, Run Com "/home/fuxino/.config/xmobar/updates.sh" [] "updates" 600 , Run Com "/home/fuxino/.config/xmobar/updates.sh" [] "updates" 600
, Run Com "/home/fuxino/.config/xmobar/backup.sh" [] "backup" 3600
, Run Com "/home/fuxino/.config/xmobar/calcurse.sh" [] "calcurse" 600
, Run UnsafeXMonadLog , Run UnsafeXMonadLog
] ]
, sepChar = "%" , sepChar = "%"
, alignSep = "}{" , alignSep = "}{"
, template = "  | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% |  %kbd% { <action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% %_XMONAD_TRAYPAD% " , template = "  | %UnsafeXMonadLog% } %multicpu% %coretemp% | %gpu% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/calcurse.sh list` button=1><action=`xdotool key super+shift+a` button=3>%calcurse%</action></action><action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/weather.sh notify`>%weather%</action> <fc=#565f89>·</fc> <action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%ens_brief%</action> | <action=`pactl set-sink-mute @DEFAULT_SINK@ toggle` button=1>%pactl_volume%</action> | %date% %_XMONAD_TRAYPAD% "
} }
+301 -115
View File
@@ -1,9 +1,13 @@
-- Import -- Import
import Data.Monoid import Data.Monoid
import Graphics.X11.ExtraTypes.XF86 import Data.Bits (complement, (.&.))
import Control.Monad (forM_, liftM2, when) import Data.Char (toLower)
import Control.Monad (filterM, forM_, join, unless, when)
import qualified Data.Map.Strict as M
import Data.Maybe (isJust)
import XMonad import XMonad
import XMonad.Actions.OnScreen (Focus (FocusNew), onScreen)
import XMonad.Actions.PhysicalScreens import XMonad.Actions.PhysicalScreens
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageDocks
@@ -11,6 +15,7 @@ import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.Rescreen import XMonad.Hooks.Rescreen
import XMonad.Hooks.StatusBar import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP import XMonad.Hooks.StatusBar.PP
import XMonad.Hooks.UrgencyHook (NoUrgencyHook (..), withUrgencyHook)
import XMonad.Layout.Grid import XMonad.Layout.Grid
import XMonad.Layout.Magnifier import XMonad.Layout.Magnifier
import XMonad.Layout.NoBorders import XMonad.Layout.NoBorders
@@ -23,21 +28,26 @@ import XMonad.Layout.ThreeColumns
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Util.ClickableWorkspaces import XMonad.Util.ClickableWorkspaces
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
import qualified XMonad.Util.ExtensibleState as XS
import qualified XMonad.Util.Hacks as Hacks import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.Loggers import XMonad.Util.Loggers
import XMonad.Util.NamedActions
import XMonad.Util.NamedScratchpad import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput) import XMonad.Util.Run (runProcessWithInput, spawnPipe)
import XMonad.Util.SpawnOnce import XMonad.Util.SpawnOnce
import System.IO (hClose, hPutStr)
-- Main -- Main
main :: IO () main :: IO ()
main = main =
xmonad xmonad
. ewmhFullscreen . ewmhFullscreen
. setEwmhSwitchDesktopHook W.greedyView . setEwmhFullscreenHooks myFullscreenHook myUnfullscreenHook
. setEwmhSwitchDesktopHook safeView
. ewmh . ewmh
. docks . docks
. addAfterRescreenHook restartStatusBars . withUrgencyHook NoUrgencyHook
. rescreenHook def {afterRescreenHook = restartStatusBars, rescreenWorkspacesHook = Last (Just safeRescreen)}
. addRandrChangeHook (spawn myScreenHotplug) . addRandrChangeHook (spawn myScreenHotplug)
$ myConfig $ myConfig
@@ -57,17 +67,12 @@ myNormBorderColor = "#1f2335"
myFocusBorderColor :: String myFocusBorderColor :: String
myFocusBorderColor = "#41a6b5" myFocusBorderColor = "#41a6b5"
myKeyboardLayoutIT :: String myEarbuds :: String
myKeyboardLayoutIT = " -layout it" myEarbuds = "F4:9D:8A:B9:8C:EE"
myKeyboardLayoutUS :: String
myKeyboardLayoutUS = " -layout us"
myKeyboardLayoutSK :: String
myKeyboardLayoutSK = " -layout sk -variant qwerty"
-- Expanded by sh, as spawn runs it
myScreenshotDir :: String myScreenshotDir :: String
myScreenshotDir = "/home/fuxino/Pictures/Screenshots/" myScreenshotDir = "~/Pictures/Screenshots/"
myScreenshotName :: String myScreenshotName :: String
myScreenshotName = "Screenshot-%Y-%m-%d-%H%M%S.png" myScreenshotName = "Screenshot-%Y-%m-%d-%H%M%S.png"
@@ -76,34 +81,33 @@ myScreenshotName = "Screenshot-%Y-%m-%d-%H%M%S.png"
myScreenLayout :: String myScreenLayout :: String
myScreenLayout = "/home/fuxino/.local/bin/screen-layout" myScreenLayout = "/home/fuxino/.local/bin/screen-layout"
-- Safe to re-run (e.g. spawnOnce after this string changes and xmonad restarts) -- Safe to re-run (e.g. spawnOnce after this string changes and xmonad restarts); keeps the last wallpapers across logins
myScreenSetup :: String myScreenSetup :: String
myScreenSetup = myScreenSetup =
"sleep 1; " ++ myScreenLayout ++ "; pgrep -x picom > /dev/null || picom -b -c" "sleep 1; " ++ myScreenLayout ++ " --keep-wallpaper; pgrep -x picom > /dev/null || picom -b -c"
-- Run when a monitor is (dis)connected; restarts trayer so it moves to the right screen -- Run when a monitor is (dis)connected; restarts trayer so it moves to the right screen
myScreenHotplug :: String myScreenHotplug :: String
myScreenHotplug = myScreenLayout myScreenHotplug = myScreenLayout ++ " --keep-wallpaper"
myScratchpads :: [NamedScratchpad] myScratchpads :: [NamedScratchpad]
myScratchpads = myScratchpads =
[ NS "Riseup-vpn" "riseup-vpn" (className =? "RiseupVPN") (customFloating $ W.RationalRect 0.15 0.4 0.15 0.4), [ NS "Windscribe" "windscribe" (className =? "Windscribe2") (customFloating $ W.RationalRect 0.15 0.4 0.15 0.4),
NS "Terminal" spawnTerminal (className =? "scratch-terminal") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6), termPad "Terminal" "kitty-float" "",
NS "Music" spawnMusic (className =? "scratch-music") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6), termPad "Music" "ncmpcpp" "ncmpcpp",
NS "Mail" spawnMail (className =? "scratch-mail") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6), termPad "Mail" "mutt" "bash -c 'pushd ~/Downloads > /dev/null; mutt; popd > /dev/null'",
NS "Cal" spawnCal (className =? "scratch-cal") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6), termPad "Cal" "calcurse" "calcurse",
NS "Btop" spawnBtop (className =? "scratch-btop") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6) termPad "Btop" "btop" "btop"
] ]
where where
spawnTerminal = myTerminal ++ " --class scratch-terminal -T kitty-float" -- Centred kitty with class scratch-<name>, window title t, running cmd
spawnMusic = myTerminal ++ " --class scratch-music -T ncmpcpp ncmpcpp" termPad name t cmd =
spawnMail = myTerminal ++ " --class scratch-mail -T mutt bash -c 'pushd ~/Downloads > /dev/null; mutt; popd > /dev/null'" let cls = "scratch-" ++ map toLower name
spawnCal = myTerminal ++ " --class scratch-cal -T calcurse calcurse" in NS name (unwords [myTerminal, "--class", cls, "-T", t, cmd]) (className =? cls) (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6)
spawnBtop = myTerminal ++ " --class scratch-btop -T btop btop"
-- Config -- Config
myConfig = myConfig =
def addDescrKeys' ((myModMask, xK_F1), showKeys) myKeys $ def
{ modMask = myModMask, { modMask = myModMask,
terminal = myTerminal, terminal = myTerminal,
workspaces = myWorkspaces, workspaces = myWorkspaces,
@@ -115,57 +119,146 @@ myConfig =
handleEventHook = myHandleEventHook, handleEventHook = myHandleEventHook,
logHook = myLogHook logHook = myLogHook
} }
`additionalKeysP` [ ("M-b", sendMessage ToggleStruts),
("M-S-l", spawn "slock"), -- Keys
("<Print>", unGrab *> spawn ("scrot " ++ myScreenshotDir ++ myScreenshotName)), -- xmonad's described defaults minus the ones overridden here, so M-<F1> lists each key once
("S-<Print>", unGrab *> spawn ("scrot -s " ++ myScreenshotDir ++ myScreenshotName)), myKeys :: XConfig Layout -> [((KeyMask, KeySym), NamedAction)]
("M-S-<Print>", unGrab *> spawn ("scrot -u " ++ myScreenshotDir ++ myScreenshotName)), myKeys c = dropEmptyGroups (filter ((`notElem` overridden) . fst) (defaultKeysDescr c)) ++ custom
("M-d", spawn "dmenu_run"), where
("M-p", spawn "passmenu -i"), custom = myCustomKeys c
("M-f", sendMessage $ JumpToLayout "Tabbed"), -- M-r/M-S-r: there's no third screen
("M-i", spawn $ "setxkbmap" ++ myKeyboardLayoutIT), overridden = (myModMask, xK_r) : (myModMask .|. shiftMask, xK_r) : filter (/= (0, 0)) (map fst custom)
("M-u", spawn $ "setxkbmap" ++ myKeyboardLayoutUS), -- (0, 0) is a subtitle or separator; drop it when nothing follows before the next one
("M-s", spawn $ "setxkbmap" ++ myKeyboardLayoutSK), dropEmptyGroups (((0, 0), _) : rest@(((0, 0), _) : _)) = dropEmptyGroups rest
("M-S-v", namedScratchpadAction myScratchpads "Riseup-vpn"), dropEmptyGroups [((0, 0), _)] = []
("M-S-s", namedScratchpadAction myScratchpads "Terminal"), dropEmptyGroups (x : rest) = x : dropEmptyGroups rest
("M-S-a", namedScratchpadAction myScratchpads "Cal"), dropEmptyGroups [] = []
("M-o", namedScratchpadAction myScratchpads "Btop"),
("M-x", spawn "bluetoothctl connect F4:9D:8A:B9:8C:EE"), myCustomKeys :: XConfig Layout -> [((KeyMask, KeySym), NamedAction)]
("M-S-x", spawn "bluetoothctl disconnect F4:9D:8A:B9:8C:EE") myCustomKeys c =
concatMap
(\(t, ks) -> subtitle t : mkNamedKeymap c ks)
[ ( "launchers",
[ ("M-d", addName "Run a program (dmenu)" $ spawn "dmenu_run"),
("M-p", addName "Passwords (passmenu)" $ spawn "passmenu -i"),
("<XF86HomePage>", addName "Browser" $ spawn myBrowser),
("<XF86Calculator>", addName "Calculator" $ spawn "qalculate-gtk")
] ]
`additionalKeys` [ ((0, xF86XK_AudioMute), spawn "pactl set-sink-mute $(pactl get-default-sink) toggle"), ),
((0, xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume $(pactl get-default-sink) -10%"), ( "scratchpads",
((0, xF86XK_AudioRaiseVolume), spawn "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 10%+"), [ ("M-S-s", addName "Terminal" $ namedScratchpadAction myScratchpads "Terminal"),
((0, xF86XK_Calculator), spawn "qalculate-gtk"), ("M-S-a", addName "Calendar (calcurse)" $ namedScratchpadAction myScratchpads "Cal"),
((0, xF86XK_HomePage), spawn myBrowser), ("M-o", addName "btop" $ namedScratchpadAction myScratchpads "Btop"),
((0, xF86XK_Mail), namedScratchpadAction myScratchpads "Mail"), ("M-S-v", addName "Windscribe VPN" $ namedScratchpadAction myScratchpads "Windscribe"),
((0, xF86XK_Tools), namedScratchpadAction myScratchpads "Music") ("<XF86Mail>", addName "Mail (mutt)" $ namedScratchpadAction myScratchpads "Mail"),
("<XF86Tools>", addName "Music (ncmpcpp)" $ namedScratchpadAction myScratchpads "Music")
] ]
++ [ ((myModMask .|. mask, key), f sc) ),
| (key, sc) <- zip [xK_w, xK_e] [0 ..], ( "session and layout",
(f, mask) <- [(viewScreen def, 0), (sendToScreen def, shiftMask)] [ ("M-S-l", addName "Lock the screen" $ spawn "loginctl lock-session"),
("M-S-n", addName "Show older notification" $ spawn "dunstctl history-pop"),
("M-C-n", addName "Close all notifications" $ spawn "dunstctl close-all"),
("M-b", addName "Toggle the status bar gap" $ sendMessage ToggleStruts),
("M-f", addName "Tabbed layout" $ sendMessage $ JumpToLayout "Tabbed"),
("M-i", addName "Keyboard: Italian" $ spawn "setxkbmap -layout it"),
("M-u", addName "Keyboard: US" $ spawn "setxkbmap -layout us"),
("M-s", addName "Keyboard: Slovak" $ spawn "setxkbmap -layout sk -variant qwerty"),
("M-x", addName "Connect earbuds" $ spawn $ "bluetoothctl connect " ++ myEarbuds),
("M-S-x", addName "Disconnect earbuds" $ spawn $ "bluetoothctl disconnect " ++ myEarbuds)
] ]
),
( "screenshots",
[ ("<Print>", addName "Whole screen" $ unGrab *> spawn ("scrot " ++ myScreenshotDir ++ myScreenshotName)),
("S-<Print>", addName "Select an area" $ unGrab *> spawn ("scrot -s " ++ myScreenshotDir ++ myScreenshotName)),
("M-S-<Print>", addName "Focused window" $ unGrab *> spawn ("scrot -u " ++ myScreenshotDir ++ myScreenshotName))
]
),
( "media keys",
[ ("<XF86AudioMute>", addName "Mute" $ spawn "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"),
("<XF86AudioLowerVolume>", addName "Volume down" $ spawn "wpctl set-volume @DEFAULT_AUDIO_SINK@ 10%-"),
("<XF86AudioRaiseVolume>", addName "Volume up" $ spawn "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 10%+"),
("<XF86AudioPlay>", addName "Play/pause" $ spawn "playerctl play-pause"),
("<XF86AudioPause>", addName "Pause" $ spawn "playerctl pause"),
("<XF86AudioStop>", addName "Stop" $ spawn "playerctl stop"),
("<XF86AudioNext>", addName "Next track" $ spawn "playerctl next"),
("<XF86AudioPrev>", addName "Previous track" $ spawn "playerctl previous")
]
),
( "workspaces and screens",
[ (m ++ show n, addName (d ++ show n ++ " (" ++ name ++ ")") $ windows $ f ws)
| (n, ws, name) <- zip3 [1 :: Int ..] myWorkspaces ["terminal", "web", "games", "chat", "media", "docs", "VM", "free", "free"],
(m, d, f) <- [("M-", "Workspace ", safeView), ("M-S-", "Send window to workspace ", W.shift)]
]
++ [ (m ++ k, addName (d ++ side) $ f def sc)
| (k, sc, side) <- [("w", 0, "left screen"), ("e", 1, "right screen")],
(m, d, f) <- [("M-", "Focus ", viewScreen), ("M-S-", "Send window to ", sendToScreen)]
]
)
]
-- Shows the key list in dmenu (type to filter; picking a line does nothing).
-- spawnPipe rather than runProcessWithInput, which would block xmonad while dmenu is open.
showKeys :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
showKeys ks = addName "Show keybindings" $ do
h <- spawnPipe "dmenu -i -l 30 -p Keys"
io $ hPutStr h (unlines $ map tidy $ filter (not . null) $ lines $ unlines $ showKm ks) >> hClose h
where
-- showKm writes the mod key as M4- (it doesn't know modMask); re-pad after shortening it
tidy l@('>' : _) = l
tidy l = let (k, d) = break (== ' ') l in take 24 (fixMod k ++ repeat ' ') ++ dropWhile (== ' ') d
fixMod ('M' : '4' : '-' : r) = "M-" ++ fixMod r
fixMod (x : r) = x : fixMod r
fixMod [] = []
-- greedyView that keeps wsGames on screen 0 (HDMI), and focuses it: Wine games lose the mouse when moved between screens
safeView :: WorkspaceId -> WindowSet -> WindowSet
safeView i ws
| i == wsGames = onScreen (W.greedyView i) FocusNew 0 ws
| W.currentTag ws == wsGames && i `elem` map (W.tag . W.workspace) (W.visible ws) = W.view i ws
| otherwise = W.greedyView i ws
-- xmonad's rescreen, except that a hidden wsGames is never put on a secondary screen
safeRescreen :: X ()
safeRescreen = do
screens <- withDisplay getCleanedScreenInfo
case screens of
[] -> return ()
xinesc : xinescs ->
windows $ \ws ->
let notGames = (/= wsGames) . W.tag
pool = map W.workspace (W.visible ws) ++ filter notGames (W.hidden ws)
(xs, _) = splitAt (length xinescs) pool
shown = map W.tag (W.workspace (W.current ws) : xs)
in ws
{ W.current = W.Screen (W.workspace (W.current ws)) 0 (SD xinesc),
W.visible = zipWith3 W.Screen xs [1 ..] (map SD xinescs),
W.hidden = filter ((`notElem` shown) . W.tag) (map W.workspace (W.visible ws) ++ W.hidden ws)
}
-- Workspaces -- Workspaces
myWorkspaces :: [String] myWorkspaces :: [String]
myWorkspaces = [wsTerm, wsWeb, wsGames, wsChat, wsMedia, wsDocs, wsVM] ++ map show [8, 9] myWorkspaces = [wsTerm, wsWeb, wsGames, wsChat, wsMedia, wsDocs, wsVM] ++ map show [8, 9 :: Int]
-- Icons spill past their advance in the non-Mono Nerd Font: keep them ~1000-1160 units wide or gaps look uneven
wsTerm, wsWeb, wsGames, wsChat, wsMedia, wsDocs, wsVM :: String wsTerm, wsWeb, wsGames, wsChat, wsMedia, wsDocs, wsVM :: String
wsTerm = "1:\xf489 " wsTerm = "1:\xf489 "
wsWeb = "2:\xe743 " wsWeb = "2:\xf0ac "
wsGames = "3:\xf1b6 " wsGames = "3:\xf11b "
wsChat = "4:\xf10b " wsChat = "4:\xf086 "
wsMedia = "5:\xead9 " wsMedia = "5:\xefab "
wsDocs = "6:\xeb69 " wsDocs = "6:\xede2 "
wsVM = "7:\xea7a " wsVM = "7:\xf108 "
-- Layout -- Layout
myLayoutHook = onWorkspace wsWeb myWebLayout $ onWorkspace wsGames myGamesLayout $ onWorkspace wsMedia myVideoLayout myDefaultLayout myLayoutHook =
avoidStruts $
onWorkspaces [wsGames, wsMedia] (smartBorders Full) $
onWorkspace wsWeb (spaced $ myTabbed ||| tiled ||| Mirror tiled ||| others) $
spaced (tiled ||| Mirror tiled ||| myTabbed ||| others)
where where
myWebLayout = avoidStruts $ renamed [CutWordsLeft 1] $ spacingWithEdge 3 $ myTabbed ||| tiled ||| Mirror tiled ||| threeCol ||| Grid ||| spiral 0.856 -- CutWordsLeft drops the "Spacing" prefix from the layout names
myGamesLayout = avoidStruts $ smartBorders Full spaced l = renamed [CutWordsLeft 1] $ spacingWithEdge 3 l
myVideoLayout = avoidStruts $ smartBorders Full others = threeCol ||| Grid ||| spiral 0.856
myDefaultLayout = avoidStruts $ renamed [CutWordsLeft 1] $ spacingWithEdge 3 $ tiled ||| Mirror tiled ||| myTabbed ||| threeCol ||| Grid ||| spiral 0.856
threeCol = threeCol =
renamed [Replace "ThreeCol"] $ renamed [Replace "ThreeCol"] $
magnifiercz' 1.3 $ magnifiercz' 1.3 $
@@ -209,15 +302,47 @@ myXmobarPP =
ppHidden = cultured . wrap " " "", ppHidden = cultured . wrap " " "",
ppHiddenNoWindows = outerspace . wrap " " "", ppHiddenNoWindows = outerspace . wrap " " "",
ppUrgent = sunsetorange . wrap (keylime "!") (keylime "!"), ppUrgent = sunsetorange . wrap (keylime "!") (keylime "!"),
ppOrder = \[ws, l, _, wins] -> [ws, l, wins], -- Show "1:<icon>" as just the icon; tags stay as they are (clickablePP uses the index)
ppExtras = [logTitles formatFocused formatUnfocused] ppRename = \tag _ -> case break (== ':') tag of
(_, ':' : icon) -> icon
_ -> tag,
-- NamedScratchpad never removes NSP once created; hide it while it's empty
ppSort = (. filter (\w -> W.tag w /= scratchpadWorkspaceTag || isJust (W.stack w))) <$> ppSort def,
ppOrder = dropTitle,
ppLayout = layoutIcon,
ppExtras = [budgetTitles]
} }
where where
formatFocused = wrap (cultured "[") (cultured "]") . pink . ppWindow -- The focused title is replaced by budgetTitles
formatUnfocused = wrap (outerspace "[") (outerspace "]") . cultured . ppWindow dropTitle :: [String] -> [String]
dropTitle (ws : l : _ : rest) = ws : l : rest
dropTitle xs = xs
ppWindow :: String -> String layoutIcon :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 20 layoutIcon l = case l of
"Tall" -> "\xf0bcc"
"Mirror Tall" -> "\xf0bcb"
"Tabbed" -> "\xf04e9"
"ThreeCol" -> "\xf056d"
"Grid" -> "\xf0570"
"Spiral" -> "\xf056e"
"Full" -> "\xf0293"
_ -> l
-- Titles share one width budget, so more windows get shorter titles instead of overflowing the bar
budgetTitles :: Logger
budgetTitles = do
n <- gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset
let width = max 8 . min 30 $ 60 `div` max 1 n
logTitles' (TitlesFormat (formatFocused width) (formatUnfocused width) (formatUrgent width))
formatFocused, formatUnfocused, formatUrgent :: Int -> String -> String
formatFocused w = wrap (cultured "[") (cultured "]") . pink . ppWindow w
formatUnfocused w = wrap (outerspace "[") (outerspace "]") . cultured . ppWindow w
formatUrgent w = wrap (keylime "!") (keylime "!") . sunsetorange . ppWindow w
ppWindow :: Int -> String -> String
ppWindow w = xmobarRaw . (\t -> if null t then "untitled" else t) . shorten' "…" w
outerspace, pink, sunsetorange, cultured, keylime :: String -> String outerspace, pink, sunsetorange, cultured, keylime :: String -> String
pink = xmobarColor "#ff79c6" "" pink = xmobarColor "#ff79c6" ""
@@ -230,66 +355,86 @@ myXmobarPP =
myStartupHook :: X () myStartupHook :: X ()
myStartupHook = do myStartupHook = do
restartStatusBars restartStatusBars
scanDiscoverOverlay
spawnOnce myScreenSetup spawnOnce myScreenSetup
spawnOnce "systemctl --user start fehbg.timer" spawnOnce "systemctl --user start fehbg.timer"
spawnOnce "xsetroot -cursor_name left_ptr" spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "xautolock -time 10 -locker slock -detectsleep" spawnOnce "xset s 590 10"
spawnOnce "systemctl --user start xautolock-inhibit" spawnOnce "xset dpms 0 0 900"
spawnOnce "xss-lock -n xidle-dim -l -- screen-lock"
spawnOnce "systemctl --user start xidle-inhibit"
spawnOnce "redshift-gtk" spawnOnce "redshift-gtk"
spawnOnce "systemctl --user start udiskie" spawnOnce "systemctl --user start udiskie"
spawnOnce "nm-applet" spawnOnce "nm-applet"
spawnOnce "arch-audit-gtk" spawnOnce "arch-audit-gtk"
spawnOnce "calcurse --daemon" spawnOnce "calcurse --daemon"
spawnOnce "systemctl --user start calcurse-today.timer"
spawnOnce "systemctl --user start calcurse-sync.timer"
spawnOnce "systemctl --user start dunst" spawnOnce "systemctl --user start dunst"
spawnOnce "lxpolkit" spawnOnce "lxpolkit"
spawnOnce "numlockx" spawnOnce "numlockx"
spawnOnce "blueman-applet" spawnOnce "blueman-applet"
spawnOnce "adb start-server" spawnOnce "adb start-server"
spawnOnce "/home/fuxino/.local/bin/discover-overlay-wait" spawnOnce "systemctl --user start discover-overlay-wait"
-- Manage hook -- Manage hook
myManageHook :: ManageHook myManageHook :: ManageHook
myManageHook = myManageHook =
composeAll composeAll
[ className =? "Gpodder" --> doShift wsMedia, [ -- Proton games are steam_app_<id>; Wine windows are named after their .exe
className =? "An Anime Game Launcher" --> doShift wsGames, className ^? "steam_app_" --> doShift wsGames,
className =? "Qalculate-gtk" --> doFloat, className $? ".exe" --> doShift wsGames,
classIn ["steam", "an anime game launcher"] --> doShift wsGames,
title =? "Genshin Impact" --> doShift wsGames, title =? "Genshin Impact" --> doShift wsGames,
className =? "Signal" --> doShift wsChat, classIn ["steam_app_109600", "steam_app_289070"] --> doFloat,
className =? "Spotify" --> doShift wsMedia, classIn ["zen", "vivaldi-stable", "transmission-gtk"] --> doShift wsWeb,
className =? "Transmission-gtk" --> doShift wsWeb, classIn ["signal", "discord"] --> doShift wsChat,
className =? "Viewnior" --> doFloat, classIn ["gpodder", "spotify", "freetube", "scrcpy", "gimp", "audacity"] --> doShift wsMedia,
className =? "Vivaldi-stable" --> doShift wsWeb, classIn ["xreader", "calibre", "library_manager", "libreoffice-calc", "libreoffice-writer"] --> doShift wsDocs,
className =? "Xmessage" --> doFloat, classIn ["virtualbox manager"] --> doShift wsVM,
className =? "Xreader" --> doShift wsDocs, className =? "VirtualBox Machine" --> doFullFloat <+> doShift wsVM,
className =? "calibre" --> doShift wsDocs, className =? "mpv" --> doFullFloat <+> viewShift wsMedia,
className =? "discord" --> doShift wsChat,
className =? "explorer.exe" --> doShift wsGames,
className =? "feh" --> doFloat,
title =? "glxgears" --> doFloat,
className =? "library_manager" --> doShift wsDocs,
className =? "libreoffice-calc" --> doShift wsDocs,
className =? "libreoffice-writer" --> doShift wsDocs,
className =? "mpv" --> doFullFloat,
className =? "mpv" --> viewShift wsMedia,
className =? "freetube" --> doShift wsMedia,
className =? myTerminal --> doShift wsTerm, className =? myTerminal --> doShift wsTerm,
className =? "scrcpy" --> doShift wsMedia, classIn
className =? "steam" --> doShift wsGames, [ "qalculate-gtk", "viewnior", "xmessage", "feh", "lxappearance", "qt5ct", "qt6ct",
className =? "steam_app_109600" --> doFloat, "pavucontrol", "org.pulseaudio.pavucontrol", "zenity", "org.gnome.zenity"
className =? "steam_app_109600" --> doShift wsGames, ]
className =? "steam_app_289070" --> doFloat, --> doFloat,
className =? "steam_app_289070" --> doShift wsGames, title =? "glxgears" --> doFloat,
className =? "VirtualBox Machine" --> doShift wsVM,
className =? "VirtualBox Machine" --> doFullFloat,
className =? "VirtualBox Manager" --> doShift wsVM,
className =? "zen" --> doShift wsWeb,
isDialog --> doFloat, isDialog --> doFloat,
-- Windows that open already fullscreen; ewmhFullscreen only handles later requests -- Windows that open already fullscreen; ewmhFullscreen only handles later requests
isFullscreen --> doFullFloat isFullscreen --> doFullFloat
] ]
<+> namedScratchpadManageHook myScratchpads <+> namedScratchpadManageHook myScratchpads
where viewShift = doF . liftM2 (.) W.greedyView W.shift where
viewShift = doF . liftA2 (.) safeView W.shift
-- Case-insensitive, as GTK4 and firejailed apps capitalise their class differently
classIn names = (`elem` names) . map toLower <$> className
-- Fullscreen toggles: remember each window's float rect (Nothing if tiled) so leaving
-- fullscreen restores it instead of always sinking the window.
newtype PreFullscreen = PreFullscreen (M.Map Window (Maybe W.RationalRect))
instance ExtensionClass PreFullscreen where
initialValue = PreFullscreen M.empty
myFullscreenHook :: ManageHook
myFullscreenHook = do
w <- ask
liftX $ do
old <- gets (M.lookup w . W.floating . windowset)
XS.modify (\(PreFullscreen m) -> PreFullscreen (M.insert w old m))
doFullFloat
-- Windows with no record (e.g. opened fullscreen) are sunk, as before.
myUnfullscreenHook :: ManageHook
myUnfullscreenHook = do
w <- ask
old <- liftX $ do
PreFullscreen m <- XS.get
XS.put (PreFullscreen (M.delete w m))
pure (join (M.lookup w m))
maybe doSink doRectFloat old
-- Handle event hook -- Handle event hook
myHandleEventHook :: Event -> X All myHandleEventHook :: Event -> X All
@@ -298,6 +443,24 @@ myHandleEventHook =
<> Hacks.trayerAboveXmobarEventHook <> Hacks.trayerAboveXmobarEventHook
<> Hacks.trayerPaddingXmobarEventHook <> Hacks.trayerPaddingXmobarEventHook
<> Hacks.fixSteamFlicker <> Hacks.fixSteamFlicker
<> pinWindscribe
<> trackDiscoverOverlay
-- Windscribe moves itself to a saved position after mapping: apply its resizes (as core does for floats) but drop moves.
pinWindscribe :: Event -> X All
pinWindscribe e@ConfigureRequestEvent {ev_window = w} = do
floats <- gets (W.floating . windowset)
pinned <- if M.member w floats then runQuery (className =? "Windscribe2") w else pure False
when pinned $ withDisplay $ \dpy -> do
bw <- asks (borderWidth . config)
io $ configureWindow dpy w (ev_value_mask e .&. complement (fromIntegral (cWX .|. cWY))) $
WindowChanges
{ wc_x = 0, wc_y = 0, wc_width = ev_width e, wc_height = ev_height e,
wc_border_width = fromIntegral bw, wc_sibling = ev_above e, wc_stack_mode = ev_detail e }
float w
io $ sync dpy False
pure (All (not pinned))
pinWindscribe _ = pure (All True)
-- Log hook -- Log hook
myLogHook :: X () myLogHook :: X ()
@@ -306,11 +469,34 @@ myLogHook = do
xmonadPropLog =<< dynamicLogString =<< clickablePP myXmobarPP xmonadPropLog =<< dynamicLogString =<< clickablePP myXmobarPP
-- discover-overlay's windows are override-redirect, so xmonad doesn't manage them and -- discover-overlay's windows are override-redirect, so xmonad doesn't manage them and
-- raising a floating window (e.g. a game) covers them; put them back on top after every change -- raising a floating window (e.g. a game) covers them; put them back on top after every change.
raiseDiscoverOverlay :: X () -- They're remembered when mapped, so the log hook doesn't query every window each time.
raiseDiscoverOverlay = withDisplay $ \d -> do newtype OverlayWindows = OverlayWindows [Window]
instance ExtensionClass OverlayWindows where
initialValue = OverlayWindows []
isDiscoverOverlay :: Window -> X Bool
isDiscoverOverlay = runQuery (className =? "Discover-overlay")
-- Startup (incl. xmonad --restart): pick up overlays mapped before the event hook could see them
scanDiscoverOverlay :: X ()
scanDiscoverOverlay = withDisplay $ \d -> do
root <- asks theRoot root <- asks theRoot
(_, _, ws) <- io $ queryTree d root (_, _, ws) <- io $ queryTree d root
forM_ ws $ \w -> do XS.put . OverlayWindows =<< filterM isDiscoverOverlay ws
cls <- io $ getClassHint d w
when (resClass cls == "Discover-overlay") $ io $ raiseWindow d w trackDiscoverOverlay :: Event -> X All
trackDiscoverOverlay MapNotifyEvent {ev_window = w, ev_override_redirect = True} = do
overlay <- isDiscoverOverlay w
when overlay $ XS.modify $ \(OverlayWindows ws) -> OverlayWindows (w : filter (/= w) ws)
pure (All True)
trackDiscoverOverlay DestroyWindowEvent {ev_window = w} = do
XS.modify $ \(OverlayWindows ws) -> OverlayWindows (filter (/= w) ws)
pure (All True)
trackDiscoverOverlay _ = pure (All True)
raiseDiscoverOverlay :: X ()
raiseDiscoverOverlay = do
OverlayWindows ws <- XS.get
unless (null ws) $ withDisplay $ \d -> io $ mapM_ (raiseWindow d) ws
Executable
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# Sets a random wallpaper on each monitor; with --keep, redraws the last ones picked instead.
cache=${XDG_CACHE_HOME:-$HOME/.cache}/wallpapers
if [[ $1 != --keep || ! -s $cache ]]; then
# One image per connected output, so --keep still has enough after an output was off
count=$(xrandr --query | grep -c ' connected')
shuf -n "$count" -e ~/.local/share/backgrounds/random/* > "$cache"
fi
mapfile -t walls < "$cache"
exec /usr/bin/feh --no-fehbg --bg-fill "${walls[@]}"
+55
View File
@@ -0,0 +1,55 @@
# dotfiles
Configuration for my Arch Linux desktop: xmonad + xmobar on X11, kitty, fish, vim, mutt, mpd/ncmpcpp, lf and friends.
The repo is a bare git repository whose work tree is `$HOME`, so files are tracked in place with no symlinks or
install script. This README lives in `.github/` to keep it out of the home directory.
## Contents
| Area | Files |
| --- | --- |
| Shells | `.bashrc`, `.bash_profile`, `.bash_aliases`, `.config/fish/`, `.config/starship.toml` |
| X session | `.xinitrc`, `.xserverrc`, `.Xresources`, `.config/picom/`, `.config/dunst/` |
| Window manager | `.config/xmonad/` (built with stack), `.config/xmobar/` (bar configs and helper scripts) |
| Theming | `.gtkrc-2.0`, `.config/gtk-3.0/`, `.config/qt5ct/`, `.config/qt6ct/`, kitty and btop themes |
| Terminal apps | kitty, vim, lf, vifm, btop, calcurse, mutt, fastfetch/hyfetch |
| Audio / media | mpd, ncmpcpp, mpDris2, mpv, beets, pipewire |
| Packaging | `.config/aurutils-makepkg.conf`, `.config/aurb/`, `.local/bin/aurb` / `aurs` (aurutils wrappers) |
| Services | `.config/systemd/user/` (timers and overrides) |
| Scripts | `.local/bin/` (screen layout, phone mount, video helpers, Library, Garmin and Weather database dumps) |
Note: `config.fish` sources `~/.bash_aliases`, so the aliases apply in both shells.
## Setup on a new machine
```fish
git clone --bare https://git.shouldnt.work/fuxino/dotfiles.git ~/.dotfiles
alias config 'git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
config config status.showUntrackedFiles no
config checkout
```
If `checkout` refuses because some files already exist, move them out of the way (or delete them) and run it again.
## Not in the repo
Some files are deliberately left out and have to be recreated by hand:
- `.gitconfig`
- `.config/mutt/accounts/main_gmail` (account settings; `muttrc` sources it, so mutt won't start without it)
- Credentials (`.git-credentials`, the aurutils git credentials)
- Generated or state files (fish variables, histories, completions)
### xmonad and xmobar
Only `stack.yaml`, its lock file, `build` and `xmonad.hs` are tracked. The sources are expected as git checkouts
next to them:
```fish
cd ~/.config/xmonad
git clone https://github.com/xmonad/xmonad xmonad-git
git clone https://github.com/xmonad/xmonad-contrib xmonad-contrib-git
git clone https://codeberg.org/xmobar/xmobar xmobar-git
stack install
```
+10
View File
@@ -31,3 +31,13 @@ aur "$cmd" \
--bind-rw "$THINLTO_HOST_DIR" \ --bind-rw "$THINLTO_HOST_DIR" \
--bind "$HOME/.config/aurb" \ --bind "$HOME/.config/aurb" \
"${args[@]}" "${args[@]}"
status=$?
# After a successful sync, drop downloaded sources and logs from the AUR clones. Without -d,
# git clean keeps untracked directories, so VCS sources (bare clones) survive.
if [[ $cmd == sync && $status -eq 0 ]]; then
for clone in "${AURDEST:-${XDG_CACHE_HOME:-$HOME/.cache}/aurutils/sync}"/*/; do
[[ -d $clone.git ]] && git -C "$clone" clean -fxq
done
fi
exit "$status"
+101
View File
@@ -0,0 +1,101 @@
#!/usr/bin/env python3
"""Renew calcurse-caldav's Google login: catch the OAuth redirect on 127.0.0.1 and hand the code to calcurse-sync.
--prompt shows a notification first and logs in when it is clicked.
"""
import argparse
import configparser
import os
import subprocess
import sys
import time
import urllib.parse
from http.server import BaseHTTPRequestHandler, HTTPServer
from pathlib import Path
CONFIG = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "calcurse" / "caldav" / "config"
WAIT_SECONDS = 300
def notify(summary: str, body: str = "", *extra: str) -> str:
"""Send a calcurse notification; with actions in extra, wait and return the chosen action's name."""
cmd = ["notify-send", "-a", "calcurse", "-i", "x-office-calendar", *extra, summary, body]
return subprocess.run(cmd, capture_output=True, text=True).stdout.strip()
def redirect_port() -> int:
parser = configparser.RawConfigParser()
parser.read(CONFIG)
uri = urllib.parse.urlparse(parser.get("OAuth2", "RedirectURI", fallback=""))
if uri.hostname != "127.0.0.1" or uri.port is None:
sys.exit(f"RedirectURI in {CONFIG} must be http://127.0.0.1:<port>")
return uri.port
def ui_running() -> bool:
ttys = subprocess.run(["ps", "-C", "calcurse", "-o", "tty="], capture_output=True, text=True).stdout.split()
return any(tty != "?" for tty in ttys)
class RedirectHandler(BaseHTTPRequestHandler):
result: dict[str, str] = {}
def do_GET(self) -> None:
query = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query)
for key in ("code", "error"):
if key in query:
RedirectHandler.result[key] = query[key][0]
done = bool(RedirectHandler.result)
self.send_response(200 if done else 404)
self.send_header("Content-Type", "text/plain; charset=utf-8")
self.end_headers()
if done:
self.wfile.write(b"calcurse: login received, you can close this tab.\n")
def log_message(self, format: str, *args: object) -> None:
pass
def login() -> int:
if ui_running():
notify("Google Calendar login", "Close calcurse first, then log in again.", "-u", "critical")
return 1
server = HTTPServer(("127.0.0.1", redirect_port()), RedirectHandler)
# With an expired login calcurse-caldav opens the consent page and exits; with a valid one it just syncs.
if subprocess.run(["calcurse-caldav"], capture_output=True).returncode == 0:
notify("Google Calendar login", "Already logged in.")
return 0
deadline = time.monotonic() + WAIT_SECONDS
while not RedirectHandler.result and (left := deadline - time.monotonic()) > 0:
server.timeout = left
server.handle_request()
server.server_close()
code = RedirectHandler.result.get("code")
if not code:
reason = RedirectHandler.result.get("error", "no answer from the browser")
notify("Google Calendar login failed", reason, "-u", "critical")
return 1
# The user manager's PATH lacks ~/.local/bin: call calcurse-sync from this script's folder.
calcurse_sync = Path(__file__).resolve().with_name("calcurse-sync")
sync = subprocess.run([calcurse_sync, "--authcode", code], capture_output=True, text=True)
if sync.returncode != 0:
last_line = (sync.stdout.strip().splitlines() or [""])[-1]
notify("Google Calendar login failed", last_line, "-u", "critical")
return 1
notify("Google Calendar login renewed", "Synced again.")
return 0
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("--prompt", action="store_true", help="ask with a notification before logging in")
if parser.parse_args().prompt:
body = "Click to log in again, then click Allow in the browser."
if notify("Google Calendar login expired", body, "-u", "critical", "-A", "default=Log in") != "default":
return 0
return login()
if __name__ == "__main__":
sys.exit(main())
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
# Sync calcurse with Google Calendar via calcurse-caldav; start the login prompt when the weekly OAuth login expires.
# --now: called from the UI's pre-load hook (skip the UI check, shorter timeout, no daemon restart).
# --authcode CODE: finish a login (from calcurse-relogin, which checks for the UI itself).
set -uo pipefail
data=${XDG_DATA_HOME:-$HOME/.local/share}/calcurse
state=${XDG_STATE_HOME:-$HOME/.local/state}/calcurse-sync
expired_flag=$state/login-expired
now=false
authcode=()
case ${1:-} in
--now) now=true ;;
--authcode) authcode=(--authcode "$2") ;;
esac
# The UI keeps the data in memory, so syncing under it would lose changes; its post-save hook syncs after it exits.
ui_running() {
# shellcheck disable=SC2009 # pgrep can't match "has any terminal"
ps -C calcurse -o tty= | grep -qv '?'
}
if ! $now && ((${#authcode[@]} == 0)) && ui_running; then
echo "calcurse UI is running, skipping"
exit 0
fi
mkdir -p "$state"
# BROWSER=true: an expired login must not open browser tabs on its own.
out=$(BROWSER=true timeout "$($now && echo 15 || echo 60)" calcurse-caldav "${authcode[@]}" 2>&1)
rc=$?
printf '%s\n' "$out"
if ((rc != 0)); then
if grep -q 'Access token is missing or refresh token is expired' <<<"$out"; then
# Prompt via calcurse-relogin, again daily if the prompt was dismissed.
if [[ ! -e $expired_flag || -n $(find "$expired_flag" -mmin +1440) ]]; then
systemctl --user start --no-block calcurse-relogin.service
touch "$expired_flag"
fi
elif grep -q 'Another synchronization instance' <<<"$out"; then
exit 0
fi
exit "$rc"
fi
rm -f "$expired_flag"
# A running daemon never re-reads the data files: restart it so imported appointments get alerts.
if ! $now && ! grep -q '^0 items imported, 0 items removed locally' <<<"$out"; then
pidfile=$data/.daemon.pid
if [[ -s $pidfile ]] && pid=$(<"$pidfile") && kill "$pid" 2>/dev/null; then
timeout 5 tail --pid="$pid" -f /dev/null
# Own scope, so the daemon outlives this oneshot service.
systemd-run --user --scope -q calcurse --daemon
echo "restarted calcurse daemon"
fi
fi
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Notify today's whole-day calcurse events (the daemon only alerts timed appointments).
set -euo pipefail
events=$(calcurse -Q --filter-type event,recur-event --days 1 \
--format-event '%m\n' --format-recur-event '%m\n' | tail -n +2)
[[ -n $events ]] || exit 0
notify-send -a calcurse -i x-office-calendar "Today" "$events"
+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
# Usage: db-dump PROJECT DATABASE week|day
# Dump a MariaDB database to ~/.local/share/PROJECT/dumps with login ~/.config/PROJECT/dump.cnf.
# week: per-ISO-week files, keeping the two newest; day: per-weekday files (seven self-rotating copies).
set -euo pipefail
if (($# != 3)) || [[ $3 != week && $3 != day ]]; then
echo "usage: ${0##*/} PROJECT DATABASE week|day" >&2
exit 2
fi
project=$1 db=$2 mode=$3
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/$project/dump.cnf
dir=${XDG_DATA_HOME:-$HOME/.local/share}/$project/dumps
if [[ $mode == week ]]; then
out=$dir/$db-$(date +%G-W%V).sql.gz
else
out=$dir/$db-$(LC_ALL=C date +%a).sql.gz
fi
keep=2
umask 077
mkdir -p "$dir"
# Write to a temporary file so a failed dump never replaces a good one
tmp=$(mktemp "$dir/.dump.XXXXXX")
trap 'rm -f "$tmp"' EXIT
mariadb-dump --defaults-extra-file="$cnf" --single-transaction --databases "$db" | gzip > "$tmp"
mv "$tmp" "$out"
# Weekly names sort by week, so all but the last $keep are the old ones
if [[ $mode == week ]]; then
dumps=("$dir/$db"-[0-9][0-9][0-9][0-9]-W[0-9][0-9].sql.gz)
if ((${#dumps[@]} > keep)); then
rm -f -- "${dumps[@]:0:${#dumps[@]}-keep}"
fi
fi
+4 -1
View File
@@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
# Runs discover-overlay while Discord's RPC port is up and stops it when Discord exits.
# Run by discover-overlay-wait.service (started from xmonad); output goes to the journal.
port_up() { port_up() {
ss -ltn | grep -qE '127\.0\.0\.1:64[67][0-9]' ss -ltn | grep -qE '127\.0\.0\.1:64[67][0-9]'
} }
@@ -8,7 +11,7 @@ while true; do
sleep 5 sleep 5
port_up || continue # port vanished again, Discord was still restarting port_up || continue # port vanished again, Discord was still restarting
discover-overlay >> /tmp/discover-overlay.log 2>&1 & discover-overlay &
pid=$! pid=$!
while port_up && kill -0 "$pid" 2>/dev/null; do sleep 3; done while port_up && kill -0 "$pid" 2>/dev/null; do sleep 3; done
+1 -1
View File
@@ -7,7 +7,7 @@ if ! xrandr --query | grep -q '^HDMI-1-0 connected'; then
exec mpv "$@" exec mpv "$@"
fi fi
trap ~/.local/bin/screen-layout EXIT trap '"$HOME"/.local/bin/screen-layout --keep-wallpaper' EXIT
trap 'exit 130' INT TERM HUP trap 'exit 130' INT TERM HUP
xrandr --output eDP-1 --off xrandr --output eDP-1 --off
+6 -1
View File
@@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# Sets up the outputs, wallpaper and trayer for whatever monitors are connected. # Sets up the outputs, wallpaper and trayer for whatever monitors are connected.
# Called by xmonad at startup and on monitor (dis)connect, and by `movie` on exit. # Called by xmonad at startup and on monitor (dis)connect, and by `movie` on exit.
# --keep-wallpaper redraws the current wallpaper instead of picking new random ones.
if xrandr --query | grep -q '^HDMI-1-0 connected'; then if xrandr --query | grep -q '^HDMI-1-0 connected'; then
xrandr --output HDMI-1-0 --preferred --primary --output eDP-1 --right-of HDMI-1-0 --preferred xrandr --output HDMI-1-0 --preferred --primary --output eDP-1 --right-of HDMI-1-0 --preferred
@@ -10,12 +11,16 @@ else
tray=0 tray=0
fi fi
if [[ $1 == --keep-wallpaper ]]; then
~/.fehbg --keep
else
~/.fehbg ~/.fehbg
fi
# Replace any running trayer, so there's never more than one # Replace any running trayer, so there's never more than one
pkill -x trayer pkill -x trayer
while pgrep -x trayer > /dev/null; do sleep 0.1; done while pgrep -x trayer > /dev/null; do sleep 0.1; done
trayer -l --edge top --align right --SetDockType true \ trayer -l --edge top --align right --SetDockType true \
--SetPartialStrut true --expand true --widthtype request \ --SetPartialStrut true --expand true --widthtype request \
--tint 0x232634 --height 18 --monitor "$tray" > /dev/null 2>&1 & --transparent true --alpha 0 --tint 0x24283b --height 24 --monitor "$tray" > /dev/null 2>&1 &
disown disown
+51
View File
@@ -0,0 +1,51 @@
#!/bin/sh
# i3lock-color with a background image and the keyboard layout shown.
image=/usr/share/backgrounds/arch_1920x1080.png
err=${XDG_RUNTIME_DIR:-/tmp}/screen-lock.err
log() { printf '%s\n' "$*" | systemd-cat -t screen-lock -p warning; }
# gcr-prompter (ssh key passphrase dialog) grabs the keyboard, so i3lock can't lock: cancel it.
pkill -x gcr-prompter && log "stopped gcr-prompter before locking"
# Hold notifications while locked; dunst shows them on unlock. A signal to this
# script is passed on to i3lock, as the old exec did.
was_paused=$(dunstctl is-paused 2>/dev/null)
dunstctl set-paused true 2>/dev/null
stopped=
trap 'stopped=1; kill "$pid" 2>/dev/null' INT TERM HUP
# i3lock exits 1 if another client holds a grab (dmenu, rofi, a prompt): retry for a minute.
tries=0
while :; do
# -n: stay in the foreground, as xss-lock needs to see when the screen is unlocked.
# --indicator keeps the ring (and the layout text) visible before typing.
# The layout's default spot (dx:dy+30) falls inside the ring: put it below.
i3lock -n -i "$image" -F -c 000000ff \
-e -f --indicator --keylayout 0 \
--layout-pos='ix:iy+r+40' --layout-color=ffffffff \
--layout-size=24 \
--time-color=ffffffff --date-color=ffffffff --date-str='%A, %d %B' \
--ring-color=1793d1ff --line-uses-ring "$@" 2>"$err" &
pid=$!
wait "$pid"
status=$?
# A trapped signal interrupts the first wait; this one waits for i3lock to exit.
if [ -n "$stopped" ]; then
wait "$pid" 2>/dev/null
break
fi
[ "$status" -eq 0 ] && break
tries=$((tries + 1))
log "i3lock failed (exit $status, try $tries): $(cat "$err")"
if [ "$tries" -ge 30 ]; then
log "giving up: screen not locked"
break
fi
sleep 2
[ -n "$stopped" ] && break
done
rm -f "$err"
[ "$was_paused" = true ] || dunstctl set-paused false 2>/dev/null
+21 -28
View File
@@ -1,36 +1,29 @@
#!/usr/bin/env bash #!/bin/bash
# Prints a cached thumbnail for the video in $1 (used by the lf preview), creating it if needed.
# Thumbnails are named by a hash of path, size and mtime, so a changed file gets a new one.
# Hits touch the file; systemd-tmpfiles (~/.config/user-tmpfiles.d/vidthumb.conf) removes unused ones.
if ! [ -f "$1" ]; then [[ -f $1 ]] || exit 1
exit 1
fi
cache="$HOME/.cache/vidthumb" cache="${XDG_CACHE_HOME:-$HOME/.cache}/vidthumb"
index="$cache/index.json" video=$(realpath -- "$1") || exit 1
movie="$(realpath "$1")" stamp=$(stat -c '%s.%Y' -- "$video") || exit 1
key=$(printf '%s\0%s' "$video" "$stamp" | sha256sum)
thumb="$cache/${key%% *}.jpg"
mkdir -p "$cache" if [[ -s $thumb ]]; then
touch -- "$thumb"
if [ -f "$index" ]; then printf '%s\n' "$thumb"
thumbnail="$(jq -r ". \"$movie\"" <"$index")"
if [[ "$thumbnail" != "null" ]]; then
if [[ ! -f "$cache/$thumbnail" ]]; then
exit 1
fi
echo "$cache/$thumbnail"
exit 0 exit 0
fi fi
fi
thumbnail="$(uuidgen).jpg" mkdir -p -- "$cache" || exit 1
# Write to a temp file first, so an interrupted or concurrent run never leaves a broken thumbnail.
if ! ffmpegthumbnailer -i "$movie" -o "$cache/$thumbnail" -s 0 2>/dev/null; then tmp=$(mktemp --suffix=.jpg "$cache/.tmp.XXXXXX") || exit 1
if ffmpegthumbnailer -i "$video" -o "$tmp" -s 0 2> /dev/null && [[ -s $tmp ]]; then
mv -f -- "$tmp" "$thumb"
printf '%s\n' "$thumb"
else
rm -f -- "$tmp"
exit 1 exit 1
fi fi
if [[ ! -f "$index" ]]; then
echo "{\"$movie\": \"$thumbnail\"}" >"$index"
fi
json="$(jq -r --arg "$movie" "$thumbnail" ". + {\"$movie\": \"$thumbnail\"}" <"$index")"
echo "$json" >"$index"
echo "$cache/$thumbnail"
@@ -0,0 +1,4 @@
[D-BUS Service]
Name=org.mpris.MediaPlayer2.playerctld
Exec=/usr/bin/playerctld
SystemdService=playerctld.service