.settings
browser-plugin
data
docs
js
extensionPrefs
gdm
misc
perf
ui
components
__init__.js
automountManager.js
autorunManager.js
keyring.js
networkAgent.js
polkitAgent.js
recorder.js
telepathyClient.js
status
altTab.js
appDisplay.js
appFavorites.js
boxpointer.js
calendar.js
checkBox.js
ctrlAltTab.js
dash.js
dateMenu.js
dnd.js
endSessionDialog.js
environment.js
extensionDownloader.js
extensionSystem.js
flashspot.js
grabHelper.js
ibusCandidatePopup.js
iconGrid.js
keyboard.js
layout.js
lightbox.js
lookingGlass.js
magnifier.js
magnifierDBus.js
main.js
messageTray.js
modalDialog.js
notificationDaemon.js
overview.js
panel.js
panelMenu.js
pointerWatcher.js
popupMenu.js
remoteSearch.js
runDialog.js
screenShield.js
scripting.js
search.js
searchDisplay.js
sessionMode.js
shellDBus.js
shellEntry.js
shellMountOperation.js
tweener.js
unlockDialog.js
userMenu.js
viewSelector.js
wanda.js
windowAttentionHandler.js
windowManager.js
workspace.js
workspaceSwitcherPopup.js
workspaceThumbnail.js
workspacesView.js
xdndHandler.js
Makefile.am
man
po
src
tests
tools
.gitignore
.project
AUTHORS
COPYING
HACKING
MAINTAINERS
Makefile.am
NEWS
README
autogen.sh
configure.ac
gnome-shell.doap

The filename property is actually a template string with substitution variables, not a filename. This commit renames for clarity. https://bugzilla.gnome.org/show_bug.cgi?id=680647
59 lines
2.1 KiB
JavaScript
59 lines
2.1 KiB
JavaScript
|
|
const Lang = imports.lang;
|
|
|
|
const Gio = imports.gi.Gio;
|
|
const Meta = imports.gi.Meta;
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const Recorder = new Lang.Class({
|
|
Name: 'Recorder',
|
|
|
|
_init: function() {
|
|
this._recorderSettings = new Gio.Settings({ schema: 'org.gnome.shell.recorder' });
|
|
this._desktopLockdownSettings = new Gio.Settings({ schema: 'org.gnome.desktop.lockdown' });
|
|
this._bindingSettings = new Gio.Settings({ schema: 'org.gnome.shell.keybindings' });
|
|
this._recorder = null;
|
|
},
|
|
|
|
enable: function() {
|
|
global.display.add_keybinding('toggle-recording',
|
|
this._bindingSettings,
|
|
Meta.KeyBindingFlags.NONE, Lang.bind(this, this._toggleRecorder));
|
|
},
|
|
|
|
disable: function() {
|
|
global.display.remove_keybinding('toggle-recording');
|
|
},
|
|
|
|
_ensureRecorder: function() {
|
|
if (this._recorder == null)
|
|
this._recorder = new Shell.Recorder({ stage: global.stage });
|
|
return this._recorder;
|
|
},
|
|
|
|
_toggleRecorder: function() {
|
|
let recorder = this._ensureRecorder();
|
|
if (recorder.is_recording()) {
|
|
recorder.close();
|
|
Meta.enable_unredirect_for_screen(global.screen);
|
|
} else if (!this._desktopLockdownSettings.get_boolean('disable-save-to-disk')) {
|
|
// read the parameters from GSettings always in case they have changed
|
|
recorder.set_framerate(this._recorderSettings.get_int('framerate'));
|
|
/* Translators: this is a filename used for screencast recording */
|
|
// xgettext:no-c-format
|
|
recorder.set_file_template(_("Screencast from %d %t") + '.' + this._recorderSettings.get_string('file-extension'));
|
|
let pipeline = this._recorderSettings.get_string('pipeline');
|
|
|
|
if (!pipeline.match(/^\s*$/))
|
|
recorder.set_pipeline(pipeline);
|
|
else
|
|
recorder.set_pipeline(null);
|
|
|
|
Meta.disable_unredirect_for_screen(global.screen);
|
|
recorder.record();
|
|
}
|
|
}
|
|
});
|
|
|
|
const Component = Recorder;
|