Megoldva az initrd hiánya bootoláskor ami miatt nem bootolt a rendszer (üres volt a /boot). Memetest kilett szedve.

This commit is contained in:
airmancooma 2025-03-23 20:43:03 +01:00
parent 39694827dd
commit ce769a085c
110 changed files with 2442 additions and 385 deletions

View file

@ -111,10 +111,10 @@ if [ -d "/sys/firmware/efi" ]; then
CPU=$(lscpu | grep "AMD" -c)
if [[ $CPU -gt 0 ]]; then
CPU_UCODE="initrd /amd-ucode.img"
pacman -S amd-ucode --noconfirm
pacman -Rs intel-ucode --noconfirm
elif [[ $(lscpu | grep "Intel" -c) -gt 0 ]]; then
CPU_UCODE="initrd /intel-ucode.img"
pacman -S intel-ucode --noconfirm
pacman -Rs amd-ucode --noconfirm
else
CPU_UCODE=""
fi
@ -278,8 +278,133 @@ else
echo "GRUB telepítése sikeres"
fi
# /boot ellenőrzés és javítás függvény
check_boot_directory() {
echo "A /boot mappa tartalmának ellenőrzése..."
# Ellenőrizzük, hogy a /boot mappa tartalmazza-e a szükséges fájlokat
if [ -z "$(ls -A /boot)" ] || ! ls /boot/vmlinuz-linux-zen &> /dev/null || ! ls /boot/initramfs-linux-zen.img &> /dev/null; then
echo "HIBA: A /boot mappa üres vagy hiányoznak a kernel fájlok!"
# Ellenőrizzük, hogy a fájlok léteznek-e a rendszeren
if [ -f /usr/lib/modules/*/vmlinuz ]; then
echo "Kernel fájl megtalálva, másolás a /boot mappába..."
cp /usr/lib/modules/*/vmlinuz /boot/vmlinuz-linux-zen
else
echo "KRITIKUS HIBA: Kernel fájl nem található a rendszeren!"
echo "Próbáljuk telepíteni a linux-zen csomagot..."
pacman -S linux-zen --noconfirm
fi
# Regeneráljuk a initramfs-t, ha szükséges
echo "Initramfs újragenerálása..."
mkinitcpio -p linux-zen
# Ellenőrizzük, hogy a CPU microcode telepítve van-e
if [ -f /boot/amd-ucode.img ] || [ -f /boot/intel-ucode.img ]; then
echo "CPU microcode már telepítve."
else
# Ha nincs, akkor telepítsük újra a megfelelőt
if [[ $(lscpu | grep "AMD" -c) -gt 0 ]]; then
echo "AMD CPU észlelve, microcode telepítése..."
pacman -S amd-ucode --noconfirm
elif [[ $(lscpu | grep "Intel" -c) -gt 0 ]]; then
echo "Intel CPU észlelve, microcode telepítése..."
pacman -S intel-ucode --noconfirm
fi
fi
# UEFI esetén próbáljuk újratelepíteni a bootloader-t
if [ -d "/sys/firmware/efi" ]; then
echo "UEFI rendszer, systemd-boot újratelepítése..."
bootctl install
# Ellenőrizzük, hogy a kernelt és initramfs-t kimásoltuk-e
if [ ! -f /boot/vmlinuz-linux-zen ]; then
echo "Kernel másolása a /boot mappába..."
find /usr/lib/modules/ -name "vmlinuz*" -exec cp {} /boot/vmlinuz-linux-zen \;
fi
if [ ! -f /boot/initramfs-linux-zen.img ]; then
echo "Initramfs újragenerálása..."
mkinitcpio -p linux-zen
fi
# EFI partíció ellenőrzése
EFI_PART=$(findmnt -n -o SOURCE /boot)
if [ -z "$EFI_PART" ]; then
echo "KRITIKUS HIBA: EFI partíció nem található!"
echo "Próbáljuk megkeresni a megfelelő EFI partíciót..."
# Keressük az EFI partíciót, ha nincs csatolva
EFI_PART=$(lsblk -o NAME,FSTYPE | grep vfat | head -n1 | awk '{print $1}')
if [ -n "$EFI_PART" ]; then
echo "EFI partíció található: $EFI_PART, csatolás a /boot könyvtárhoz..."
mount /dev/$EFI_PART /boot
# Újra próbáljuk a bootloader telepítését
bootctl install
# A fstab bejegyzést is frissítsük, hogy újraindításkor is megmaradjon
if ! grep -q "/boot" /etc/fstab; then
UUID=$(blkid -s UUID -o value /dev/$EFI_PART)
echo "UUID=$UUID /boot vfat defaults 0 2" >> /etc/fstab
fi
fi
fi
fi
# Ellenőrizzük újra, hogy minden szükséges fájl megvan-e
if [ -z "$(ls -A /boot)" ] || ! ls /boot/vmlinuz-linux-zen &> /dev/null || ! ls /boot/initramfs-linux-zen.img &> /dev/null; then
echo "KRITIKUS HIBA: Nem sikerült helyreállítani a /boot mappát!"
return 1
else
echo "A /boot mappa sikeresen helyreállítva."
fi
else
echo "A /boot mappa rendben van."
fi
return 0
}
echo "CPU microcode külön ellenőrzése és telepítése..."
if [[ $(lscpu | grep "AMD" -c) -gt 0 ]]; then
echo "AMD CPU észlelve, microcode telepítése és ellenőrzése..."
pacman -S amd-ucode --noconfirm
# Ellenőrizzük, hogy az ucode fájl létezik-e a /boot mappában
if [ ! -f /boot/amd-ucode.img ]; then
echo "amd-ucode.img másolása a /boot mappába..."
cp /usr/lib/firmware/amd-ucode.img /boot/ 2>/dev/null || echo "FIGYELEM: Nem sikerült az amd-ucode.img másolása"
# Ha nem sikerült másolni, próbáljuk újratelepíteni
if [ ! -f /boot/amd-ucode.img ]; then
echo "amd-ucode újratelepítése és másolása a /boot mappába..."
pacman -S amd-ucode --noconfirm
cp /usr/lib/firmware/amd-ucode.img /boot/ 2>/dev/null || echo "HIBA: Nem sikerült az amd-ucode.img másolása"
fi
fi
elif [[ $(lscpu | grep "Intel" -c) -gt 0 ]]; then
echo "Intel CPU észlelve, microcode telepítése és ellenőrzése..."
pacman -S intel-ucode --noconfirm
# Ellenőrizzük, hogy az ucode fájl létezik-e a /boot mappában
if [ ! -f /boot/intel-ucode.img ]; then
echo "intel-ucode.img másolása a /boot mappába..."
cp /usr/lib/firmware/intel-ucode.img /boot/ 2>/dev/null || echo "FIGYELEM: Nem sikerült az intel-ucode.img másolása"
# Ha nem sikerült másolni, próbáljuk újratelepíteni
if [ ! -f /boot/intel-ucode.img ]; then
echo "intel-ucode újratelepítése és másolása a /boot mappába..."
pacman -S intel-ucode --noconfirm
cp /usr/lib/firmware/intel-ucode.img /boot/ 2>/dev/null || echo "HIBA: Nem sikerült az intel-ucode.img másolása"
fi
fi
fi
# Hívjuk meg az ellenőrző függvényt a bootloader telepítése után
check_boot_directory || echo "FIGYELMEZTETÉS: A /boot helyreállítása sikertelen. A rendszer talán nem tud majd elindulni."
# Calamares eltávolítása
echo "Calamares eltávolítása..."
pacman -Rs calamares --noconfirm
echo "Telepítés befejezve!"
echo "Telepítés befejezve!"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=OCCT
GenericName=Core control
Comment=Control your computer with ease using application profiles
Exec=/opt/OCCT/OCCT
Icon=/usr/share/icons/occt-icon.png
Terminal=false
Type=Application
Categories=System;Settings;Utility;
Keywords=occt

View file

@ -25,10 +25,10 @@ var VitalsMenuButton = GObject.registerClass({
}, class VitalsMenuButton extends PanelMenu.Button {
_init(extensionObject) {
super._init(Clutter.ActorAlign.FILL);
this._extensionObject = extensionObject;
this._settings = extensionObject.getSettings();
this._sensorIcons = {
'temperature' : { 'icon': 'temperature-symbolic.svg' },
'voltage' : { 'icon': 'voltage-symbolic.svg' },
@ -67,8 +67,7 @@ var VitalsMenuButton = GObject.registerClass({
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.CENTER,
reactive: true,
x_expand: true,
pack_start: false
x_expand: true
});
this._drawMenu();
@ -109,7 +108,7 @@ var VitalsMenuButton = GObject.registerClass({
this._initializeMenuGroup(sensor, sensor);
}
for (let i = 1; i <= this._numGpus; i++)
this._initializeMenuGroup('gpu#' + i, 'gpu', (this._numGpus > 1 ? ' ' + i : ''));
@ -128,8 +127,7 @@ var VitalsMenuButton = GObject.registerClass({
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER,
reactive: true,
x_expand: true,
pack_start: false
x_expand: true
});
// custom round refresh button
@ -255,7 +253,7 @@ var VitalsMenuButton = GObject.registerClass({
}
);
}
_createHotItem(key, value) {
let icon = this._defaultIcon(key);
this._hotIcons[key] = icon;
@ -291,7 +289,7 @@ var VitalsMenuButton = GObject.registerClass({
if(sensorName === 'gpu') {
for(let i = 1; i <= this._numGpus; i++)
this._groups[sensorName + '#' + i].visible = this._settings.get_boolean(sensor);
} else
} else
this._groups[sensorName].visible = this._settings.get_boolean(sensor);
}
@ -417,8 +415,7 @@ var VitalsMenuButton = GObject.registerClass({
}
}
}
if(key === "_gpu#1_domain_number_")
console.error('UPDATING: ', key);
// have we added this sensor before?
let item = this._sensorMenuItems[key];
if (item) {
@ -565,9 +562,8 @@ var VitalsMenuButton = GObject.registerClass({
arrow_pos = 0;
break;
}
let centered = this._settings.get_boolean('menu-centered')
if (centered) arrow_pos = 0.5;
// set arrow position when initializing and moving vitals
@ -605,7 +601,7 @@ var VitalsMenuButton = GObject.registerClass({
this._newGpuDetected = true;
return;
}
this._numGpus = parseInt(split[1]);
this._newGpuDetectedCount = 0;
this._newGpuDetected = false;

View file

@ -1 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path fill-opacity=".349" d="M12 1a1 1 0 0 1 .707.293l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 1 1-1.414-1.414L12.586 6H5c-.55 0-1-.45-1-1s.45-1 1-1h7.586l-1.293-1.293A1 1 0 0 1 12 1m0 0"/><path d="M4 15a1 1 0 0 1-.707-.293l-3-3a1 1 0 0 1 0-1.414l3-3a1 1 0 1 1 1.414 1.414L3.414 10H11c.55 0 1 .45 1 1s-.45 1-1 1H3.414l1.293 1.293A1 1 0 0 1 4 15m0 0"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0" fill-opacity="0.34902"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0"/></g></svg>

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M12 1a1 1 0 0 0-.707 1.707L12.586 4H5c-.55 0-1 .45-1 1s.45 1 1 1h7.586l-1.293 1.293a1 1 0 1 0 1.414 1.414l3-3a1 1 0 0 0 0-1.414l-3-3A1 1 0 0 0 12 1M4 7a1 1 0 0 0-.707.293l-3 3a1 1 0 0 0 0 1.414l3 3a1 1 0 1 0 1.414-1.414L3.414 12H11c.55 0 1-.45 1-1s-.45-1-1-1H3.414l1.293-1.293A1 1 0 0 0 4 7m0 0"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0"/></g></svg>

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path d="M12 1a1 1 0 0 1 .707.293l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 1 1-1.414-1.414L12.586 6H5c-.55 0-1-.45-1-1s.45-1 1-1h7.586l-1.293-1.293A1 1 0 0 1 12 1m0 0"/><path fill-opacity=".349" d="M4 15a1 1 0 0 1-.707-.293l-3-3a1 1 0 0 1 0-1.414l3-3a1 1 0 1 1 1.414 1.414L3.414 10H11c.55 0 1 .45 1 1s-.45 1-1 1H3.414l1.293 1.293A1 1 0 0 1 4 15m0 0"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0" fill-opacity="0.34902"/></g></svg>

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -10,9 +10,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/corecoding/Vitals",
"uuid": "Vitals@CoreCoding.com",
"version": 69
"version": 71
}

View file

@ -898,7 +898,7 @@
<property name="halign">start</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="label" translatable="yes">Monitor gpu (beta; NVIDIA only)</property>
<property name="label" translatable="yes">Monitor GPU (beta)</property>
</object>
</child>
<child>
@ -1224,6 +1224,8 @@
<item translatable="yes">BAT2</item>
<item translatable="yes">BATT</item>
<item translatable="yes">CMB0</item>
<item translatable="yes">CMB1</item>
<item translatable="yes">CMB2</item>
<item translatable="yes">macsmc-battery</item>
</items>
</object>

View file

@ -54,6 +54,8 @@ export const Sensors = GObject.registerClass({
this._addSettingChangedSignal('update-time', this._reconfigureNvidiaSmiProcess.bind(this));
//this._addSettingChangedSignal('include-static-gpu-info', this._reconfigureNvidiaSmiProcess.bind(this));
this._gpu_drm_vendors = null;
this._gpu_drm_indices = null;
this._nvidia_smi_process = null;
this._nvidia_labels = [];
this._bad_split_count = 0;
@ -74,7 +76,7 @@ export const Sensors = GObject.registerClass({
_refreshIPAddress(callback) {
// check IP address
new FileModule.File('https://corecoding.com/vitals.php').read().then(contents => {
new FileModule.File('https://ipv4.corecoding.com').read().then(contents => {
let obj = JSON.parse(contents);
this._returnValue(callback, 'Public IP', obj['IPv4'], 'network', 'string');
}).catch(err => { });
@ -375,20 +377,20 @@ export const Sensors = GObject.registerClass({
_queryBattery(callback) {
let battery_slot = this._settings.get_int('battery-slot');
// addresses issue #161
let battery_key = 'BAT'; // BAT0, BAT1 and BAT2
if (battery_slot == 3) {
battery_slot = 'T';
} else if (battery_slot == 4) {
battery_key = 'CMB'; // CMB0
battery_slot = 0;
} else if (battery_slot == 5) {
battery_key = 'macsmc-battery'; // supports Asahi linux
battery_slot = '';
}
// create a mapping of indices to battery paths (from prefs.ui)
const BATTERY_PATHS = {
0: 'BAT0',
1: 'BAT1',
2: 'BAT2',
3: 'BATT',
4: 'CMB0',
5: 'CMB1',
6: 'CMB2',
7: 'macsmc-battery'
};
// uevent has all necessary fields, no need to read individual files
let battery_path = '/sys/class/power_supply/' + battery_key + battery_slot + '/uevent';
let battery_path = '/sys/class/power_supply/' + BATTERY_PATHS[battery_slot] + '/uevent';
new FileModule.File(battery_path).read("\n").then(lines => {
let output = {};
for (let line of lines) {
@ -496,10 +498,16 @@ export const Sensors = GObject.registerClass({
_queryGpu(callback) {
if (!this._nvidia_smi_process) {
this._disableGpuLabels(callback);
return;
// no nvidia-smi, so we use sysfs DRM if any cards was discovered
if (!this._gpu_drm_indices){
this._disableGpuLabels(callback);
return;
} else {
this._readGpuDrm(callback);
return;
}
}
this._nvidia_smi_process.read('\n').then(lines => {
/// for debugging multi-gpu on systems with only one gpu
/// duplicates the first gpu's data 3 times, for 4 total gpus
@ -510,10 +518,9 @@ export const Sensors = GObject.registerClass({
for (let i = 0; i < lines.length; i++) {
this._parseNvidiaSmiLine(callback, lines[i], i + 1, lines.length > 1);
}
// if we've already updated the static info during the last parse, then stop doing so.
// this is so the _parseNvidiaSmiLine function won't return static info anymore
// if we've already updated the static info during the last parse, then stop doing so.
// this is so the _parseNvidiaSmiLine function won't return static info anymore
// and the nvidia-smi commmand won't be queried for static info either
if(!this._nvidia_static_returned) {
this._nvidia_static_returned = true;
@ -544,13 +551,13 @@ export const Sensors = GObject.registerClass({
this._bad_split_count = 0;
let [
label,
label,
fan_speed_pct,
temp_gpu, temp_mem,
temp_gpu, temp_mem,
mem_total, mem_used, mem_reserved, mem_free,
util_gpu, util_mem, util_encoder, util_decoder,
clock_gpu, clock_mem, clock_encode_decode,
power, power_avg,
power, power_avg,
link_gen_current, link_width_current
] = csv_split;
@ -572,12 +579,9 @@ export const Sensors = GObject.registerClass({
}
}
const typeName = 'gpu#' + gpuNum;
const globalLabel = 'GPU' + (multiGpu ? ' ' + gpuNum : '');
const memTempValid = !isNaN(parseInt(temp_mem));
this._returnGpuValue(callback, 'Graphics', parseInt(util_gpu) * 0.01, typeName + '-group', 'percent');
@ -628,6 +632,50 @@ export const Sensors = GObject.registerClass({
this._returnStaticGpuValue(callback, 'Sub Device ID', staticInfo['sub_device_id'], typeName, 'string');
}
_readGpuDrm(callback){
const multiGpu = this._gpu_drm_indices.length > 1;
const unit = this._settings.get_int('memory-measurement') ? 1000 : 1024;
for (let z = 0; z < this._gpu_drm_indices.length; z++ ) {
let i = this._gpu_drm_indices[z];
const typeName = 'gpu#' + i;
const vendor = this._gpu_drm_vendors[z];
// AMD
if(vendor === "0x1002") {
// read GPU usage and create group lebel for card
new FileModule.File('/sys/class/drm/card'+i+'/device/gpu_busy_percent').read().then(value => {
// create group
this._returnGpuValue(callback, 'Graphics', parseInt(value) * 0.01, typeName + '-group', 'percent');
this._returnGpuValue(callback, 'Vendor', "AMD", typeName, 'string');
this._returnGpuValue(callback, 'Usage', parseInt(value) * 0.01, typeName, 'percent');
}).catch(err => {
// nothing to do, keep old value displayed
});
new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_used').read().then(value => {
this._returnGpuValue(callback, 'Memory Used', parseInt(value) / unit, typeName, 'memory');
}).catch(err => {
// nothing to do, keep old value displayed
});
new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_total').read().then(value => {
this._returnGpuValue(callback, 'Memory Total', parseInt(value) / unit, typeName, 'memory');
}).catch(err => {
// nothing to do, keep old value displayed
});
} else {
// for other vendors only show basic card info
let vendorName = null;
switch (vendor){
case '0x10DE': vendorName = 'NVIDIA'; break; // should be never used as nvidia-smi should be preferred
case '0x13B5': vendorName = 'ARM'; break;
case '0x5143': vendorName = 'Qualcomm'; break;
case '0x8086': vendorName = 'Intel'; break;
default: vendorName = "Unknown " + vendor;
}
this._returnGpuValue(callback, 'Graphics', vendorName, typeName + '-group', 'string');
}
}
}
_disableGpuLabels(callback) {
for (let labelObj of this._nvidia_labels)
this._returnValue(callback, labelObj.label, 'disabled', labelObj.type, labelObj.format);
@ -635,7 +683,7 @@ export const Sensors = GObject.registerClass({
_returnStaticGpuValue(callback, label, value, type, format) {
//if we've already tried to return existing static info before or if the option isn't enabled, then do nothing.
if (this._nvidia_static_returned || !this._settings.get_boolean('include-static-gpu-info'))
if (this._nvidia_static_returned || !this._settings.get_boolean('include-static-gpu-info'))
return;
//we don't need to disable static info labels, so just use ordinary returnValue function
@ -645,7 +693,7 @@ export const Sensors = GObject.registerClass({
_returnGpuValue(callback, label, value, type, format, display = true) {
if(!display) return;
if(value === 'N/A' || value === '[N/A]' || isNaN(value)) return;
if(format !== "string" && (value === 'N/A' || value === '[N/A]' || isNaN(value))) return;
let nvidiaLabel = {'label': label, 'type': type, 'format': format};
if (!this._nvidia_labels.includes(nvidiaLabel))
@ -748,6 +796,27 @@ export const Sensors = GObject.registerClass({
// Launch nvidia-smi subprocess if nvidia querying is enabled
this._reconfigureNvidiaSmiProcess();
this._discoverGpuDrm();
}
_discoverGpuDrm() {
// use DRM only if nvidia-smi is not used
if (this._settings.get_boolean('show-gpu') && this._nvidia_smi_process == null) {
// try to discover up to 10 cards starting from index 0
for(let i = 0; i < 10 ; i++){
new FileModule.File('/sys/class/drm/card'+i+'/device/vendor').read().then(value => {
if(!this._gpu_drm_indices){
this._gpu_drm_indices = [];
this._gpu_drm_vendors = [];
}
this._gpu_drm_indices.push(i);
this._gpu_drm_vendors.push(value);
}).catch(err => { });
}
} else {
this._gpu_drm_vendors = null;
this._gpu_drm_indices = null;
}
}
// The nvidia-smi subprocess will keep running and print new sensor data to stdout every
@ -772,7 +841,7 @@ export const Sensors = GObject.registerClass({
_reconfigureNvidiaSmiProcess() {
if (this._settings.get_boolean('show-gpu')) {
this._terminateNvidiaSmiProcess();
try {
let update_time = this._settings.get_int('update-time');
let query_interval = Math.max(update_time, 1);
@ -786,13 +855,13 @@ export const Sensors = GObject.registerClass({
'clocks.gr,clocks.mem,clocks.video,' +
'power.draw.instant,power.draw.average,' +
'pcie.link.gen.gpucurrent,pcie.link.width.current,' +
(!this._nvidia_static_returned && this._settings.get_boolean('include-static-gpu-info') ?
(!this._nvidia_static_returned && this._settings.get_boolean('include-static-gpu-info') ?
'temperature.gpu.tlimit,' +
'power.limit,' +
'pcie.link.gen.max,pcie.link.width.max,' +
'addressing_mode,'+
'driver_version,vbios_version,serial,' +
'pci.domain,pci.bus,pci.device,pci.device_id,pci.sub_device_id,'
'pci.domain,pci.bus,pci.device,pci.device_id,pci.sub_device_id,'
: ''),
'--format=csv,noheader,nounits',
'-l', query_interval.toString()

View file

@ -7,9 +7,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/ubuntu/gnome-shell-extension-appindicator",
"uuid": "appindicatorsupport@rgcjonas.gmail.com",
"version": 59
}
}

View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -148,6 +148,14 @@ export const OverviewBlur = class OverviewBlur {
}
// add the container widget for the overview only to the overview group
Main.layoutManager.overviewGroup.insert_child_at_index(this.overview_background_group, 0);
// make sure it stays below
this.connections.connect(Main.layoutManager.overviewGroup, "child-added", (_, child) => {
if (child !== this.overview_background_group) {
if (this.overview_background_group.get_parent())
Main.layoutManager.overviewGroup.remove_child(this.overview_background_group);
Main.layoutManager.overviewGroup.insert_child_at_index(this.overview_background_group, 0);
}
});
}
/// Updates the classname to style overview components with semi-transparent
@ -166,6 +174,11 @@ export const OverviewBlur = class OverviewBlur {
remove_background_actors() {
this.overview_background_group.remove_all_children();
this.animation_background_group.remove_all_children();
this.connections.disconnect_all_for(Main.layoutManager.overviewGroup);
if (this.overview_background_group.get_parent())
Main.layoutManager.overviewGroup.remove_child(this.overview_background_group);
this.overview_background_managers.forEach(background_manager => {
background_manager._bms_pipeline.destroy();
background_manager.destroy();

View file

@ -54,9 +54,6 @@ export const PanelBlur = class PanelBlur {
// the blur when a window is near a panel
this.connect_to_windows_and_overview();
// update the classname if the panel to have or have not light text
this.update_light_text_classname();
// connect to workareas change
this.connections.connect(global.display, 'workareas-changed',
_ => this.reset()
@ -468,10 +465,14 @@ export const PanelBlur = class PanelBlur {
this.settings.panel.OVERRIDE_BACKGROUND
&&
should_override
)
) {
panel.add_style_class_name(
PANEL_STYLES[this.settings.panel.STYLE_PANEL]
);
}
// update the classname if the panel to have or have not light text
this.update_light_text_classname(!should_override);
}
update_pipeline() {

View file

@ -148,6 +148,11 @@ export function get_supported_effects(_ = () => "") {
name: _("Use base pixel"),
description: _("Whether or not the original pixel is counted for the blur. If it is, the image will be more legible."),
type: "boolean"
},
prefer_closer_pixels: {
name: _("Prefer closer pixels"),
description: _("Whether or not the pixels that are closer to the original pixel will have more weight."),
type: "boolean"
}
}
},

View file

@ -5,6 +5,7 @@ uniform float brightness;
uniform float width;
uniform float height;
uniform bool use_base_pixel;
uniform bool prefer_closer_pixels;
float srand(vec2 a) {
return sin(dot(a, vec2(1233.224, 1743.335)));
@ -19,24 +20,31 @@ void main() {
vec2 uv = cogl_tex_coord0_in.st;
vec2 p = 16 * radius / vec2(width, height);
float r = srand(uv);
vec2 rv;
vec2 dir;
vec2 new_uv;
int strength;
int count = 0;
vec4 c = vec4(0.);
for (int i = 0; i < iterations; i++) {
rv.x = rand(r);
rv.y = rand(r);
vec2 new_uv = uv + rv * p;
rv.y = rand(r) * 3.141592;
dir = vec2(cos(rv.y), sin(rv.y));
new_uv = uv + rv.x * dir * p;
if (new_uv.x > 2. / width && new_uv.y > 2. / height && new_uv.x < 1. - 3. / width && new_uv.y < 1. - 3. / height) {
c += texture2D(tex, new_uv);
count += 1;
strength = prefer_closer_pixels ? (iterations - i)^2 : 1;
c += strength * texture2D(tex, new_uv);
count += strength;
}
}
if (count == 0 || use_base_pixel) {
c += texture2D(tex, uv);
count += 1;
strength = prefer_closer_pixels ? (iterations + 1)^2 : 1;
c += strength * texture2D(tex, uv);
count += strength;
}
c.xyz *= brightness;

View file

@ -8,7 +8,8 @@ const Clutter = await utils.import_in_shell_only('gi://Clutter');
const SHADER_FILENAME = 'monte_carlo_blur.glsl';
const DEFAULT_PARAMS = {
radius: 2., iterations: 5, brightness: .6,
width: 0, height: 0, use_base_pixel: true
width: 0, height: 0, use_base_pixel: true,
prefer_closer_pixels: true,
};
@ -64,6 +65,13 @@ export const MonteCarloBlurEffect = utils.IS_IN_PREFERENCES ?
GObject.ParamFlags.READWRITE,
true,
),
'prefer_closer_pixels': GObject.ParamSpec.boolean(
`prefer_closer_pixels`,
`Prefer closer pixels`,
`Prefer closer pixels`,
GObject.ParamFlags.READWRITE,
true,
),
}
}, class MonteCarloBlurEffect extends Clutter.ShaderEffect {
constructor(params) {
@ -166,6 +174,18 @@ export const MonteCarloBlurEffect = utils.IS_IN_PREFERENCES ?
}
}
get prefer_closer_pixels() {
return this._prefer_closer_pixels;
}
set prefer_closer_pixels(value) {
if (this._prefer_closer_pixels !== value) {
this._prefer_closer_pixels = value;
this.set_uniform_value('prefer_closer_pixels', this._prefer_closer_pixels ? 1 : 0);
}
}
vfunc_set_actor(actor) {
if (this._actor_connection_size_id) {
let old_actor = this.get_actor();

View file

@ -1,6 +1,7 @@
import Meta from 'gi://Meta';
import Clutter from 'gi://Clutter';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';
@ -253,16 +254,28 @@ export default class BlurMyShell extends Extension {
/// Add the Clutter debug flag.
_disable_clipped_redraws() {
Meta.add_clutter_debug_flags(
null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null
);
let gnome_shell_major_version = parseInt(Config.PACKAGE_VERSION.split('.')[0]);
if (gnome_shell_major_version >= 48)
Clutter.add_debug_flags(
null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null
);
else
Meta.add_clutter_debug_flags(
null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null
);
}
/// Remove the Clutter debug flag.
_reenable_clipped_redraws() {
Meta.remove_clutter_debug_flags(
null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null
);
let gnome_shell_major_version = parseInt(Config.PACKAGE_VERSION.split('.')[0]);
if (gnome_shell_major_version >= 48)
Clutter.remove_debug_flags(
null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null
);
else
Meta.remove_clutter_debug_flags(
null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null
);
}
/// Enables every component from the user session needed, should be called when the shell is

View file

@ -17,9 +17,10 @@
"settings-schema": "org.gnome.shell.extensions.blur-my-shell",
"shell-version": [
"46",
"47"
"47",
"48"
],
"url": "https://github.com/aunetx/blur-my-shell",
"uuid": "blur-my-shell@aunetx",
"version": 67
"version": 68
}

View file

@ -23,6 +23,7 @@ import {WindowPicker} from './src/WindowPicker.js';
import * as utils from './src/utils.js';
import Apparition from './src/effects/Apparition.js';
import AuraGlow from './src/effects/AuraGlow.js';
import BrokenGlass from './src/effects/BrokenGlass.js';
import Doom from './src/effects/Doom.js';
import EnergizeA from './src/effects/EnergizeA.js';
@ -34,18 +35,20 @@ import Glitch from './src/effects/Glitch.js';
import Hexagon from './src/effects/Hexagon.js';
import Incinerate from './src/effects/Incinerate.js';
import Matrix from './src/effects/Matrix.js';
import Mushroom from './src/effects/Mushroom.js';
import PaintBrush from './src/effects/PaintBrush.js';
import Pixelate from './src/effects/Pixelate.js';
import PixelWheel from './src/effects/PixelWheel.js';
import PixelWipe from './src/effects/PixelWipe.js';
import Portal from './src/effects/Portal.js';
import RGBWarp from './src/effects/RGBWarp.js';
import SnapOfDisintegration from './src/effects/SnapOfDisintegration.js';
import TeamRocket from './src/effects/TeamRocket.js';
import TRexAttack from './src/effects/TRexAttack.js';
import TVEffect from './src/effects/TVEffect.js';
import TVGlitch from './src/effects/TVGlitch.js';
import Wisps from './src/effects/Wisps.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {Workspace} from 'resource:///org/gnome/shell/ui/workspace.js';
import {WindowPreview} from 'resource:///org/gnome/shell/ui/windowPreview.js';
@ -71,14 +74,13 @@ export default class BurnMyWindows extends Extension {
// New effects must be registered here and in prefs.js.
this._ALL_EFFECTS = [
new Apparition(), new BrokenGlass(), new Doom(),
new EnergizeA(), new EnergizeB(), new Fire(),
new Focus(), new Glide(), new Glitch(),
new Hexagon(), new Incinerate(), new Matrix(),
new PaintBrush(), new Pixelate(), new PixelWheel(),
new PixelWipe(), new Portal(), new SnapOfDisintegration(),
new TRexAttack(), new TVEffect(), new TVGlitch(),
new Wisps(),
new Apparition(), new AuraGlow(), new BrokenGlass(), new Doom(),
new EnergizeA(), new EnergizeB(), new Fire(), new Focus(),
new Glide(), new Glitch(), new Hexagon(), new Incinerate(),
new Matrix(), new PaintBrush(), new Pixelate(), new PixelWheel(),
new PixelWipe(), new Portal(), new RGBWarp(), new SnapOfDisintegration(),
new TeamRocket(), new TRexAttack(), new TVEffect(), new TVGlitch(),
new Wisps(), new Mushroom()
];
// Load all of our resources.

View file

@ -12,9 +12,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/Schneegans/Burn-My-Windows",
"uuid": "burn-my-windows@schneegans.github.com",
"version": 44
"version": 46
}

View file

@ -24,6 +24,7 @@ import * as utils from './src/utils.js';
import {ProfileManager} from './src/ProfileManager.js';
import Apparition from './src/effects/Apparition.js';
import AuraGlow from './src/effects/AuraGlow.js';
import BrokenGlass from './src/effects/BrokenGlass.js';
import Doom from './src/effects/Doom.js';
import EnergizeA from './src/effects/EnergizeA.js';
@ -35,12 +36,15 @@ import Glitch from './src/effects/Glitch.js';
import Hexagon from './src/effects/Hexagon.js';
import Incinerate from './src/effects/Incinerate.js';
import Matrix from './src/effects/Matrix.js';
import Mushroom from './src/effects/Mushroom.js';
import PaintBrush from './src/effects/PaintBrush.js';
import Pixelate from './src/effects/Pixelate.js';
import PixelWheel from './src/effects/PixelWheel.js';
import PixelWipe from './src/effects/PixelWipe.js';
import Portal from './src/effects/Portal.js';
import RGBWarp from './src/effects/RGBWarp.js';
import SnapOfDisintegration from './src/effects/SnapOfDisintegration.js';
import TeamRocket from './src/effects/TeamRocket.js';
import TRexAttack from './src/effects/TRexAttack.js';
import TVEffect from './src/effects/TVEffect.js';
import TVGlitch from './src/effects/TVGlitch.js';
@ -71,10 +75,15 @@ export default class BurnMyWindowsPreferences extends ExtensionPreferences {
// New effects must be registered here and in extension.js.
this._ALL_EFFECTS = [
Apparition, BrokenGlass, Doom, EnergizeA, EnergizeB, Fire,
Focus, Glide, Glitch, Hexagon, Incinerate, Matrix,
PaintBrush, Pixelate, PixelWheel, PixelWipe, Portal, SnapOfDisintegration,
TRexAttack, TVEffect, TVGlitch, Wisps,
Apparition, AuraGlow, BrokenGlass,
Doom, EnergizeA, EnergizeB,
Fire, Focus, Glide,
Glitch, Hexagon, Incinerate,
Matrix, Mushroom, PaintBrush,
Pixelate, PixelWheel, PixelWipe,
Portal, RGBWarp, SnapOfDisintegration,
TeamRocket, TRexAttack, TVEffect,
TVGlitch, Wisps,
];
@ -183,22 +192,33 @@ export default class BurnMyWindowsPreferences extends ExtensionPreferences {
this._searchEntry.connect('search-changed', () => {
const query = this._searchEntry.get_text().toLowerCase();
this._effectRows.forEach(er => {
// If only one effect is left, we will expand it automatically.
let lastRow = null;
let numRows = 0;
this._effectRows.forEach(row => {
row.set_expanded(false);
if (query === '') {
er.show(); // Show all effects if query is empty
row.show(); // Show all effects if query is empty
} else {
// Show or hide each effect based on query match
const showEffect = er.name.toLowerCase().includes(query);
showEffect ? er.show() : er.hide();
const showEffect = row.name.toLowerCase().includes(query);
// TODO
// maybe add a fuzzy search later
/*
const showEffect = utils.fuzzyMatch(er.name.toLowerCase(),
query.toLowerCase()); showEffect ? er.show() : er.hide();
*/
if (showEffect) {
row.show();
lastRow = row;
numRows++;
} else {
row.hide();
}
}
});
// If only one effect is left, we expand it automatically.
if (numRows === 1) {
lastRow.set_expanded(true);
}
});
// Then add a preferences group for the effect expander rows.

View file

@ -242,6 +242,12 @@ SPDX-License-Identifier: CC0-1.0
<description>The size of the fire.</description>
</key>
<key name="fire-random-color" type="b">
<default>false</default>
<summary>use a random color for the fire</summary>
<description>use a random color of the fire</description>
</key>
<key name="fire-3d-noise" type="b">
<default>false</default>
<summary>Fire 3D Noise</summary>
@ -823,7 +829,7 @@ SPDX-License-Identifier: CC0-1.0
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Simple Fade Effect Options -->
<!-- Focus Effect Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<key name="focus-enable-effect" type="b">
@ -850,6 +856,264 @@ SPDX-License-Identifier: CC0-1.0
<description>The Quality of the Blur (Setting this too high may increase GPU load and affect performance)</description>
</key>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Mushroom Effect Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<key name="mushroom-enable-effect" type="b">
<default>false</default>
<summary>mushroom Enable Effect</summary>
<description>Use the mushroom effect.</description>
</key>
<key name="mushroom-animation-time" type="i">
<default>1500</default>
<summary>mushroom Animation Time</summary>
<description>The time the mushroom effect takes.</description>
</key>
<!-- <key name="mushroom-8bit-enable" type="b">
<default>true</default>
<summary>mushroom 8Bit Animation</summary>
<description>use the old style.</description>
</key> -->
<key name="mushroom-scale-style" type="d">
<default>1.0</default>
<summary>8Bit or Smooth Scaling</summary>
<description>How the window scales</description>
</key>
<key name="mushroom-spark-count" type="i">
<default>4</default>
<summary>The Number of Sparks</summary>
<description>The Number of Sparks</description>
</key>
<key name="mushroom-spark-color" type="s">
<default>"rgba(255, 255, 255, 1.0)"</default>
<summary>The Sparks Color</summary>
<description>The Sparks Color</description>
</key>
<key name="mushroom-spark-rotation" type="d">
<default>0.3</default>
<summary>The Number of Rotations the Sparks do</summary>
<description>The Number of Rotations the Sparks do</description>
</key>
<key name="mushroom-rays-color" type="s">
<default>"rgba(255, 255, 255, 1.0)"</default>
<summary>The Rays Color</summary>
<description>The Rays Color</description>
</key>
<key name="mushroom-ring-count" type="i">
<default>3</default>
<summary>Number of Rings</summary>
<description>Number of Rings</description>
</key>
<key name="mushroom-ring-rotation" type="d">
<default>1.33</default>
<summary>The Number of Rotations/Cycles the Stars do</summary>
<description>The Number of Rotations/Cycles the Stars do</description>
</key>
<key name="mushroom-star-count" type="i">
<default>5</default>
<summary>The Number of Stars in each Ring</summary>
<description>The Number of Stars in each Ring</description>
</key>
<key name="mushroom-star-color-0" type="s">
<default>"rgba(233, 249, 1, 1.0)"</default>
<summary>Star Color 1</summary>
<description>The Nth color of the Star gradient.</description>
</key>
<key name="mushroom-star-color-1" type="s">
<default>"rgba(233, 249, 1, 1.0)"</default>
<summary>Star Color 1</summary>
<description>The Nth color of the Star gradient.</description>
</key>
<key name="mushroom-star-color-2" type="s">
<default>"rgba(91, 255, 1, 1.0)"</default>
<summary>Star Color 1</summary>
<description>The Nth color of the Star gradient.</description>
</key>
<key name="mushroom-star-color-3" type="s">
<default>"rgba(91, 255, 1, 1.0)"</default>
<summary>Star Color 1</summary>
<description>The Nth color of the Star gradient.</description>
</key>
<key name="mushroom-star-color-4" type="s">
<default>"rgba(0, 240, 236, 1.0)"</default>
<summary>Star Color 1</summary>
<description>The Nth color of the Star gradient.</description>
</key>
<key name="mushroom-star-color-5" type="s">
<default>"rgba(0, 240, 236, 1.0)"</default>
<summary>Star Color 1</summary>
<description>The Nth color of the Star gradient.</description>
</key>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Aura Glow Effect Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<key name="aura-glow-enable-effect" type="b">
<default>false</default>
<summary>Aura Glow Enable Effect</summary>
<description>Use the Aura Glow effect.</description>
</key>
<key name="aura-glow-animation-time" type="i">
<default>750</default>
<summary>Aura Glow Animation Time</summary>
<description>The time the Aura Glow effect takes.</description>
</key>
<key name="aura-glow-random-color" type="b">
<default>false</default>
<summary>Aura Glow Random Color Offset</summary>
<description>Ramdomize the color offset</description>
</key>
<key name="aura-glow-start-hue" type="d">
<default>0.0</default>
<summary>Aura Glow Color Offset</summary>
<description>Changes the inital color of the glow</description>
</key>
<key name="aura-glow-speed" type="d">
<default>2.5</default>
<summary>Aura Glow Color Speed</summary>
<description>The Speed at which the color changes</description>
</key>
<key name="aura-glow-saturation" type="d">
<default>0.75</default>
<summary>Aura Glow Color Saturation</summary>
<description>Amount of color in the effect</description>
</key>
<key name="aura-glow-edge-size" type="d">
<default>0.75</default>
<summary>Aura Glow Size of the Color Edge</summary>
<description>Size of the Color Edge</description>
</key>
<key name="aura-glow-edge-hardness" type="d">
<default>0.25</default>
<summary>Aura Glow Edge Hardness</summary>
<description>The Hardness of the Edge</description>
</key>
<key name="aura-glow-blur" type="d">
<default>15.0</default>
<summary>Aura Glow Blur</summary>
<description>Changes the Blue Amount</description>
</key>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- RGBWarp Effect Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<key name="rgbwarp-enable-effect" type="b">
<default>false</default>
<summary>RGBWarp Enable Effect</summary>
<description>Use the RGBWarp.</description>
</key>
<key name="rgbwarp-animation-time" type="i">
<default>750</default>
<summary>RGBWarp Animation Time</summary>
<description>The time the RGBWarp effect takes.</description>
</key>
<key name="rgbwarp-brightness" type="d">
<default>1.0</default>
<summary>RGBWarp Brightness</summary>
<description>brightness of the effect.</description>
</key>
<key name="rgbwarp-speed-r" type="d">
<default>1.0</default>
<summary>RGBWarp Red Speed</summary>
<description>Red speed of the effect.</description>
</key>
<key name="rgbwarp-speed-g" type="d">
<default>0.90</default>
<summary>RGBWarp Green Speed</summary>
<description>Green speed of the effect.</description>
</key>
<key name="rgbwarp-speed-b" type="d">
<default>0.80</default>
<summary>RGBWarp Blue Speed</summary>
<description>Blue speed of the effect.</description>
</key>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Team Rocket Effect Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<key name="team-rocket-enable-effect" type="b">
<default>false</default>
<summary>Team Rocket Enable Effect</summary>
<description>Use the Team Rocket effect.</description>
</key>
<key name="team-rocket-animation-time" type="i">
<default>1500</default>
<summary>Team Rocket Animation Time</summary>
<description>The time the Team Rocket effect takes.</description>
</key>
<key name="team-rocket-animation-split" type="d">
<default>0.5</default>
<summary>Window vs Sparkle split</summary>
<description>Window vs Sparkle split</description>
</key>
<key name="team-rocket-horizontal-sparkle-position" type="d">
<default>0.0</default>
<summary>Team Rocket X</summary>
<description>X position</description>
</key>
<key name="team-rocket-vertical-sparkle-position" type="d">
<default>0.5</default>
<summary>Team Rocket Y</summary>
<description>Y position</description>
</key>
<key name="team-rocket-window-rotation" type="b">
<default>true</default>
<summary>Rotate the Window</summary>
<description>Rotate the Window</description>
</key>
<key name="team-rocket-sparkle-rot" type="d">
<default>0.33</default>
<summary>Sparkle Rotation</summary>
<description>Sparkle Rotation</description>
</key>
<key name="team-rocket-sparkle-size" type="d">
<default>0.75</default>
<summary>Sparkle Size</summary>
<description>Sparkle Size</description>
</key>
</schema>
</schemalist>
</schemalist>

View file

@ -16,6 +16,7 @@
import Gio from 'gi://Gio';
import Shell from 'gi://Shell';
import Cogl from 'gi://Cogl';
import GObject from 'gi://GObject';
import Clutter from 'gi://Clutter';
import Meta from 'gi://Meta';
@ -47,166 +48,178 @@ import * as utils from './utils.js';
// used to clean up any resources.
//////////////////////////////////////////////////////////////////////////////////////////
export var Shader = GObject.registerClass(
{
Signals: {
'begin-animation': {
param_types: [
Gio.Settings.$gtype, GObject.TYPE_BOOLEAN, GObject.TYPE_BOOLEAN,
Clutter.Actor.$gtype
]
},
'update-animation': {param_types: [GObject.TYPE_DOUBLE]},
'end-animation': {}
}
},
class Shader extends Shell.GLSLEffect { // --------------------------------------------
// The constructor automagically loads the shader's source code (in
// vfunc_build_pipeline()) from the resource file resources/shaders/<nick>.glsl
// resolving any #includes in this file.
_init(nick) {
this._nick = nick;
export var Shader = GObject.registerClass({
Signals: {
'begin-animation': {
param_types: [
Gio.Settings.$gtype, GObject.TYPE_BOOLEAN, GObject.TYPE_BOOLEAN,
Clutter.Actor.$gtype
]
},
'update-animation': {param_types: [GObject.TYPE_DOUBLE]},
'end-animation': {}
}
},
// This will call vfunc_build_pipeline().
super._init();
class Shader extends Shell.GLSLEffect {
// --------------------------------------------
// The constructor automagically loads the shader's source code (in
// vfunc_build_pipeline()) from the resource file resources/shaders/<nick>.glsl
// resolving any #includes in this file.
_init(nick) {
this._nick = nick;
// These will be updated during the animation.
this._progress = 0;
this._time = 0;
// This will call vfunc_build_pipeline().
super._init();
// Store standard uniform locations.
this._uForOpening = this.get_uniform_location('uForOpening');
this._uIsFullscreen = this.get_uniform_location('uIsFullscreen');
this._uProgress = this.get_uniform_location('uProgress');
this._uDuration = this.get_uniform_location('uDuration');
this._uSize = this.get_uniform_location('uSize');
this._uPadding = this.get_uniform_location('uPadding');
// These will be updated during the animation.
this._progress = 0;
this._time = 0;
// Create a timeline to drive the animation.
this._timeline = new Clutter.Timeline();
// Store standard uniform locations.
this._uForOpening = this.get_uniform_location('uForOpening');
this._uIsFullscreen = this.get_uniform_location('uIsFullscreen');
this._uProgress = this.get_uniform_location('uProgress');
this._uDuration = this.get_uniform_location('uDuration');
this._uSize = this.get_uniform_location('uSize');
this._uPadding = this.get_uniform_location('uPadding');
// Call updateAnimation() once a frame.
this._timeline.connect('new-frame', (t) => {
if (this._testMode) {
this.updateAnimation(0.5);
} else {
this.updateAnimation(t.get_progress());
}
});
// Create a timeline to drive the animation.
this._timeline = new Clutter.Timeline();
// Clean up if the animation finished or was interrupted.
this._timeline.connect('stopped', (t, finished) => {
this.endAnimation();
});
// Call updateAnimation() once a frame.
this._timeline.connect('new-frame', (t) => {
if (this._testMode) {
this.updateAnimation(0.5);
} else {
this.updateAnimation(t.get_progress());
}
});
// Clean up if the animation finished or was interrupted.
this._timeline.connect('stopped', (t, finished) => {
this.endAnimation();
});
}
// This is called once each time the shader is used.
beginAnimation(settings, forOpening, testMode, duration, actor) {
if (this._timeline.is_playing()) {
this._timeline.stop();
}
// This is called once each time the shader is used.
beginAnimation(settings, forOpening, testMode, duration, actor) {
if (this._timeline.is_playing()) {
this._timeline.stop();
}
// On GNOME 3.36 this method was not yet available.
if (this._timeline.set_actor) {
this._timeline.set_actor(actor);
}
// On GNOME 3.36 this method was not yet available.
if (this._timeline.set_actor) {
this._timeline.set_actor(actor);
}
this._timeline.set_duration(duration);
this._timeline.start();
this._timeline.set_duration(duration);
this._timeline.start();
// Make sure that no fullscreen window is drawn over our animations.
// Make sure that no fullscreen window is drawn over our animations. Since GNOME 48
// this is a "global" method.
if (Meta.disable_unredirect_for_display) {
Meta.disable_unredirect_for_display(global.display);
global.begin_work();
// Reset progress value.
this._progress = 0;
this._testMode = testMode;
// This is not necessarily symmetric, but I haven't figured out a way to
// get the actual values...
const padding = (actor.width - actor.meta_window.get_frame_rect().width) / 2;
const isFullscreen =
actor.meta_window.get_maximized() === Meta.MaximizeFlags.BOTH ||
actor.meta_window.fullscreen;
this.set_uniform_float(this._uPadding, 1, [padding]);
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uIsFullscreen, 1, [isFullscreen]);
this.set_uniform_float(this._uDuration, 1, [duration * 0.001]);
this.set_uniform_float(this._uSize, 2, [actor.width, actor.height]);
this.emit('begin-animation', settings, forOpening, testMode, actor);
} else {
global.compositor.disable_unredirect();
}
// This is called at each frame during the animation.
updateAnimation(progress) {
// Store the current progress value. The corresponding signal is emitted each frame
// in vfunc_paint_target. We do not emit it here, as the pipeline which may be used
// by handlers must not have been created yet.
this._progress = progress;
global.begin_work();
this.queue_repaint();
// Reset progress value.
this._progress = 0;
this._testMode = testMode;
// This is not necessarily symmetric, but I haven't figured out a way to
// get the actual values...
const padding = (actor.width - actor.meta_window.get_frame_rect().width) / 2;
const isFullscreen = actor.meta_window.get_maximized() === Meta.MaximizeFlags.BOTH ||
actor.meta_window.fullscreen;
this.set_uniform_float(this._uPadding, 1, [padding]);
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uIsFullscreen, 1, [isFullscreen]);
this.set_uniform_float(this._uDuration, 1, [duration * 0.001]);
this.set_uniform_float(this._uSize, 2, [actor.width, actor.height]);
this.emit('begin-animation', settings, forOpening, testMode, actor);
}
// This is called at each frame during the animation.
updateAnimation(progress) {
// Store the current progress value. The corresponding signal is emitted each frame
// in vfunc_paint_target. We do not emit it here, as the pipeline which may be used
// by handlers must not have been created yet.
this._progress = progress;
this.queue_repaint();
}
// This will stop any running animation and emit the end-animation signal.
endAnimation() {
// This will call endAnimation() again, so we can return for now.
if (this._timeline.is_playing()) {
this._timeline.stop();
return;
}
// This will stop any running animation and emit the end-animation signal.
endAnimation() {
// This will call endAnimation() again, so we can return for now.
if (this._timeline.is_playing()) {
this._timeline.stop();
return;
}
// Restore unredirecting behavior for fullscreen windows.
// Restore unredirecting behavior for fullscreen windows. Since GNOME 48 this is a
// "global" method.
if (Meta.disable_unredirect_for_display) {
Meta.enable_unredirect_for_display(global.display);
global.end_work();
this.emit('end-animation');
} else {
global.compositor.enable_unredirect();
}
global.end_work();
// This is called by the constructor. This means, it's only called when the
// effect is used for the first time.
vfunc_build_pipeline() {
this.emit('end-animation');
}
// Shell.GLSLEffect requires the declarations and the main source code as separate
// strings. As it's more convenient to store the in one GLSL file, we use a regex
// here to split the source code in two parts.
const code = this._loadShaderResource(`/shaders/${this._nick}.frag`);
// This is called by the constructor. This means, it's only called when the
// effect is used for the first time.
vfunc_build_pipeline() {
// Shell.GLSLEffect requires the declarations and the main source code as separate
// strings. As it's more convenient to store the in one GLSL file, we use a regex
// here to split the source code in two parts.
const code = this._loadShaderResource(`/shaders/${this._nick}.frag`);
// Match anything between the curly brackets of "void main() {...}".
const regex = RegExp('void main *\\(\\) *\\{([\\S\\s]+)\\}');
const match = regex.exec(code);
// Match anything between the curly brackets of "void main() {...}".
const regex = RegExp('void main *\\(\\) *\\{([\\S\\s]+)\\}');
const match = regex.exec(code);
const declarations = code.substr(0, match.index);
const main = match[1];
const declarations = code.substr(0, match.index);
const main = match[1];
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, declarations, main, true);
}
this.add_glsl_snippet(
Cogl.SnippetHook ? Cogl.SnippetHook.FRAGMENT : Shell.SnippetHook.FRAGMENT,
declarations, main, true);
}
// We use this vfunc to trigger the update as it allows calling this.get_pipeline() in
// the handler. This could still be null if called from the updateAnimation() above.
vfunc_paint_target(...params) {
this.emit('update-animation', this._progress);
// We use this vfunc to trigger the update as it allows calling this.get_pipeline() in
// the handler. This could still be null if called from the updateAnimation() above.
vfunc_paint_target(...params) {
this.emit('update-animation', this._progress);
// Starting with GNOME 44.2, the alpha channel is not written to by default. We need
// to undo this. It is a pity that we have to do this here, as it is not really
// required to be done each frame. But it's the only place where we can do it.
// https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2650
this.get_pipeline().set_blend(
'RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))');
// Starting with GNOME 44.2, the alpha channel is not written to by default. We need
// to undo this. It is a pity that we have to do this here, as it is not really
// required to be done each frame. But it's the only place where we can do it.
// https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2650
this.get_pipeline().set_blend(
'RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))');
this.set_uniform_float(this._uProgress, 1, [this._progress]);
super.vfunc_paint_target(...params);
}
this.set_uniform_float(this._uProgress, 1, [this._progress]);
super.vfunc_paint_target(...params);
}
// --------------------------------------------------------------------- private stuff
// --------------------------------------------------------------------- private stuff
// This loads a GLSL file from the extension's resources to a JavaScript string. The
// code from "common.glsl" is prepended automatically.
_loadShaderResource(path) {
let common = utils.getStringResource('/shaders/common.glsl');
let code = utils.getStringResource(path);
// This loads a GLSL file from the extension's resources to a JavaScript string. The
// code from "common.glsl" is prepended automatically.
_loadShaderResource(path) {
let common = utils.getStringResource('/shaders/common.glsl');
let code = utils.getStringResource(path);
// Add a trailing newline. Else the GLSL compiler complains...
return common + '\n' + code + '\n';
}
});
// Add a trailing newline. Else the GLSL compiler complains...
return common + '\n' + code + '\n';
}
});

View file

@ -91,4 +91,4 @@ export default class ShaderFactory {
return shader;
}
}
}

View file

@ -0,0 +1,134 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
//////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: Justin Garza <JGarza9788@gmail.com>
// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
// SPDX-License-Identifier: GPL-3.0-or-later
'use strict';
import * as utils from '../utils.js';
// We import the ShaderFactory only in the Shell process as it is not required in the
// preferences process. The preferences process does not create any shader instances, it
// only uses the static metadata of the effect.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const _ = await utils.importGettext();
//////////////////////////////////////////////////////////////////////////////////////////
// This effect was inspired by apple's new siri effect. //
//////////////////////////////////////////////////////////////////////////////////////////
// The effect class can be used to get some metadata (like the effect's name or supported
// GNOME Shell versions), to initialize the respective page of the settings dialog, as
// well as to create the actual shader for the effect.
export default class Effect {
// The constructor creates a ShaderFactory which will be used by extension.js to create
// shader instances for this effect. The shaders will be automagically created using the
// GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each
// newly created shader instance.
constructor() {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Store uniform locations of newly created shaders.
shader._uSpeed = shader.get_uniform_location('uSpeed');
shader._uRandomColor = shader.get_uniform_location('uRandomColor');
shader._uStartHue = shader.get_uniform_location('uStartHue');
shader._uSaturation = shader.get_uniform_location('uSaturation');
shader._uEdgeSize = shader.get_uniform_location('uEdgeSize');
shader._uEdgeHardness = shader.get_uniform_location('uEdgeHardness');
shader._uBlur = shader.get_uniform_location('uBlur');
shader._uSeed = shader.get_uniform_location('uSeed');
// Write all uniform values at the start of each animation.
shader.connect('begin-animation', (shader, settings) => {
// clang-format off
shader.set_uniform_float(shader._uSpeed, 1, [settings.get_double('aura-glow-speed')]);
shader.set_uniform_float(shader._uRandomColor, 1, [settings.get_boolean('aura-glow-random-color')]);
shader.set_uniform_float(shader._uStartHue, 1, [settings.get_double('aura-glow-start-hue')]);
shader.set_uniform_float(shader._uSaturation, 1, [settings.get_double('aura-glow-saturation')]);
shader.set_uniform_float(shader._uEdgeSize, 1, [settings.get_double('aura-glow-edge-size')]);
shader.set_uniform_float(shader._uEdgeHardness, 1, [settings.get_double('aura-glow-edge-hardness')]);
shader.set_uniform_float(shader._uBlur, 1, [settings.get_double('aura-glow-blur')]);
shader.set_uniform_float(shader._uSeed, 2, [Math.random(), Math.random()]);
// clang-format on
});
});
}
// ---------------------------------------------------------------------------- metadata
// The effect is available on all GNOME Shell versions supported by this extension.
static getMinShellVersion() {
return [3, 36];
}
// This will be called in various places where a unique identifier for this effect is
// required. It should match the prefix of the settings keys which store whether the
// effect is enabled currently (e.g. '*-enable-effect'), and its animation time
// (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be
// named likes this.
static getNick() {
return 'aura-glow';
}
// This will be shown in the sidebar of the preferences dialog as well as in the
// drop-down menus where the user can choose the effect.
static getLabel() {
return _('Aura Glow');
}
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog whenever a new effect profile is loaded. It
// binds all user interface elements to the respective settings keys of the profile.
static bindPreferences(dialog) {
dialog.bindAdjustment('aura-glow-animation-time');
dialog.bindAdjustment('aura-glow-speed');
dialog.bindSwitch('aura-glow-random-color');
dialog.bindAdjustment('aura-glow-start-hue');
dialog.bindAdjustment('aura-glow-saturation');
dialog.bindAdjustment('aura-glow-edge-size');
dialog.bindAdjustment('aura-glow-edge-hardness');
dialog.bindAdjustment('aura-glow-blur');
// enable and disable the one slider
function enableDisablePref(dialog, state) {
dialog.getBuilder().get_object('aura-glow-start-hue-slider').set_sensitive(!state);
}
const switchWidget = dialog.getBuilder().get_object('aura-glow-random-color');
// Connect to the "state-set" signal to update preferences dynamically based on
// the switch state.
switchWidget.connect('state-set', (widget, state) => {
enableDisablePref(dialog, state); // Update sensitivity when the state changes.
});
// Manually call the update function on startup, using the initial state of the
// switch.
const initialState =
switchWidget.get_active(); // Get the current state of the switch.
enableDisablePref(dialog, initialState);
}
// ---------------------------------------------------------------- API for extension.js
// The getActorScale() is called from extension.js to adjust the actor's size during the
// animation. This is useful if the effect requires drawing something beyond the usual
// bounds of the actor. This only works for GNOME 3.38+.
static getActorScale(settings, forOpening, actor) {
return {x: 1.0, y: 1.0};
}
}

View file

@ -20,8 +20,6 @@ import * as utils from '../utils.js';
// preferences process. They are used only in the creator function of the ShaderFactory
// which is only called within GNOME Shell's process.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const Clutter = await utils.importInShellOnly('gi://Clutter');
const GdkPixbuf = await utils.importInShellOnly('gi://GdkPixbuf');
const Cogl = await utils.importInShellOnly('gi://Cogl');
const _ = await utils.importGettext();
@ -55,11 +53,7 @@ export default class Effect {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Create the texture in the first call.
if (!this._shardTexture) {
const shardData = GdkPixbuf.Pixbuf.new_from_resource('/img/shards.png');
this._shardTexture = new Clutter.Image();
this._shardTexture.set_data(shardData.get_pixels(), Cogl.PixelFormat.RGB_888,
shardData.width, shardData.height,
shardData.rowstride);
this._shardTexture = utils.getImageResource('/img/shards.png');
}
// Store all uniform locations.

View file

@ -12,6 +12,8 @@
// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
// SPDX-License-Identifier: GPL-3.0-or-later
// modified by Justin Garza <JGarza9788@gmail.com>
'use strict';
import Gio from 'gi://Gio';
@ -58,6 +60,9 @@ export default class Effect {
shader._uScale = shader.get_uniform_location('uScale');
shader._uMovementSpeed = shader.get_uniform_location('uMovementSpeed');
shader._uRandomColor = shader.get_uniform_location('uRandomColor');
shader._uSeed = shader.get_uniform_location('uSeed');
// And update all uniforms at the start of each animation.
shader.connect('begin-animation', (shader, settings) => {
for (let i = 1; i <= 5; i++) {
@ -68,6 +73,8 @@ export default class Effect {
// clang-format off
shader.set_uniform_float(shader._u3DNoise, 1, [settings.get_boolean('fire-3d-noise')]);
shader.set_uniform_float(shader._uRandomColor, 1, [settings.get_boolean('fire-random-color')]);
shader.set_uniform_float(shader._uSeed, 1, [Math.random()]);
shader.set_uniform_float(shader._uScale, 1, [settings.get_double('fire-scale')]);
shader.set_uniform_float(shader._uMovementSpeed, 1, [settings.get_double('fire-movement-speed')]);
// clang-format on
@ -107,6 +114,7 @@ export default class Effect {
dialog.bindAdjustment('fire-movement-speed');
dialog.bindAdjustment('fire-scale');
dialog.bindSwitch('fire-3d-noise');
dialog.bindSwitch('fire-random-color');
dialog.bindColorButton('fire-color-1');
dialog.bindColorButton('fire-color-2');
dialog.bindColorButton('fire-color-3');
@ -129,6 +137,33 @@ export default class Effect {
// Initialize the fire-preset dropdown.
Effect._createFirePresets(dialog);
}
// enables and disables the color buttons
function enableDisableColorButtons(dialog, state) {
for (let i = 1; i <= 5; i++) {
dialog.getBuilder().get_object('fire-color-' + i).set_sensitive(!state);
}
}
const switchWidget = dialog.getBuilder().get_object('fire-random-color');
if (switchWidget) {
// Connect to the "state-set" signal to update preferences dynamically based on
// the switch state.
switchWidget.connect('state-set', (widget, state) => {
enableDisableColorButtons(dialog,
state); // Update sensitivity when the state changes.
});
// Manually call the update function on startup, using the initial state of the
// switch.
const initialState =
switchWidget.get_active(); // Get the current state of the switch.
enableDisableColorButtons(dialog, initialState);
} else {
// Log an error if the switch widget is not found in the UI.
log('Error: \'fire-random-color\' switch widget not found.');
}
}
// ---------------------------------------------------------------- API for extension.js
@ -195,12 +230,23 @@ export default class Effect {
color3: 'rgba(207,235,255,0.84)',
color4: 'rgb(208,243,255)',
color5: 'rgb(255,255,255)'
},
// i don't think he'll notice if i sneak this in
{
name: _('Nuclear ☢️'),
scale: 1.5,
speed: 0.5,
color1: 'rgba(0,0,0,0)',
color2: 'rgba(2, 40, 0, 0.3)',
color3: 'rgba(0, 200, 50, 0.9)',
color4: 'rgba(255, 255, 0, 1.0)',
color5: 'rgba(255, 255, 255, 1.0)'
}
];
const menu = Gio.Menu.new();
const group = Gio.SimpleActionGroup.new();
const groupName = 'presets';
const groupName = 'fire-presets';
// Add all presets.
presets.forEach((preset, i) => {

View file

@ -20,9 +20,6 @@ import * as utils from '../utils.js';
// preferences process. They are used only in the creator function of the ShaderFactory
// which is only called within GNOME Shell's process.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const Clutter = await utils.importInShellOnly('gi://Clutter');
const GdkPixbuf = await utils.importInShellOnly('gi://GdkPixbuf');
const Cogl = await utils.importInShellOnly('gi://Cogl');
const _ = await utils.importGettext();
@ -47,12 +44,7 @@ export default class Effect {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Create the texture in the first call.
if (!this._fontTexture) {
const fontData = GdkPixbuf.Pixbuf.new_from_resource('/img/matrixFont.png');
this._fontTexture = new Clutter.Image();
this._fontTexture.set_data(
fontData.get_pixels(),
fontData.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888,
fontData.width, fontData.height, fontData.rowstride);
this._fontTexture = utils.getImageResource('/img/matrixFont.png');
}
// Store uniform locations of newly created shaders.

View file

@ -0,0 +1,384 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
//////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
// SPDX-License-Identifier: GPL-3.0-or-later
'use strict';
// Import the Gio module from the GNOME platform (GObject Introspection).
// This module provides APIs for I/O operations, settings management, and other core
// features.
import Gio from 'gi://Gio';
// Import utility functions from the local utils.js file.
// These utilities likely contain helper functions or shared logic used across the
// application.
import * as utils from '../utils.js';
// We import the ShaderFactory only in the Shell process as it is not required in the
// preferences process. The preferences process does not create any shader instances, it
// only uses the static metadata of the effect.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const _ = await utils.importGettext();
//////////////////////////////////////////////////////////////////////////////////////////
// This effect is inspired by the old 8bit mario video games and the New Super Mario //
// Bros 2 specifically when mario gets the mushroom. i hope you enjoy this little blast //
// from the past. //
//////////////////////////////////////////////////////////////////////////////////////////
// The effect class can be used to get some metadata (like the effect's name or supported
// GNOME Shell versions), to initialize the respective page of the settings dialog, as
// well as to create the actual shader for the effect.
export default class Effect {
// The constructor creates a ShaderFactory which will be used by extension.js to create
// shader instances for this effect. The shaders will be automagically created using the
// GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each
// newly created shader instance.
constructor() {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// very basic effect... so nothing here
shader._uGradient = [
shader.get_uniform_location('uStarColor0'),
shader.get_uniform_location('uStarColor1'),
shader.get_uniform_location('uStarColor2'),
shader.get_uniform_location('uStarColor3'),
shader.get_uniform_location('uStarColor4'),
shader.get_uniform_location('uStarColor5'),
];
shader._uScaleStyle = shader.get_uniform_location('uScaleStyle');
shader._uSparkCount = shader.get_uniform_location('uSparkCount');
shader._uSparkColor = shader.get_uniform_location('uSparkColor');
shader._uSparkRotation = shader.get_uniform_location('uSparkRotation');
shader._uRaysColor = shader.get_uniform_location('uRaysColor');
shader._uRingCount = shader.get_uniform_location('uRingCount');
shader._uRingRotation = shader.get_uniform_location('uRingRotation');
shader._uStarCount = shader.get_uniform_location('uStarCount');
shader._uSeed = shader.get_uniform_location('uSeed');
// And update all uniforms at the start of each animation.
shader.connect('begin-animation', (shader, settings) => {
for (let i = 0; i <= 5; i++) {
shader.set_uniform_float(
shader._uGradient[i], 4,
utils.parseColor(settings.get_string('mushroom-star-color-' + i)));
}
// clang-format off
shader.set_uniform_float(shader._uScaleStyle, 1, [settings.get_double('mushroom-scale-style')]);
shader.set_uniform_float(shader._uSparkCount, 1, [settings.get_int('mushroom-spark-count')]);
shader.set_uniform_float(shader._uSparkColor, 4, utils.parseColor(settings.get_string('mushroom-spark-color')));
shader.set_uniform_float(shader._uSparkRotation, 1, [settings.get_double('mushroom-spark-rotation')]);
shader.set_uniform_float(shader._uRaysColor, 4, utils.parseColor(settings.get_string('mushroom-rays-color')));
shader.set_uniform_float(shader._uRingCount, 1, [settings.get_int('mushroom-ring-count')]);
shader.set_uniform_float(shader._uRingRotation, 1, [settings.get_double('mushroom-ring-rotation')]);
shader.set_uniform_float(shader._uStarCount, 1, [settings.get_int('mushroom-star-count')]);
shader.set_uniform_float(shader._uSeed, 2, [Math.random(), Math.random()]);
// clang-format on
});
});
}
// ---------------------------------------------------------------------------- metadata
// The effect is available on all GNOME Shell versions supported by this extension.
static getMinShellVersion() {
return [3, 36];
}
// This will be called in various places where a unique identifier for this effect is
// required. It should match the prefix of the settings keys which store whether the
// effect is enabled currently (e.g. '*-enable-effect'), and its animation time
// (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be
// named likes this.
static getNick() {
return 'mushroom';
}
// This will be shown in the sidebar of the preferences dialog as well as in the
// drop-down menus where the user can choose the effect.
static getLabel() {
return _('Mushroom');
}
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog whenever a new effect profile is loaded. It
// binds all user interface elements to the respective settings keys of the profile.
static bindPreferences(dialog) {
// Empty for now... Code is added here later in the tutorial!
dialog.bindAdjustment('mushroom-animation-time');
// dialog.bindSwitch('mushroom-8bit-enable');
dialog.bindAdjustment('mushroom-scale-style');
dialog.bindAdjustment('mushroom-spark-count');
dialog.bindColorButton('mushroom-spark-color');
dialog.bindAdjustment('mushroom-spark-rotation');
dialog.bindColorButton('mushroom-rays-color');
dialog.bindAdjustment('mushroom-ring-count');
dialog.bindAdjustment('mushroom-ring-rotation');
dialog.bindAdjustment('mushroom-star-count');
dialog.bindColorButton('mushroom-star-color-0');
dialog.bindColorButton('mushroom-star-color-1');
dialog.bindColorButton('mushroom-star-color-2');
dialog.bindColorButton('mushroom-star-color-3');
dialog.bindColorButton('mushroom-star-color-4');
dialog.bindColorButton('mushroom-star-color-5');
// Ensure the button connections and other bindings happen only once,
// even if the bindPreferences function is called multiple times.
if (!Effect._isConnected) {
Effect._isConnected = true;
// Bind the "reset-star-colors" button to reset all star colors to their default
// values.
dialog.getBuilder().get_object('reset-star-colors').connect('clicked', () => {
// Reset each mushroom star color setting.
dialog.getProfileSettings().reset('mushroom-star-color-0');
dialog.getProfileSettings().reset('mushroom-star-color-1');
dialog.getProfileSettings().reset('mushroom-star-color-2');
dialog.getProfileSettings().reset('mushroom-star-color-3');
dialog.getProfileSettings().reset('mushroom-star-color-4');
dialog.getProfileSettings().reset('mushroom-star-color-5');
});
// Initialize the preset dropdown menu for mushroom star colors.
Effect._createMushroomPresets(dialog);
}
}
// ---------------------------------------------------------------- API for extension.js
// The getActorScale() is called from extension.js to adjust the actor's size during the
// animation. This is useful if the effect requires drawing something beyond the usual
// bounds of the actor. This only works for GNOME 3.38+.
static getActorScale(settings, forOpening, actor) {
return {x: 1.0, y: 1.0};
}
// ---------------------------------------------------------------- Presets
// This function initializes the preset dropdown menu for configuring fire options.
// It defines multiple color presets for the "mushroom star" effect and sets up
// the logic to apply these presets when selected.
static _createMushroomPresets(dialog) {
// Retrieve the builder object for the dialog and connect to the "realize" event of
// the button.
dialog.getBuilder()
.get_object('mushroom-star-color-preset-button')
.connect('realize', (widget) => {
// Define an array of color presets, each with a name and six color values (RGBA
// format).
const presets = [
{
name: _('8Bit Plumber'),
ScaleStyle: 0.0,
SparkCount: 0,
SparkColor: 'rgba(255,255,255,0.0)',
SparkRotation: 0.33,
RayColor: 'rgba(255,255,255,0.0)',
RingCount: 0,
RingRotation: 0.0,
StarCount: 0,
color0: 'rgba(233,249,0,1.0)',
color1: 'rgba(233,249,0,1.0)',
color2: 'rgba(91,255,0,1.0)',
color3: 'rgba(91,255,0,1.0)',
color4: 'rgba(0,240,236,1.0)',
color5: 'rgba(0,240,236,1.0)',
},
{
name: _('New Bros 2 🍄'),
ScaleStyle: 1.0,
SparkCount: 4,
SparkColor: 'rgba(255,255,255,1.0)',
SparkRotation: 0.3,
RayColor: 'rgba(255,255,255,1.0)',
RingCount: 3,
RingRotation: 1.33,
StarCount: 5,
color0: 'rgba(233,249,0,1.0)',
color1: 'rgba(233,249,0,1.0)',
color2: 'rgba(91,255,0,1.0)',
color3: 'rgba(91,255,0,1.0)',
color4: 'rgba(0,240,236,1.0)',
color5: 'rgba(0,240,236,1.0)',
},
{
name:
_('Red White and Blue 🇺🇸'), // A patriotic palette of red, white, and blue
ScaleStyle: 1.0,
SparkCount: 4,
SparkColor: 'rgba(255,255,255,1.0)',
SparkRotation: 0.3,
RayColor: 'rgba(255,255,255,0.0)',
RingCount: 3,
RingRotation: 1.33,
StarCount: 5,
color0: 'rgba(255, 0, 0, 1.0)',
color1: 'rgba(255, 0, 0, 1.0)',
color2: 'rgba(255,255,255, 1.0)',
color3: 'rgba(255,255,255, 1.0)',
color4: 'rgba(0,0,255, 1.0)',
color5: 'rgba(0,0,255, 1.0)'
},
{
name: _('Rainbow 🌈'), // A vivid rainbow spectrum of colors
ScaleStyle: 1.0,
SparkCount: 4,
SparkColor: 'rgba(255,255,255,1.0)',
SparkRotation: 0.3,
RayColor: 'rgba(255,255,255,0.0)',
RingCount: 3,
RingRotation: 2.0,
StarCount: 7,
color0: 'rgba(255, 69, 58, 1.0)', // Bold Red
color1: 'rgba(255, 140, 0, 1.0)', // Bold Orange
color2: 'rgba(255, 223, 0, 1.0)', // Bold Yellow
color3: 'rgba(50, 205, 50, 1.0)', // Bold Green
color4: 'rgba(30, 144, 255, 1.0)', // Bold Blue
color5: 'rgba(148, 0, 211, 1.0)' // Bold Purple
},
{
name: _('Cattuccino 😺'), // A soft pastel palette inspired by a
// cappuccino theme
ScaleStyle: 1.0,
SparkCount: 4,
SparkColor: 'rgba(255,255,255,1.0)',
SparkRotation: 0.3,
RayColor: 'rgba(255,255,255,0.0)',
RingCount: 3,
RingRotation: 2.0,
StarCount: 7,
color0: 'rgba(239, 146, 160, 1.0)',
color1: 'rgba(246, 178, 138, 1.0)',
color2: 'rgba(240, 217, 169, 1.0)',
color3: 'rgba(175, 223, 159, 1.0)',
color4: 'rgba(149, 182, 246, 1.0)',
color5: 'rgba(205, 170, 247, 1.0)'
},
{
name: _('Dracula 🦇'), // A dark palette inspired by the Dracula theme
ScaleStyle: 1.0,
SparkCount: 0,
SparkColor: 'rgba(255,255,255,1.0)',
SparkRotation: 0.3,
RayColor: 'rgba(255,255,255,0.0)',
RingCount: 3,
RingRotation: 2.0,
StarCount: 7,
color0: 'rgba(40, 42, 54, 1.0)', // Dark Grey
color1: 'rgba(68, 71, 90, 1.0)', // Medium Grey
color2: 'rgba(90, 94, 119, 1.0)', // Light Grey
color3: 'rgba(90, 94, 119, 1.0)', // Light Grey
color4: 'rgba(68, 71, 90, 1.0)', // Medium Grey
color5: 'rgba(40, 42, 54, 1.0)' // Dark Grey
},
{
name: _('Sparkle ✨'), // A dark palette inspired by the Dracula theme
ScaleStyle: 1.0,
SparkCount: 25,
SparkColor: 'rgba(255,255,255,1.0)',
SparkRotation: 0.3,
RayColor: 'rgba(255,255,255,0.0)',
RingCount: 0,
RingRotation: 1.33,
StarCount: 7,
color0: 'rgba(255,255,255,0.0)',
color1: 'rgba(255,255,255,0.0)',
color2: 'rgba(255,255,255,0.0)',
color3: 'rgba(255,255,255,0.0)',
color4: 'rgba(255,255,255,0.0)',
color5: 'rgba(255,255,255,0.0)',
}
];
// Create a new menu model to hold the presets and an action group for handling
// selections.
const menu = Gio.Menu.new();
const group = Gio.SimpleActionGroup.new();
const groupName = 'mushroom-presets';
// Iterate over the presets to populate the menu.
presets.forEach((preset, i) => {
// Define an action name based on the preset index.
const actionName = 'mushroom' + i;
// Append the preset name to the menu.
menu.append(preset.name, groupName + '.' + actionName);
// Create a new action for the preset.
let action = Gio.SimpleAction.new(actionName, null);
// Connect the action to a function that loads the preset colors into the
// dialog.
action.connect('activate', () => {
dialog.getProfileSettings().set_double('mushroom-scale-style',
preset.ScaleStyle);
dialog.getProfileSettings().set_int('mushroom-spark-count',
preset.SparkCount);
dialog.getProfileSettings().set_string('mushroom-spark-color',
preset.SparkColor);
dialog.getProfileSettings().set_double('mushroom-spark-rotation',
preset.SparkRotation);
dialog.getProfileSettings().set_string('mushroom-rays-color',
preset.RayColor);
dialog.getProfileSettings().set_int('mushroom-ring-count', preset.RingCount);
dialog.getProfileSettings().set_double('mushroom-ring-rotation',
preset.RingRotation);
dialog.getProfileSettings().set_int('mushroom-star-count', preset.StarCount);
dialog.getProfileSettings().set_string('mushroom-star-color-0',
preset.color0);
dialog.getProfileSettings().set_string('mushroom-star-color-1',
preset.color1);
dialog.getProfileSettings().set_string('mushroom-star-color-2',
preset.color2);
dialog.getProfileSettings().set_string('mushroom-star-color-3',
preset.color3);
dialog.getProfileSettings().set_string('mushroom-star-color-4',
preset.color4);
dialog.getProfileSettings().set_string('mushroom-star-color-5',
preset.color5);
});
// Add the action to the action group.
group.add_action(action);
});
// Assign the populated menu to the preset button.
dialog.getBuilder()
.get_object('mushroom-star-color-preset-button')
.set_menu_model(menu);
// Insert the action group into the root widget for handling the presets.
const root = widget.get_root();
root.insert_action_group(groupName, group);
});
}
}

View file

@ -20,8 +20,6 @@ import * as utils from '../utils.js';
// preferences process. They are used only in the creator function of the ShaderFactory
// which is only called within GNOME Shell's process.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const Clutter = await utils.importInShellOnly('gi://Clutter');
const GdkPixbuf = await utils.importInShellOnly('gi://GdkPixbuf');
const Cogl = await utils.importInShellOnly('gi://Cogl');
const _ = await utils.importGettext();
@ -45,11 +43,7 @@ export default class Effect {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Create the texture in the first call.
if (!this._brushTexture) {
const brushData = GdkPixbuf.Pixbuf.new_from_resource('/img/brush.png');
this._brushTexture = new Clutter.Image();
this._brushTexture.set_data(brushData.get_pixels(),
Cogl.PixelFormat.RGBA_8888_PRE, brushData.width,
brushData.height, brushData.rowstride);
this._brushTexture = utils.getImageResource('/img/brush.png', true);
}
// Store uniform locations of newly created shaders.

View file

@ -0,0 +1,100 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
//////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
// SPDX-License-Identifier: GPL-3.0-or-later
'use strict';
import * as utils from '../utils.js';
// We import the ShaderFactory only in the Shell process as it is not required in the
// preferences process. The preferences process does not create any shader instances, it
// only uses the static metadata of the effect.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const _ = await utils.importGettext();
//////////////////////////////////////////////////////////////////////////////////////////
// This effect warps the Red Green Blue values //
//////////////////////////////////////////////////////////////////////////////////////////
// The effect class can be used to get some metadata (like the effect's name or supported
// GNOME Shell versions), to initialize the respective page of the settings dialog, as
// well as to create the actual shader for the effect.
export default class Effect {
// The constructor creates a ShaderFactory which will be used by extension.js to create
// shader instances for this effect. The shaders will be automagically created using the
// GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each
// newly created shader instance.
constructor() {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Store uniform locations of newly created shaders.
shader._uBrightness = shader.get_uniform_location('uBrightness');
shader._uSpeedR = shader.get_uniform_location('uSpeedR');
shader._uSpeedG = shader.get_uniform_location('uSpeedG');
shader._uSpeedB = shader.get_uniform_location('uSpeedB');
// Write all uniform values at the start of each animation.
shader.connect('begin-animation', (shader, settings) => {
// clang-format off
shader.set_uniform_float(shader._uBrightness, 1, [settings.get_double('rgbwarp-brightness')]);
shader.set_uniform_float(shader._uSpeedR, 1, [settings.get_double('rgbwarp-speed-r')]);
shader.set_uniform_float(shader._uSpeedG, 1, [settings.get_double('rgbwarp-speed-g')]);
shader.set_uniform_float(shader._uSpeedB, 1, [settings.get_double('rgbwarp-speed-b')]);
// clang-format on
});
});
}
// ---------------------------------------------------------------------------- metadata
// The effect is available on all GNOME Shell versions supported by this extension.
static getMinShellVersion() {
return [3, 36];
}
// This will be called in various places where a unique identifier for this effect is
// required. It should match the prefix of the settings keys which store whether the
// effect is enabled currently (e.g. '*-enable-effect'), and its animation time
// (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be
// named likes this.
static getNick() {
return 'rgbwarp';
}
// This will be shown in the sidebar of the preferences dialog as well as in the
// drop-down menus where the user can choose the effect.
static getLabel() {
return _('RGB Warp');
}
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog whenever a new effect profile is loaded. It
// binds all user interface elements to the respective settings keys of the profile.
static bindPreferences(dialog) {
dialog.bindAdjustment('rgbwarp-animation-time');
dialog.bindAdjustment('rgbwarp-brightness');
dialog.bindAdjustment('rgbwarp-speed-r');
dialog.bindAdjustment('rgbwarp-speed-g');
dialog.bindAdjustment('rgbwarp-speed-b');
}
// ---------------------------------------------------------------- API for extension.js
// The getActorScale() is called from extension.js to adjust the actor's size during the
// animation. This is useful if the effect requires drawing something beyond the usual
// bounds of the actor. This only works for GNOME 3.38+.
static getActorScale(settings, forOpening, actor) {
return {x: 1.0, y: 1.0};
}
}

View file

@ -20,8 +20,6 @@ import * as utils from '../utils.js';
// preferences process. They are used only in the creator function of the ShaderFactory
// which is only called within GNOME Shell's process.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const Clutter = await utils.importInShellOnly('gi://Clutter');
const GdkPixbuf = await utils.importInShellOnly('gi://GdkPixbuf');
const Cogl = await utils.importInShellOnly('gi://Cogl');
const _ = await utils.importGettext();
@ -49,10 +47,7 @@ export default class Effect {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Create the texture in the first call.
if (!this._dustTexture) {
const dustData = GdkPixbuf.Pixbuf.new_from_resource('/img/dust.png');
this._dustTexture = new Clutter.Image();
this._dustTexture.set_data(dustData.get_pixels(), Cogl.PixelFormat.RGB_888,
dustData.width, dustData.height, dustData.rowstride);
this._dustTexture = utils.getImageResource('/img/dust.png');
}
// Store uniform locations of newly created shaders.

View file

@ -20,8 +20,6 @@ import * as utils from '../utils.js';
// preferences process. They are used only in the creator function of the ShaderFactory
// which is only called within GNOME Shell's process.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const Clutter = await utils.importInShellOnly('gi://Clutter');
const GdkPixbuf = await utils.importInShellOnly('gi://GdkPixbuf');
const Cogl = await utils.importInShellOnly('gi://Cogl');
const _ = await utils.importGettext();
@ -45,10 +43,7 @@ export default class Effect {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Create the texture in the first call.
if (!this._clawTexture) {
const clawData = GdkPixbuf.Pixbuf.new_from_resource('/img/claws.png');
this._clawTexture = new Clutter.Image();
this._clawTexture.set_data(clawData.get_pixels(), Cogl.PixelFormat.RGB_888,
clawData.width, clawData.height, clawData.rowstride);
this._clawTexture = utils.getImageResource('/img/claws.png');
}
// Store uniform locations of newly created shaders.

View file

@ -0,0 +1,114 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
//////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
// SPDX-License-Identifier: GPL-3.0-or-later
'use strict';
import * as utils from '../utils.js';
// We import the ShaderFactory only in the Shell process as it is not required in the
// preferences process. The preferences process does not create any shader instances, it
// only uses the static metadata of the effect.
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
const _ = await utils.importGettext();
//////////////////////////////////////////////////////////////////////////////////////////
// This effect was inspired by Team Rocket Blasting Off again! //
// https://c.tenor.com/0ag0MVXUaQEAAAAd/tenor.gif //
//////////////////////////////////////////////////////////////////////////////////////////
// The effect class can be used to get some metadata (like the effect's name or supported
// GNOME Shell versions), to initialize the respective page of the settings dialog, as
// well as to create the actual shader for the effect.
export default class Effect {
// The constructor creates a ShaderFactory which will be used by extension.js to create
// shader instances for this effect. The shaders will be automagically created using the
// GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each
// newly created shader instance.
constructor() {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// Store uniform locations of newly created shaders.
shader._uAnimationSplit = shader.get_uniform_location('uAnimationSplit');
shader._uHorizontalSparklePosition =
shader.get_uniform_location('uHorizontalSparklePosition');
shader._uVerticalSparklePosition =
shader.get_uniform_location('uVerticalSparklePosition');
shader._uWindowRotation = shader.get_uniform_location('uWindowRotation');
shader._uSparkleRot = shader.get_uniform_location('uSparkleRot');
shader._uSparkleSize = shader.get_uniform_location('uSparkleSize');
shader._uSeed = shader.get_uniform_location('uSeed');
// Write all uniform values at the start of each animation.
shader.connect('begin-animation', (shader, settings) => {
// clang-format off
shader.set_uniform_float(shader._uAnimationSplit, 1, [settings.get_double('team-rocket-animation-split')]);
shader.set_uniform_float(shader._uHorizontalSparklePosition, 1, [settings.get_double('team-rocket-horizontal-sparkle-position')]);
shader.set_uniform_float(shader._uVerticalSparklePosition, 1, [settings.get_double('team-rocket-vertical-sparkle-position')]);
shader.set_uniform_float(shader._uWindowRotation, 1, [settings.get_boolean('team-rocket-window-rotation')]);
shader.set_uniform_float(shader._uSparkleRot, 1, [settings.get_double('team-rocket-sparkle-rot')]);
shader.set_uniform_float(shader._uSparkleSize, 1, [settings.get_double('team-rocket-sparkle-size')]);
// clang-format on
// This will be used with a hash function to get a random number.
shader.set_uniform_float(shader._uSeed, 2, [Math.random(), Math.random()]);
});
});
}
// ---------------------------------------------------------------------------- metadata
// The effect is available on all GNOME Shell versions supported by this extension.
static getMinShellVersion() {
return [3, 36];
}
// This will be called in various places where a unique identifier for this effect is
// required. It should match the prefix of the settings keys which store whether the
// effect is enabled currently (e.g. '*-enable-effect'), and its animation time
// (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be
// named likes this.
static getNick() {
return 'team-rocket';
}
// This will be shown in the sidebar of the preferences dialog as well as in the
// drop-down menus where the user can choose the effect.
static getLabel() {
return _('Team Rocket');
}
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog whenever a new effect profile is loaded. It
// binds all user interface elements to the respective settings keys of the profile.
static bindPreferences(dialog) {
dialog.bindAdjustment('team-rocket-animation-time');
dialog.bindAdjustment('team-rocket-animation-split');
dialog.bindAdjustment('team-rocket-horizontal-sparkle-position');
dialog.bindAdjustment('team-rocket-vertical-sparkle-position');
dialog.bindSwitch('team-rocket-window-rotation');
dialog.bindAdjustment('team-rocket-sparkle-rot');
dialog.bindAdjustment('team-rocket-sparkle-size');
}
// ---------------------------------------------------------------- API for extension.js
// The getActorScale() is called from extension.js to adjust the actor's size during the
// animation. This is useful if the effect requires drawing something beyond the usual
// bounds of the actor. This only works for GNOME 3.38+.
static getActorScale(settings, forOpening, actor) {
return {x: 1.0, y: 1.0};
}
}

View file

@ -20,8 +20,10 @@ import GLib from 'gi://GLib';
// We import some modules optionally. This file is used in the preferences process as well
// as in the GNOME Shell process. Some modules are only available or required in one of
// these processes.
const Clutter = await importInShellOnly('gi://Clutter');
const Cogl = await importInShellOnly('gi://Cogl');
const GdkPixbuf = await importInShellOnly('gi://GdkPixbuf');
const Clutter = await importInShellOnly('gi://Clutter');
const Cogl = await importInShellOnly('gi://Cogl');
const St = await importInShellOnly('gi://St');
// We import the Config module. This is done differently in the GNOME Shell process and in
// the preferences process.
@ -117,6 +119,26 @@ export function getStringResource(path) {
return new TextDecoder().decode(data.get_data());
}
// Reads the contents of an image file contained in the global resources archive. The data
// is returned as a St.ImageContent.
export function getImageResource(path, premultiplied = false) {
const data = GdkPixbuf.Pixbuf.new_from_resource(path);
const texture = St.ImageContent.new_with_preferred_size(data.width, data.height);
const format = data.has_alpha ?
(premultiplied ? Cogl.PixelFormat.RGBA_8888_PRE : Cogl.PixelFormat.RGBA_8888) :
Cogl.PixelFormat.RGB_888;
// https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/44b84e458a22046fedb85701ea25ad08ecc0d43f
if (shellVersionIsAtLeast(48, 'beta')) {
texture.set_data(global.stage.context.get_backend().get_cogl_context(),
data.get_pixels(), format, data.width, data.height, data.rowstride);
} else {
texture.set_data(data.get_pixels(), format, data.width, data.height, data.rowstride);
}
return texture;
}
// Executes a command asynchronously and returns the output from 'stdout' on success or
// throw an error with output from 'stderr' on failure. If given, input will be passed to
// 'stdin' and cancellable can be used to stop the process before it finishes.

View file

@ -6,9 +6,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/Nova1545/gnome-shell-extension-customreboot",
"uuid": "customreboot@nova1545",
"version": 11
}
}

View file

@ -1180,7 +1180,7 @@ const DockAppIconMenu = class DockAppIconMenu extends PopupMenu.PopupMenu {
favs.removeFavorite(app.get_id());
});
} else {
const item = this._appendMenuItem(_('Pin to Dock'));
const item = this._appendMenuItem(__('Pin to Dock'));
item.connect('activate', () => {
const favs = AppFavorites.getAppFavorites();
favs.addFavorite(app.get_id());
@ -1508,11 +1508,9 @@ class DockShowAppsIconMenu extends DockAppIconMenu {
_rebuildMenu() {
this.removeAll();
/* Translators: %s is "Settings", which is automatically translated. You
can also translate the full message if this fits better your language. */
const name = __('Dash to Dock %s').format(_('Settings'));
const item = this._appendMenuItem(name);
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem(__('Dash to Dock')));
const item = this._appendMenuItem(_('Settings'));
item.connect('activate', () =>
Docking.DockManager.extension.openPreferences());
}

View file

@ -245,7 +245,7 @@ const DockedDash = GObject.registerClass({
this._autohideIsEnabled = null;
this._intellihideIsEnabled = null;
// This variable marks if Meta.disable_unredirect_for_display() is called
// This variable marks if _disableUnredirect() is called
// to help restore the original state when intelihide is disabled.
this._unredirectDisabled = false;
@ -669,9 +669,22 @@ const DockedDash = GObject.registerClass({
]);
}
_disableUnredirect() {
if (!this._unredirectDisabled) {
if (Meta.disable_unredirect_for_display !== undefined)
Meta.disable_unredirect_for_display(global.display);
else if (global.compositor.disable_unredirect !== undefined)
global.compositor.disable_unredirect();
this._unredirectDisabled = true;
}
}
_restoreUnredirect() {
if (this._unredirectDisabled) {
Meta.enable_unredirect_for_display(global.display);
if (Meta.enable_unredirect_for_display !== undefined)
Meta.enable_unredirect_for_display(global.display);
else if (global.compositor.enable_unredirect !== undefined)
global.compositor.enable_unredirect();
this._unredirectDisabled = false;
}
}
@ -829,10 +842,8 @@ const DockedDash = GObject.registerClass({
}
_animateIn(time, delay) {
if (!this._unredirectDisabled && this._intellihideIsEnabled) {
Meta.disable_unredirect_for_display(global.display);
this._unredirectDisabled = true;
}
if (this._intellihideIsEnabled)
this._disableUnredirect();
this._dockState = State.SHOWING;
this.dash.iconAnimator.start();
this._delayedHide = false;
@ -870,10 +881,8 @@ const DockedDash = GObject.registerClass({
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._dockState = State.HIDDEN;
if (this._intellihideIsEnabled && this._unredirectDisabled) {
Meta.enable_unredirect_for_display(global.display);
this._unredirectDisabled = false;
}
if (this._intellihideIsEnabled)
this._restoreUnredirect();
// Remove queued barrier removal timeout if any
if (this._removeBarrierTimeoutId > 0)
GLib.source_remove(this._removeBarrierTimeoutId);
@ -1256,6 +1265,7 @@ const DockedDash = GObject.registerClass({
this._ignoreHover = this._oldIgnoreHover;
this._oldIgnoreHover = null;
this._box.sync_hover();
this._updateDashVisibility();
}
/**

View file

@ -7,9 +7,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://micheleg.github.io/dash-to-dock/",
"uuid": "dash-to-dock@micxgx.gmail.com",
"version": 99
"version": 100
}

View file

@ -8,7 +8,8 @@
background-color: rgba(238, 238, 238, 0.2); }
.dash-item-container .overview-tile .app-grid-running-dot {
margin-bottom: 8px; }
margin-bottom: 8px;
offset-y: 2px; }
#dashtodockContainer.bottom #dash {
margin: 0px;

View file

@ -3,9 +3,9 @@
"description": "Hide Universal Access icon from the status bar",
"name": "Hide Universal Access",
"shell-version": [
"47"
"48"
],
"url": "https://github.com/akiirui/hide-universal-access",
"uuid": "hide-universal-access@akiirui.github.io",
"version": 18
"version": 19
}

View file

@ -9,15 +9,8 @@ import * as Main from 'resource:///org/gnome/shell/ui/main.js';
export default class NoOverviewExtension {
enable() {
if (!Main.layoutManager._startingUp) {
return;
}
Main.layoutManager.connectObject(
'startup-complete',
() => Main.overview.hide(),
this
);
if (Main.layoutManager._startingUp)
Main.layoutManager.connectObject('startup-complete', () => Main.overview.hide(), this);
}
disable() {

View file

@ -6,9 +6,9 @@
"fthx"
],
"shell-version": [
"47"
"48"
],
"url": "https://github.com/fthx/no-overview",
"uuid": "no-overview@fthx",
"version": 18
"version": 19
}

View file

@ -1,3 +1,5 @@
## Version 13
* add Gnome 48 support
## Version 12
* add Gnome 47 support
## Version 11

View file

@ -8,9 +8,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/vchlum/notification-timeout",
"uuid": "notification-timeout@chlumskyvaclav.gmail.com",
"version": 12
"version": 13
}

View file

@ -7,9 +7,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/UbayGD/reboottouefi",
"uuid": "reboottouefi@ubaygd.com",
"version": 23
"version": 24
}

View file

@ -4,12 +4,13 @@
* Needed because of this issue:
* https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4474
*/
import Cogl from 'gi://Cogl';
import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
import { readShader } from '../utils/file.js';
const [declarations, code] = readShader(import.meta.url, 'shader/clip_shadow.frag');
export const ClipShadowEffect = GObject.registerClass({}, class extends Shell.GLSLEffect {
vfunc_build_pipeline() {
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, declarations, code, false);
this.add_glsl_snippet(Cogl.SnippetHook.FRAGMENT, declarations, code, false);
}
});

View file

@ -7,7 +7,7 @@ import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
export const LinearFilterEffect = GObject.registerClass({}, class extends Shell.GLSLEffect {
vfunc_build_pipeline() {
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, '', '', false);
this.add_glsl_snippet(Cogl.SnippetHook.FRAGMENT, '', '', false);
}
vfunc_paint_target(node, ctx) {
this.get_pipeline()?.set_layer_filters(0, Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR, Cogl.PipelineFilter.LINEAR);

View file

@ -1,5 +1,6 @@
/** @file Binds the actual corner rounding shader to the windows. */
var _a;
import Cogl from 'gi://Cogl';
import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
import { readShader } from '../utils/file.js';
@ -31,7 +32,7 @@ export const RoundedCornersEffect = GObject.registerClass({}, class Effect exten
}
}
vfunc_build_pipeline() {
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, declarations, code, false);
this.add_glsl_snippet(Cogl.SnippetHook.FRAGMENT, declarations, code, false);
}
/**
* Update uniforms of the shader.
@ -43,7 +44,7 @@ export const RoundedCornersEffect = GObject.registerClass({}, class Effect exten
*/
updateUniforms(scaleFactor, config, windowBounds) {
const borderWidth = getPref('border-width') * scaleFactor;
const borderColor = getPref('border-color');
const borderColor = config.borderColor;
const outerRadius = config.borderRadius * scaleFactor;
const { padding, smoothing } = config;
const bounds = [

View file

@ -1,4 +1,4 @@
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';
import { Extension, InjectionManager, } from 'resource:///org/gnome/shell/extensions/extension.js';
import { layoutManager } from 'resource:///org/gnome/shell/ui/main.js';
import { WindowPreview } from 'resource:///org/gnome/shell/ui/windowPreview.js';
import { WorkspaceAnimationController } from 'resource:///org/gnome/shell/ui/workspaceAnimation.js';
@ -11,17 +11,17 @@ import { getPref, initPrefs, prefs, uninitPrefs } from './utils/settings.js';
import { WindowPicker } from './window_picker/service.js';
export default class RoundedWindowCornersReborn extends Extension {
// The extension works by overriding (monkey patching) the code of GNOME
// Shell's internal methods. We need to keep a reference to the original
// methods so that we can restore them when the extension is disabled.
#originalAddWindow = WindowPreview.prototype._addWindow;
#originalPrepareWorkspaceSwitch = WorkspaceAnimationController.prototype._prepareWorkspaceSwitch;
#originalFinishWorkspaceSwitch = WorkspaceAnimationController.prototype._finishWorkspaceSwitch;
// Shell's internal methods. InjectionManager is a convenience class that
// stores references to the original methods and allows to easily restore
// them when the extension is disabled.
#injectionManager = null;
#windowPicker = null;
#layoutManagerStartupConnection = null;
#workspaceSwitchConnections = null;
enable() {
// Initialize extension preferences
initPrefs(this.getSettings());
this.#injectionManager = new InjectionManager();
// Export the d-bus interface of the window picker in preferences.
// See the readme in the `window_picker` directory for more information.
this.#windowPicker = new WindowPicker();
@ -51,26 +51,22 @@ export default class RoundedWindowCornersReborn extends Extension {
// We need to override its `_addWindow` method to add a shadow actor
// to the preview, otherwise overview windows won't have custom
// shadows.
WindowPreview.prototype._addWindow = function (window) {
self.#originalAddWindow.apply(this, [window]);
this.#injectionManager.overrideMethod(WindowPreview.prototype, '_addWindow', addWindow => function (window) {
addWindow.call(this, window);
addShadowInOverview(window, this);
};
});
// The same way we applied a cloned shadow actor to window previews in
// the overview, we also need to apply it to windows during workspace
// switching.
WorkspaceAnimationController.prototype._prepareWorkspaceSwitch =
function (workspaceIndices) {
self.#originalPrepareWorkspaceSwitch.apply(this, [
workspaceIndices,
]);
self.#workspaceSwitchConnections =
addShadowsInWorkspaceSwitch(this);
};
WorkspaceAnimationController.prototype._finishWorkspaceSwitch =
function (switchData) {
removeShadowsAfterWorkspaceSwitch(this);
self.#originalFinishWorkspaceSwitch.apply(this, [switchData]);
};
this.#injectionManager.overrideMethod(WorkspaceAnimationController.prototype, '_prepareWorkspaceSwitch', prepareWorkspaceSwitch => function (workspaceIndices) {
prepareWorkspaceSwitch.call(this, workspaceIndices);
self.#workspaceSwitchConnections =
addShadowsInWorkspaceSwitch(this);
});
this.#injectionManager.overrideMethod(WorkspaceAnimationController.prototype, '_finishWorkspaceSwitch', finishWorkspaceSwitch => function (switchData) {
removeShadowsAfterWorkspaceSwitch(this);
finishWorkspaceSwitch.call(this, switchData);
});
// Watch for changes of the `enable-preferences-entry` prefs key.
prefs.connect('changed', (_, key) => {
if (key === 'enable-preferences-entry') {
@ -83,11 +79,8 @@ export default class RoundedWindowCornersReborn extends Extension {
}
disable() {
// Restore patched methods
WindowPreview.prototype._addWindow = this.#originalAddWindow;
WorkspaceAnimationController.prototype._prepareWorkspaceSwitch =
this.#originalPrepareWorkspaceSwitch;
WorkspaceAnimationController.prototype._finishWorkspaceSwitch =
this.#originalFinishWorkspaceSwitch;
this.#injectionManager?.clear();
this.#injectionManager = null;
// Remove the item to open preferences page in background menu
disableBackgroundMenuItem();
this.#windowPicker?.unexport();

View file

@ -118,7 +118,6 @@ export function onSettingsChanged(key) {
break;
case 'global-rounded-corner-settings':
case 'custom-rounded-corner-settings':
case 'border-color':
case 'border-width':
case 'tweak-kitty-terminal':
refreshAllRoundedCorners();

View file

@ -6,9 +6,10 @@
"settings-schema": "org.gnome.shell.extensions.rounded-window-corners-reborn",
"shell-version": [
"46",
"47"
"47",
"48"
],
"url": "https://github.com/flexagoon/rounded-window-corners",
"uuid": "rounded-window-corners@fxgn",
"version": 11
"version": 12
}

View file

@ -6,6 +6,7 @@
import Adw from 'gi://Adw';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import Gdk from 'gi://Gdk';
import { gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import { getPref, setPref } from '../../utils/settings.js';
import { CustomSettingsRow, CustomSettingsRowClass, } from '../widgets/custom_settings_row.js';
@ -96,6 +97,20 @@ export const CustomPage = GObject.registerClass({
this.#customWindowSettings[wmClass].enabled = row.get_active();
setPref('custom-rounded-corner-settings', this.#customWindowSettings);
});
const color = new Gdk.RGBA();
[color.red, color.green, color.blue, color.alpha] =
this.#customWindowSettings[wmClass].borderColor;
r.borderColorButton.set_rgba(color);
r.borderColorButton.connect('notify::rgba', (_button) => {
const color = r.borderColorButton.get_rgba();
this.#customWindowSettings[wmClass].borderColor = [
color.red,
color.green,
color.blue,
color.alpha,
];
setPref('custom-rounded-corner-settings', this.#customWindowSettings);
});
r.cornerRadius.set_value(this.#customWindowSettings[wmClass].borderRadius);
r.cornerRadius.connect('value-changed', (adj) => {
this.#customWindowSettings[wmClass].borderRadius =

View file

@ -40,16 +40,17 @@ export const GeneralPage = GObject.registerClass({
bindPref('border-width', this._borderWidth, 'value', Gio.SettingsBindFlags.DEFAULT);
const color = new Gdk.RGBA();
[color.red, color.green, color.blue, color.alpha] =
getPref('border-color');
this.#settings.borderColor;
this._borderColor.set_rgba(color);
this._borderColor.connect('notify::rgba', (button) => {
const color = button.get_rgba();
setPref('border-color', [
this.#settings.borderColor = [
color.red,
color.green,
color.blue,
color.alpha,
]);
];
this.#updateGlobalConfig();
});
this._cornerRadius.set_value(this.#settings.borderRadius);
this._cornerRadius.connect('value-changed', (adj) => {

Some files were not shown because too many files have changed in this diff Show more