Update to Debian trixie
This commit is contained in:
parent
7a83c50208
commit
6118557715
12 changed files with 193 additions and 140 deletions
|
|
@ -19,12 +19,6 @@ systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
|
|||
DISABLE_DESKTOP="dpkg-statoverride --force-statoverride-add --update --add root root 640"
|
||||
$DISABLE_DESKTOP /usr/share/applications/gnome-bluetooth-panel.desktop
|
||||
$DISABLE_DESKTOP /usr/share/applications/gnome-online-accounts-panel.desktop
|
||||
$DISABLE_DESKTOP /usr/share/applications/gnome-sharing-panel.desktop
|
||||
|
||||
# Disable kexec-tools services.
|
||||
# We want to load kexec manually, and execution of kexec is already done by systemd.
|
||||
systemctl disable kexec-load.service
|
||||
systemctl disable kexec.service
|
||||
|
||||
# Restrict access to the config which contains the WiFi password.
|
||||
chmod og= /etc/NetworkManager/system-connections/contest.nmconnection
|
||||
|
|
|
|||
|
|
@ -2,21 +2,27 @@
|
|||
// Because of that, this gnome extension is distributed under
|
||||
// the terms of the GNU General Public License, version 2 or later.
|
||||
|
||||
const {
|
||||
AccountsService, Atk, Clutter, Gio,
|
||||
GLib, Graphene, Meta, Shell, St,
|
||||
} = imports.gi;
|
||||
import AccountsService from 'gi://AccountsService';
|
||||
import Atk from 'gi://Atk';
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import Graphene from 'gi://Graphene';
|
||||
import Meta from 'gi://Meta';
|
||||
import Shell from 'gi://Shell';
|
||||
import St from 'gi://St';
|
||||
|
||||
const Background = imports.ui.background;
|
||||
const Layout = imports.ui.layout;
|
||||
const Main = imports.ui.main;
|
||||
const ScreenShield = imports.ui.screenShield;
|
||||
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
import * as Background from 'resource:///org/gnome/shell/ui/background.js';
|
||||
import * as Layout from 'resource:///org/gnome/shell/ui/layout.js';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import * as ScreenShield from 'resource:///org/gnome/shell/ui/screenShield.js';
|
||||
|
||||
// half of the time for which a frame is displayed
|
||||
const HALF_FRAME_TIME_MS = 8;
|
||||
|
||||
const BLUR_BRIGHTNESS = 0.55;
|
||||
const BLUR_SIGMA = 60;
|
||||
const BLUR_BRIGHTNESS = 0.65;
|
||||
const BLUR_RADIUS = 90;
|
||||
|
||||
const POINTER_HIDE_TIMEOUT = 10 * GLib.USEC_PER_SEC;
|
||||
|
||||
|
|
@ -43,6 +49,7 @@ let countdownTimeoutId = 0;
|
|||
|
||||
let configFile;
|
||||
let configMonitor;
|
||||
let configLoadCancellable;
|
||||
let config;
|
||||
let startTime;
|
||||
|
||||
|
|
@ -59,49 +66,47 @@ function extLogError (msg) {
|
|||
printerr(`[contest-lock] Error: ${msg}`);
|
||||
}
|
||||
|
||||
function loadConfig () {
|
||||
configFile.load_contents_async(null, (obj, res) => {
|
||||
// If there is a poblem with the config file, log an error and keep
|
||||
// using the old config.
|
||||
let newConfig;
|
||||
try {
|
||||
const [ok, bytes] = configFile.load_contents_finish(res);
|
||||
// TextDecoder is used in upstream gnome-shell, but not yet
|
||||
// supported in current Debian.
|
||||
const contentStr = imports.byteArray.toString(bytes);
|
||||
//const contentStr = new TextDecoder().decode(bytes);
|
||||
newConfig = JSON.parse(contentStr);
|
||||
} catch (err) {
|
||||
logError(err, '[contest-lock] config file');
|
||||
return;
|
||||
}
|
||||
if (!(typeof newConfig === 'object' && newConfig != null)) {
|
||||
extLogError('config file: invalid format');
|
||||
return;
|
||||
}
|
||||
if (typeof newConfig.title !== 'string') {
|
||||
extLogError('config file: "title" must be a string');
|
||||
return;
|
||||
}
|
||||
if (typeof newConfig.message !== 'string') {
|
||||
extLogError('config file: "message" must be a string');
|
||||
return;
|
||||
}
|
||||
if (
|
||||
typeof newConfig.startTime !== 'string' ||
|
||||
!/^\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d\+\d\d:\d\d$/.test(newConfig.startTime)
|
||||
) {
|
||||
extLogError('config file: "startTime" must be a string with format 0000-00-00T00:00:00+00:00');
|
||||
return;
|
||||
}
|
||||
async function loadConfig () {
|
||||
configLoadCancellable?.cancel();
|
||||
configLoadCancellable = new Gio.Cancellable();
|
||||
|
||||
extLog('Loaded new config.')
|
||||
config = newConfig;
|
||||
startTime = (new Date(newConfig.startTime)).getTime();
|
||||
// If there is a poblem with the config file, log an error and keep
|
||||
// using the old config.
|
||||
let newConfig;
|
||||
try {
|
||||
const [ok, bytes] = await configFile.load_contents(configLoadCancellable);
|
||||
const contentStr = new TextDecoder().decode(bytes);
|
||||
newConfig = JSON.parse(contentStr);
|
||||
} catch (err) {
|
||||
logError(err, '[contest-lock] config file');
|
||||
return;
|
||||
}
|
||||
if (typeof newConfig !== 'object' || newConfig == null) {
|
||||
extLogError('config file: invalid format');
|
||||
return;
|
||||
}
|
||||
if (typeof newConfig.title !== 'string') {
|
||||
extLogError('config file: "title" must be a string');
|
||||
return;
|
||||
}
|
||||
if (typeof newConfig.message !== 'string') {
|
||||
extLogError('config file: "message" must be a string');
|
||||
return;
|
||||
}
|
||||
if (
|
||||
typeof newConfig.startTime !== 'string' ||
|
||||
!/^\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d\+\d\d:\d\d$/.test(newConfig.startTime)
|
||||
) {
|
||||
extLogError('config file: "startTime" must be a string with format 0000-00-00T00:00:00+00:00');
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
syncActive();
|
||||
});
|
||||
extLog('Loaded new config.')
|
||||
config = newConfig;
|
||||
startTime = (new Date(newConfig.startTime)).getTime();
|
||||
|
||||
updateConfig();
|
||||
syncActive();
|
||||
}
|
||||
|
||||
function syncActive () {
|
||||
|
|
@ -190,7 +195,7 @@ function updateBackgrounds () {
|
|||
effect: new Shell.BlurEffect({
|
||||
name: 'blur',
|
||||
brightness: BLUR_BRIGHTNESS,
|
||||
sigma: BLUR_SIGMA,
|
||||
radius: BLUR_RADIUS,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -382,7 +387,9 @@ function deactivate () {
|
|||
isActiveChanging = false;
|
||||
}
|
||||
|
||||
function init (extension) {
|
||||
var isInitialized = false;
|
||||
|
||||
function init () {
|
||||
actor = Main.layoutManager.screenShieldGroup;
|
||||
|
||||
const userName = GLib.get_user_name();
|
||||
|
|
@ -395,7 +402,7 @@ function init (extension) {
|
|||
|
||||
Main.layoutManager.connect('monitors-changed', updateBackgrounds);
|
||||
|
||||
cursorTracker = Meta.CursorTracker.get_for_display(global.display);
|
||||
cursorTracker = global.backend.get_cursor_tracker();
|
||||
|
||||
if (!Main.layoutManager._startingUp) {
|
||||
isShellReady = true;
|
||||
|
|
@ -406,19 +413,6 @@ function init (extension) {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: When we drop compatibility with gnome <42, remove this code,
|
||||
// rename the stylesheet back to stylesheet.css (so that it is loaded
|
||||
// by the extension system) and add a session-modes property which
|
||||
// includes unlock-dialog to metadata.json.
|
||||
const theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
|
||||
const stylesheetFile = extension.dir.get_child('stylesheet-always.css');
|
||||
theme.load_stylesheet(stylesheetFile);
|
||||
|
||||
// TODO: When we drop compatibility with gnome <42, remove this code.
|
||||
// gnome 38 has a bug that causes extensions to break when running
|
||||
// `dconf update` while the screen is locked.
|
||||
Main.extensionManager.reloadExtension = function () {};
|
||||
|
||||
configFile = Gio.File.new_for_path('/etc/contest-lock.json');
|
||||
configMonitor = configFile.monitor_file(Gio.FileMonitorFlags.NONE, null);
|
||||
configMonitor.set_rate_limit(1000);
|
||||
|
|
@ -426,12 +420,18 @@ function init (extension) {
|
|||
loadConfig();
|
||||
}
|
||||
|
||||
function enable () {
|
||||
isExtensionEnabled = true;
|
||||
syncActive();
|
||||
}
|
||||
export default class ContestLockExtension extends Extension {
|
||||
enable () {
|
||||
if (!isInitialized) {
|
||||
init();
|
||||
isInitialized = true;
|
||||
}
|
||||
isExtensionEnabled = true;
|
||||
syncActive();
|
||||
}
|
||||
|
||||
function disable () {
|
||||
isExtensionEnabled = false;
|
||||
syncActive();
|
||||
disable () {
|
||||
isExtensionEnabled = false;
|
||||
syncActive();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"uuid": "contest-lock@soi.ch",
|
||||
"name": "Contest lock screen",
|
||||
"description": "A custom lock screen for contests.",
|
||||
"shell-version": [ "3.38", "42", "43" ],
|
||||
"session-modes": [ "user", "unlock-dialog" ],
|
||||
"shell-version": [ "48" ],
|
||||
"url": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
.contest-lock-stack {
|
||||
color: white;
|
||||
text-align: center;
|
||||
spacing: 24px;
|
||||
spacing: 32px;
|
||||
}
|
||||
|
||||
.contest-lock-countdown {
|
||||
font-size: 64pt;
|
||||
font-size: 96pt;
|
||||
font-weight: 300;
|
||||
font-feature-settings: "tnum"; /* tabular figures */
|
||||
}
|
||||
|
||||
.contest-lock-title {
|
||||
font-size: 16pt;
|
||||
font-size: 24pt;
|
||||
}
|
||||
|
||||
.contest-lock-user {
|
||||
font-size: 20pt;
|
||||
font-size: 32pt;
|
||||
}
|
||||
|
||||
.contest-lock-message {
|
||||
padding-top: 24px;
|
||||
font-size: 16pt;
|
||||
padding-top: 32px;
|
||||
font-size: 24pt;
|
||||
}
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
const { St, Clutter, GLib, Gio, AccountsService } = imports.gi;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
import AccountsService from 'gi://AccountsService';
|
||||
import Clutter from 'gi://Clutter';
|
||||
import GLib from 'gi://GLib';
|
||||
import St from 'gi://St';
|
||||
|
||||
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
|
||||
let panelBin;
|
||||
let userLabel;
|
||||
|
|
@ -11,29 +17,33 @@ function updateUser () {
|
|||
if (realName != null) userLabel.text = realName;
|
||||
}
|
||||
|
||||
function init () {
|
||||
panelBin = new St.Bin({
|
||||
style_class: 'panel-bin',
|
||||
});
|
||||
userLabel = new St.Label({
|
||||
text: 'No user',
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
panelBin.set_child(userLabel);
|
||||
export default class UserIndicatorExtension extends Extension {
|
||||
constructor(metadata) {
|
||||
super(metadata);
|
||||
|
||||
const userName = GLib.get_user_name();
|
||||
user = AccountsService.UserManager.get_default().get_user(userName);
|
||||
if (!user) return;
|
||||
panelBin = new St.Bin({
|
||||
style_class: 'panel-bin',
|
||||
});
|
||||
userLabel = new St.Label({
|
||||
text: 'No user',
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
panelBin.set_child(userLabel);
|
||||
|
||||
user.connect('notify::is-loaded', updateUser);
|
||||
user.connect('changed', updateUser);
|
||||
updateUser();
|
||||
}
|
||||
|
||||
function enable () {
|
||||
Main.panel._rightBox.insert_child_at_index(panelBin, 0);
|
||||
}
|
||||
|
||||
function disable () {
|
||||
Main.panel._rightBox.remove_child(panelBin);
|
||||
const userName = GLib.get_user_name();
|
||||
user = AccountsService.UserManager.get_default().get_user(userName);
|
||||
if (!user) return;
|
||||
|
||||
user.connect('notify::is-loaded', updateUser);
|
||||
user.connect('changed', updateUser);
|
||||
updateUser();
|
||||
}
|
||||
|
||||
enable () {
|
||||
Main.panel._rightBox.insert_child_at_index(panelBin, 0);
|
||||
}
|
||||
|
||||
disable () {
|
||||
Main.panel._rightBox.remove_child(panelBin);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
"uuid": "user-indicator@soi.ch",
|
||||
"name": "User indicator",
|
||||
"description": "Shows the user's real name in the top bar.",
|
||||
"shell-version": [ "3.38", "42", "43" ],
|
||||
"shell-version": [ "48" ],
|
||||
"url": ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue