ci: add flake update workflow

Also add contributing, funding and issue templates

parser: add kill option to shell
version: fix errors when not on arch
This commit is contained in:
2 * r + 2 * t
2025-08-04 15:40:17 +10:00
parent 06a7102490
commit d8037819f0
9 changed files with 263 additions and 18 deletions
+20
View File
@@ -0,0 +1,20 @@
# Contributing
There are only a few rules:
- Follow the commit convention as follows:
- The name of the commit should be `module: change`
- Try to be consistent with the module names; you can look at existing commits for the module names I use
- If there is more than one change, the change in the commit name should be the most impactful change
- Put other changes in the description
- Format your code
- Just try to follow the code style of the rest of the code and ensure that there is:
- no trailing whitespace on any lines
- a single space between operators
- No AI slop allowed
- AI readme/docs slop = instant block
- PLEASE TEST YOUR PRS
- I can't believe I have to put this here, but please test your PRs before submitting them
- Your PR must not break anything currently existing, or specify in the description if it does
- PR descriptions should be descriptive
- Please explain what the PR does and how to use it in your PR description
- Also include any breaking changes and/or side effects of the PR
+15
View File
@@ -0,0 +1,15 @@
# These are supported funding model platforms
github: soramanew
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: soramane
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: soramane
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+1
View File
@@ -0,0 +1 @@
blank_issues_enabled: false
+24
View File
@@ -0,0 +1,24 @@
name: Feature request
description: Suggest a new feature
labels: ["enhancement"]
type: "Feature"
title: "[FEATURE] "
body:
- type: markdown
attributes:
value: "NOTE: Please write in **English**."
- type: textarea
attributes:
label: "What would you like to be added?"
description: "Can be a suggestion for an existing feature. You can suggest a widget, minor user interaction changes.. whatever."
- type: textarea
attributes:
label: "How will it help?"
description: "It's helpful to include examples (like in your use case)."
- type: textarea
attributes:
label: "Extra info"
description: "If you want a new widget, a pic of the inspiration (if available) would be awesome."
+56
View File
@@ -0,0 +1,56 @@
name: Issue
description: Report an issue with the dots
labels: ["bug"]
type: "Bug"
title: "[BUG] "
body:
- type: markdown
attributes:
value: "**Welcome to submit a new issue!**\n- It takes only 3 steps, so please be patient :)\n- Tip: If your issue is not a feature request and is not an issue with the dots (e.g. \"how do I use X feature\"), please use [Discussions](https://github.com/caelestia-dots/shell/discussions) instead."
- type: checkboxes
attributes:
label: "Step 1. Before you submit"
description: "Hint: The 2nd and 3rd checkbox is **not** forcely required as you may have failed to do so."
options:
- label: I have read the above instructions and am sure that this is supposed to be posted here.
required: true
- label: I've successfully updated to the latest versions following the [updating guide](https://github.com/caelestia-dots/caelestia?tab=readme-ov-file#updating).
required: false # Not required cuz user may have failed to do so
- label: I've successfully updated the system packages to the latest.
required: false # Not required cuz user may have failed to do so
- label: I've ticked the checkboxes without reading their contents
required: false # Obviously
- type: textarea
attributes:
label: "Step 2. Version info"
description: "Run `caelestia -v` and paste the result below."
value: "<details><summary>Version info</summary>\n\n```\n<!-- Run `caelestia -v` and paste the result here! -->\n```\n\n</details>"
validations:
required: true
- type: markdown
attributes:
value: |
**Tips for the following Step 3**
1. Use `LANG=C LC_ALL=C` to get the output of a command in English, eg. `LANG=C LC_ALL=C date` displays time in English.
2. If it throws errors, **PLEASE**, attach logs and describe in detail if possible.
- The CLI failed to run? Simply post the output below.
- Installation failed? Run installation again for logs.
- You may use more code blocks when needed.
3. In case you are confused, the `<details>`, `<summary>`, `</summary>`, `</details>` are HTML tags for folding the logs (typically very long) inside. Please do not touch them (unless you know what you are doing).
4. If the logs are suuuuuuper long, consider using an online pastebin service instead.
- type: textarea
attributes:
label: "Step 3. Describe the issue"
value: "\n<!-- Firsly describe your issue here! -->\n\n<details><summary>Logs</summary>\n\n```\n<!-- Put your log content here!-->\n```\n\n</details>"
validations:
required: true
- type: checkboxes
attributes:
label: Reminder
options:
- label: I agree that it's usually impossible for others to help me without my logs.
required: true
+113
View File
@@ -0,0 +1,113 @@
name: Update flake inputs
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
jobs:
update-flake:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v31
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-
# created more than this number of seconds ago
purge-created: 0
# or, last accessed more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-last-accessed: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
- name: Update flake inputs
run: nix flake update
- name: Attempt to build flake
run: nix build
- name: Test modules
run: |
result/bin/caelestia -v
result/bin/caelestia -h
result/bin/caelestia toggle -h
result/bin/caelestia scheme -h
result/bin/caelestia scheme list
result/bin/caelestia scheme get
result/bin/caelestia scheme set -n gruvbox -f hard -m dark -v content
result/bin/caelestia scheme set -r
result/bin/caelestia screenshot -h
result/bin/caelestia record -h
result/bin/caelestia clipboard -h
result/bin/caelestia emoji -h
result/bin/caelestia emoji
result/bin/caelestia wallpaper -h
result/bin/caelestia pip -h
- name: Test graphical stuff
env:
XDG_RUNTIME_DIR: /home/runner/runtime
WLR_BACKENDS: headless
WLR_LIBINPUT_NO_DEVICES: 1
WAYLAND_DISPLAY: wayland-1
run: |
mkdir $XDG_RUNTIME_DIR
chown $USER $XDG_RUNTIME_DIR
chmod 0700 $XDG_RUNTIME_DIR
nix profile install 'nixpkgs#sway'
sway &
sleep 3 # Give Sway some time to start
result/bin/caelestia shell -d
sleep 3 # Give the shell some time to start (and die)
# Test CLI graphical modules
result/bin/caelestia screenshot
result/bin/caelestia record
result/bin/caelestia clipboard &
result/bin/caelestia emoji -p &
result/bin/caelestia shell -s
result/bin/caelestia shell drawers list
result/bin/caelestia shell mpris list
result/bin/caelestia shell notifs clear
pgrep .quickshell-wra # Fail job if shell died
result/bin/caelestia shell -k
killall sway # Screw using IPC
- name: Check for changes
id: check
run: echo modified=$(test -n "$(git status --porcelain)" && echo 'true' || echo 'false') >> $GITHUB_OUTPUT
- name: Commit and push changes
if: steps.check.outputs.modified == 'true'
uses: EndBug/add-and-commit@v9
with:
add: flake.lock
default_author: github_actions
message: "[CI] chore: update flake"
+1
View File
@@ -22,6 +22,7 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
shell_parser.add_argument("-d", "--daemon", action="store_true", help="start the shell detached")
shell_parser.add_argument("-s", "--show", action="store_true", help="print all shell IPC commands")
shell_parser.add_argument("-l", "--log", action="store_true", help="print the shell log")
shell_parser.add_argument("-k", "--kill", action="store_true", help="kill the shell")
shell_parser.add_argument("--log-rules", metavar="RULES", help="log rules to apply")
# Create parser for toggle opts
+3
View File
@@ -17,6 +17,9 @@ class Command:
elif self.args.log:
# Print the log
self.print_log()
elif self.args.kill:
# Kill the shell
self.shell("kill")
elif self.args.message:
# Send a message
self.message(*self.args.message)
+30 -18
View File
@@ -1,30 +1,42 @@
import shutil
import subprocess
from caelestia.utils.paths import config_dir
def print_version() -> None:
print("Packages:")
pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"]
versions = subprocess.run(
["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
).stdout
if shutil.which("pacman"):
print("Packages:")
pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"]
versions = subprocess.run(
["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
).stdout
for pkg in pkgs:
if pkg not in versions:
print(f" {pkg} not installed")
print("\n".join(f" {pkg}" for pkg in versions.splitlines()))
for pkg in pkgs:
if pkg not in versions:
print(f" {pkg} not installed")
print("\n".join(f" {pkg}" for pkg in versions.splitlines()))
else:
print("Packages: not on Arch")
caelestia_dir = (config_dir / "hypr").resolve().parent
print("\nCaelestia:")
caelestia_ver = subprocess.check_output(
["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True
)
print(" Last commit:", caelestia_ver.split()[1])
print(" Commit message:", *caelestia_ver.splitlines()[1:])
print()
try:
caelestia_dir = (config_dir / "hypr").resolve().parent
caelestia_ver = subprocess.check_output(
["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True
)
print("Caelestia:")
print(" Last commit:", caelestia_ver.split()[1])
print(" Commit message:", *caelestia_ver.splitlines()[1:])
except subprocess.CalledProcessError:
print("Caelestia: not installed")
print("\nQuickshell:")
print(" ", subprocess.check_output(["qs", "--version"], text=True).strip())
print()
if shutil.which("qs"):
print("Quickshell:")
print(" ", subprocess.check_output(["qs", "--version"], text=True).strip())
else:
print("Quickshell: not in PATH")
local_shell_dir = config_dir / "quickshell/caelestia"
if local_shell_dir.exists():