Skip to content

Commit c2fdac0

Browse files
kajusnaubrianmcgillion
authored andcommitted
desktop: add COSMIC Epoch DE
- Introduce COSMIC as a new compositor option for Ghaf desktop - Add COSMIC nix config - Add Ghaf COSMIC config as a YAML file - Replace some desktop utilities with COSMIC equivalents (file manager, terminal, etc.) - Add vm names as prefixes for apps launched through waypipe - Adjust suspend behavior for ghaf-powercontrol Signed-off-by: Kajus Naujokaitis <kajus.naujokaitis@unikie.com>
1 parent d835d32 commit c2fdac0

File tree

22 files changed

+3903
-46
lines changed

22 files changed

+3903
-46
lines changed

modules/common/services/disks.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ in
4848
# Command to be executed on any device event
4949
# event_hook = "";
5050
};
51+
device_config = [
52+
{
53+
device_file = "/dev/loop*";
54+
ignore = true;
55+
}
56+
];
5157
quickmenu_actions = [
5258
"browse"
5359
"mount"
@@ -72,9 +78,12 @@ in
7278
RestartSec = "1";
7379
ExecStart = "${pkgs.udiskie}/bin/udiskie -c /etc/udiskie.yml";
7480
};
75-
wantedBy = [ "ewwbar.service" ];
76-
after = [ "ewwbar.service" ];
77-
partOf = [ "ewwbar.service" ];
81+
wantedBy = [ "ghaf-session.target" ];
82+
after = [
83+
"ghaf-session.target"
84+
"ewwbar.service"
85+
];
86+
partOf = [ "ghaf-session.target" ];
7887
};
7988
};
8089
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2022-2025 TII (SSRC) and the Ghaf contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# This script generates a YAML file from the Cosmic config file tree in the specified directory
6+
7+
if [ -z "$1" ]; then
8+
echo "Usage: $0 <source_directory>"
9+
exit 1
10+
fi
11+
12+
OUTPUT_FILE="cosmic.config.yaml"
13+
BASE_DIR="$1"
14+
15+
echo "" > "$OUTPUT_FILE"
16+
17+
# Iterate over top-level directories
18+
for dir in "$BASE_DIR"/*/; do
19+
# Get the top-level directory name
20+
dir_name=$(basename "$dir")
21+
echo "$dir_name:" >> "$OUTPUT_FILE"
22+
23+
# Iterate over files in the v1 subdirectory
24+
for file in "$dir"v1/*; do
25+
if [[ -f "$file" ]]; then
26+
key=$(basename "$file")
27+
value=$(cat "$file")
28+
29+
# Format the value correctly
30+
if [[ "$value" == *$'\n'* ]]; then
31+
echo " $key: |" >> "$OUTPUT_FILE"
32+
while IFS= read -r line; do
33+
echo " $line" >> "$OUTPUT_FILE"
34+
done <<< "$value"
35+
else
36+
echo " $key: $value" >> "$OUTPUT_FILE"
37+
fi
38+
fi
39+
done
40+
echo "" >> "$OUTPUT_FILE"
41+
done
42+
43+
echo "Cosmic config YAML generated at $OUTPUT_FILE"
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2022-2025 TII (SSRC) and the Ghaf contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
{
4+
lib,
5+
pkgs,
6+
...
7+
}:
8+
9+
pkgs.stdenv.mkDerivation rec {
10+
pname = "ghaf-cosmic-config";
11+
version = "0.1";
12+
13+
phases = [
14+
"unpackPhase"
15+
"installPhase"
16+
"postInstall"
17+
];
18+
19+
src = ./.;
20+
21+
nativeBuildInputs = [ pkgs.yq-go ];
22+
23+
unpackPhase = ''
24+
mkdir -p cosmic-unpacked
25+
26+
# Process the YAML configuration
27+
for entry in $(yq e 'keys | .[]' $src/cosmic-config.yaml); do
28+
mkdir -p "cosmic-unpacked/$entry/v1"
29+
30+
for subentry in $(yq e ".\"$entry\" | keys | .[]" "$src/cosmic-config.yaml"); do
31+
content=$(yq e --unwrapScalar=false ".\"$entry\".\"$subentry\"" $src/cosmic-config.yaml | grep -vE '^\s*\|')
32+
echo -ne "$content" > "cosmic-unpacked/$entry/v1/$subentry"
33+
done
34+
done
35+
'';
36+
37+
installPhase = ''
38+
mkdir -p $out/share/cosmic
39+
cp -rf cosmic-unpacked/* $out/share/cosmic/
40+
rm -rf cosmic-unpacked
41+
'';
42+
43+
postInstall = ''
44+
substituteInPlace $out/share/cosmic/com.system76.CosmicBackground/v1/all \
45+
--replace-fail "None" "Path(\"${pkgs.ghaf-artwork}/ghaf-desert-sunset.jpg\")"
46+
substituteInPlace $out/share/cosmic/com.system76.CosmicSettings.Shortcuts/v1/system_actions \
47+
--replace-fail 'VolumeLower: ""' 'VolumeLower: "pamixer --unmute --decrease 5 && ${pkgs.pulseaudio}/bin/paplay ${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/audio-volume-change.oga"' \
48+
--replace-fail 'VolumeRaise: ""' 'VolumeRaise: "pamixer --unmute --increase 5 && ${pkgs.pulseaudio}/bin/paplay ${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/audio-volume-change.oga"'
49+
'';
50+
51+
meta = with lib; {
52+
description = "Installs default Ghaf COSMIC configuration";
53+
platforms = [
54+
"aarch64-linux"
55+
"x86_64-linux"
56+
];
57+
};
58+
}

0 commit comments

Comments
 (0)