Commit Graph

91 Commits

Author SHA1 Message Date
Andrea Azzarone
f3168d22a6 shellDBus: Add grabFlags parameter
Add an grabFlags parameter to the GrabAccelerator and GrabAccelerators dbus
methods. This will allow e.g. Gnome Settings Daemon to create shortcuts that
should discard key-repeated events.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/156

Fixes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/68
2019-02-20 14:17:46 +01:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01:00
Florian Müllner
a1534dab02 cleanup: Clean up unused imports
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 05:05:07 +01:00
Florian Müllner
bacfdbbb03 cleanup: Port non-GObject classes to JS6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Florian Müllner
94423151b2 dbus: Move all interface descriptions into the resource
https://gitlab.gnome.org/GNOME/gnome-shell/issues/537
2018-09-17 07:34:49 +00:00
Marco Trevisan (Treviño)
dbf993300a js: use ES6 template strings for dbus interfaces
Use multiline template strings for dbus interfaces as they're easier to maintain
2018-08-27 19:23:00 +02:00
Florian Müllner
d908940ef3 showOSD: Fix handling of defined 'falsy' parameters
For the OSD, all parameters except for the icon are optional - if the
caller doesn't include the 'label' option, the OSD won't show a label
etc.

While this makes sense for an API, it means that we have to be careful
to correctly differentiate an option that was omitted and an option
that has a 'falsy' value like false or 0.

Unfortunately since commit ccaae5d3c we no longer do, with the result
that OSDs meant for the first monitor will show up on all, and a level
of 0 is presented as no level bar instead of an empty one, whoops.

https://bugzilla.gnome.org/show_bug.cgi?id=791669
2018-08-01 13:58:23 +02:00
Didier Roche
aa75e89216 osdWindow: Allow levels above 100%
Allow osd representing levels that can be more than 100% by accepting
an optional parameter setting that maximum level.
gnome-settings-daemon will use this to indicate volume levels above 100%,
which our own volume indicator will soon support as well.
2018-07-31 18:14:11 +00:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
ccaae5d3cc shellDBus: Avoid access to undefined properties
Don't rely on an implicit undefined value of unset parameters to
shut up some warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
2017-07-13 17:23:54 +02:00
Jonas Ådahl
4cd4678194 Add ShowMonitorLabels2 D-Bus API
Add a new D-Bus method for setting the monitor labels. This new method
takes connector names instead of output ids for associating with actual
monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:35 +08:00
Rui Matos
1900468846 Add an OSD monitor labeler exposed on DBus
This DBus API is intended to be used by gnome-control-center's
displays panel to show monitor labels.

Each output (i.e. hardware monitor) identified by its
org.gnome.Mutter.DisplayConfig API ID has at most one label. On
mirrored setups, all the labels for outputs corresponding to the same
logical monitor (i.e. showing the same contents in the same mode) are
shown together.

At most, only one DBus client at a time is allowed to show labels.

https://bugzilla.gnome.org/show_bug.cgi?id=743744
2015-02-05 13:34:52 +01:00
Florian Müllner
6803528810 shellDBus: Add mode parameter to AcceleratorActivated signal
This will allow g-s-d to handle actions differently based on the
current mode - namely, allow the power button when locked, but
make sure to never show any dialogs in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=711682
2014-12-19 14:11:55 +01:00
Florian Müllner
2aa4fb02dd shellDBus: Change AcceleratorActivated signature
Adding new parameters to the signal currently will break keybindings
until gnome-settings-daemon is updated to the new API as well.
Put additional parameters into a dictionary instead to make future
extensions easier.

https://bugzilla.gnome.org/show_bug.cgi?id=711682
2014-12-19 14:11:55 +01:00
Colin Walters
891f30ff63 shellDBus: Emit a PropertyChanged for OverviewActive
I was going to add another DBus property to signal when the shell was
done loading and was idle, and while implementing that I noticed we
aren't emitting PropertyChanged for, well, any property.  Let's fix
OverviewActive.

It's unfortunate it's so tedious to correctly implement a DBus
property =/

https://bugzilla.gnome.org/show_bug.cgi?id=704163
2014-11-13 18:17:57 +00:00
Cosimo Cecchi
45e42d7b9e shellDBus: don't consider a zero-index monitor invalid
Currently, shellDBus only uses the passed in monitor index if it's
strictly > 0. A zero-index monitor is a valid one though, so don't
restrict this to strictly positive indices.

https://bugzilla.gnome.org/show_bug.cgi?id=740074
2014-11-13 10:05:59 -08:00
Adel Gadllah
5c3f9f6999 osdWindow: Show on all monitors
We had one osdWindow that we displayed either on the primary monitor or on
whatever monitor index got passed over dbus.

Change that to show the osd on all monitors when no explicit monitor is
requested. A monitor should be requested in cases like display brightness where it makes sense to only show the osd on the affected monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=722684
2014-04-17 15:15:14 +02:00
Giovanni Campagna
edd66c40d9 ScreenShield: send a signal to GSD to wake up the screen
Instead of poking through IDLETIME, which confuses the state tracking
and can prevent automatic suspend, send a special signal to GSD
when the screen is to be waken up for a notification.

Someday we'll bring over all the state tracking and avoid this
ping-pong between gnome-shell and gnome-settings-daemon, but
that day's not today.

https://bugzilla.gnome.org/show_bug.cgi?id=712706
2014-03-11 18:10:05 +01:00
Florian Müllner
2d24536caf shellDBus: Fix LaunchExtensionPreferences()
Commit 5dedc5d8ba removed "unused" functionality which was
still used by that method. Launch it via GAppInfo instead, which
still supports passing URIs.

https://bugzilla.gnome.org/show_bug.cgi?id=724813
2014-02-20 20:27:02 +01:00
Giovanni Campagna
bfb0235fc6 Remove our custom hashmap implementation
gjs uses Spidermonkey 24, which implements Map from the ES6
specification, so we can use that instead.

https://bugzilla.gnome.org/show_bug.cgi?id=722210
2014-01-15 00:55:00 +01:00
Carlos Garnacho
4b90953226 osdWindow: add setMonitor() to allow changing the monitor
This is also exposed in the ShowOSD DBus method, the "monitor"
parameter may contain an integer to indicate the monitor number.
If the value is not provided or <0 is used, the monitor is shown
on the primary monitor as usually.

This way, the OSD can be used to notify upon events that solely
apply to one monitor, like tablet mapping as discussed in
https://bugzilla.gnome.org/show_bug.cgi?id=710373.

https://bugzilla.gnome.org/show_bug.cgi?id=712664
2013-11-20 18:03:32 +01:00
Jasper St. Pierre
e12bf8daed shellDBus: Fix error message returned from Eval
Annoyingly, `message` on errors are non-enumerable, which mean that
JSON.stringify on the error will produce `{}`. Just cast it to a string
for now.
2013-11-13 15:15:03 -05:00
Tim Lunn
b908a3d70a Stringify the xml definitions for E4X removal
https://bugzilla.gnome.org/show_bug.cgi?id=691409
2013-10-25 08:57:27 +11:00
Giovanni Campagna
9c814d1584 ShellDBus: add ShowApplications method
Add a method to control the visibility of the applications view.
This can used by gnome-settings-daemon for special keys in
certain keyboards.

https://bugzilla.gnome.org/show_bug.cgi?id=698743
2013-09-02 11:02:18 +02:00
Giovanni Campagna
415563dc6e Add a FocusApp method to org.gnome.Shell
This method, which accepts a .desktop filename, is used to highlight
a specific application in the overview, for example because it has
just been created or installed.

https://bugzilla.gnome.org/show_bug.cgi?id=654086
2013-09-02 10:51:00 +02:00
Jasper St. Pierre
d4942858ba Add a screencast indicator for when we're recording
This will replace the indicator painted on the stage right now.

This unfortunately does not work for the recorder triggered by the
keybinding -- we'll simply replace the in-shell code with a keybinding
powered by gnome-settings-daemon.
2013-08-14 20:39:07 -04:00
Bastien Nocera
db497a2ecf shellDBus: Export the timestamp of shortcuts through D-Bus
So that apps launched through gnome-settings-daemon can get
focused properly.

https://bugzilla.gnome.org/show_bug.cgi?id=704859
2013-07-25 14:55:25 +02:00
Florian Müllner
434f1edb25 overview: Add focusSearch() method and export it over DBus
Some keyboard spot a dedicated search key, which gnome-settings-daemon
currently handles by spawning gnome-search-tool. It makes a lot of
sense to promote the Shell's integrated search feature instead, so
expose an appropriate DBus method g-s-d can use.

https://bugzilla.gnome.org/show_bug.cgi?id=700536
2013-05-17 18:27:17 +02:00
Florian Müllner
24c530611f Expose screencast functionality via DBus
Like screenshots, the screen recorder can be a useful tool in other cases
than being triggered by a keyboard shortcut. To account for that, export
a Screencast DBus API similar to the existing Screenshot interface.

https://bugzilla.gnome.org/show_bug.cgi?id=696247
2013-05-10 19:49:01 +02:00
Florian Müllner
39426f03e6 shellDBus: Fix Eval() return value when disabled
Eval() is expected to return a boolean success value and a string result.
However when the function is disabled (via the development-tools setting),
we return null for the latter which is not a valid string value.
Return an empty string instead.

https://bugzilla.gnome.org/show_bug.cgi?id=698959
2013-04-26 17:32:52 +02:00
Colin Walters
512f0a67fb shellDBus: Fix SetActive(false) for ScreenSaver DBus API
Someone changed .unlock() to deactivate() for the obvious symmetry
with activate(), but forgot to update it here.

https://bugzilla.gnome.org/show_bug.cgi?id=696585
2013-03-29 10:13:24 -04:00
Florian Müllner
90ea27c423 shellDBus: Export ShowOSD() method on the bus
Export a simple method to trigger an OSD popup. gnome-settings-daemon
will use this to replace its own OSD UI.

https://bugzilla.gnome.org/show_bug.cgi?id=613543
2013-03-03 12:59:09 +01:00
Florian Müllner
81e01b6f88 shellDBus: Add methods to handle key grabs
Expose Mutter's external grab API on the bus, so gnome-settings-daemon
can refer keygrabbing to the shell.

https://bugzilla.gnome.org/show_bug.cgi?id=643111
2013-03-01 16:14:30 +01:00
Daniel Mustieles
a1d37617a8 Fixed typo in string. Fixes bug #687248 2013-02-25 14:27:31 +01:00
Giovanni Campagna
ae0accb5a4 ScreenShield: separate notifications for active and locked
Now that we have an explicit active-but-not-locked state, we should
use different signals to notify changes. lock-status-changed is
renamed to active-changed, and a new locked-changed is introduced.

https://bugzilla.gnome.org/show_bug.cgi?id=693007
2013-02-03 14:59:58 +01:00
Giovanni Campagna
644b8304ab ScreenShield: fix wrong signal value in ActiveChanged
ActiveChanged should be about active, not locked.

https://bugzilla.gnome.org/show_bug.cgi?id=691964
2013-01-31 18:25:31 +01:00
Giovanni Campagna
9a25224890 ScreenShield: lower the shield when the user is idle but before locking
In time span between idle and lock the shield should behave like autologin,
but should prevent accidental reactivation (for example when using a touch
screen) by showing the curtain.

https://bugzilla.gnome.org/show_bug.cgi?id=692560
2013-01-31 14:10:20 +01:00
Cosimo Cecchi
57bd43baf3 screenshot: move to a separate interface
Since we're breaking API already, take this as an occasion to use a
separate interface for all the screenshot-related methods. The interface
name is org.gnome.Shell.Screenshot.
Internally, move all the related code to screenshot.js.

https://bugzilla.gnome.org/show_bug.cgi?id=688004
2013-01-03 12:56:45 +01:00
Cosimo Cecchi
dcad22bfa8 screenshot: change API to return the filename used for saving
Since we also support passing a basename now, clients might be
interested in knowing the path used to save the file.
Add an out argument to the interface for that.

https://bugzilla.gnome.org/show_bug.cgi?id=688004
2013-01-03 12:56:45 +01:00
Cosimo Cecchi
acba0e47d8 screenshot: support non-absolute paths when saving screenshots
If a non-absolute path is passed to the screenshot methods, treat it as
a basename for the output image, and automatically try to save it in
$XDG_PICTURES_DIR, falling back to $HOME if it doesn't exist.

https://bugzilla.gnome.org/show_bug.cgi?id=688004
2013-01-03 12:56:45 +01:00
Cosimo Cecchi
dd19459e18 Add a SelectArea() DBus method
This will be useful for e.g. selecting an area for a screenshot.

https://bugzilla.gnome.org/show_bug.cgi?id=687954
2013-01-03 12:56:45 +01:00
Debarshi Ray
d4dc1c87c5 dbus: Add a read-only org.gnome.Shell.Mode property
This is meant to expose the global.session_mode to applications such
as the gnome-tweak-tool, which would need it to differentiate between
the vanilla GNOME Shell mode and the fallback replacement mode.

https://bugzilla.gnome.org/show_bug.cgi?id=689300
2012-11-30 17:28:34 +01:00
Cosimo Cecchi
123fb350ce screenshot: don't fire flash if we failed to take picture
https://bugzilla.gnome.org/show_bug.cgi?id=688004
2012-11-26 14:09:07 -05:00
Giovanni Campagna
2a8a8065a8 ScreenShield: implement o.g.ScreenSaver.GetActiveTime
Part of the old gnome-screensaver interface, returns the number of seconds
that the screensaver has been active for.

https://bugzilla.gnome.org/show_bug.cgi?id=686064
2012-10-18 15:30:40 +02:00
Matthias Clasen
a7d344d287 Make org.gnome.ScreenSaver.SetActive work
The interface was declared to take an unsigned integer instead
of a boolean, as gnome-screensaver does. Due to this,
gnome-screensaver-command --activate or --deactivate does not
work when used with gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=686063
2012-10-13 21:07:08 -04:00
Giovanni Campagna
de93677271 Allow the shell to run without the screenshield
The screenshield requires gdm 3.5, which can be problematic in
jhbuild configurations, or distributions that don't use GDM as the display
manager. Allow transparent fallback to gnome-screensaver in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=683060
2012-09-18 20:25:09 +02:00
Giovanni Campagna
8cf9baa132 ScreenShield: move lock status handling to use session mode
Have distinct session modes for the lock screen and the unlock dialog,
and rework the logic in ScreenShield to have the lock-screen mode stack
onto the unlock-dialog mode (where applicable)

https://bugzilla.gnome.org/show_bug.cgi?id=682542
2012-09-10 21:23:25 +02:00