diff --git a/data/theme/cinnamon-sass/widgets/_screensaver.scss b/data/theme/cinnamon-sass/widgets/_screensaver.scss index 1a8f0f28b3..2d10f88335 100644 --- a/data/theme/cinnamon-sass/widgets/_screensaver.scss +++ b/data/theme/cinnamon-sass/widgets/_screensaver.scss @@ -7,128 +7,114 @@ background-color: black; } + .icon-button { + padding: to_em(16px); + border: 1px solid transparentize($fg_color, 0.9); + background-color: transparentize($fg_color, 0.85); + margin-left: $base_padding; + margin-right: $base_padding; + } + + .prompt-dialog { + width: 34em; + background-color: transparent; + border: none; + padding: 0; + spacing: $base_padding * 4; + + .user-widget-label { + font-weight: 400; + @include fontsize(20pt); + margin-bottom: .75em; + } + + .user-icon { + icon-size: 128px; + border: 2px solid $borders_color; + + & StIcon { padding: $base_padding * 5; } + } + + &-password-entry { + @extend %entry; + width: 20em; + background-color: transparentize($fg_color, 0.8); + border-color: transparentize($fg_color, 0.6); + } + } + // Clock widget .clock-widget { - padding: 6px; - spacing: 6px; + padding: $base_padding; + spacing: $base_padding; .clock-time-label { - font-size: 50pt; - font-weight: bold; + @include fontsize(72pt); + color: white; - text-align: center; - text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); } .clock-date-label { - font-size: 24pt; - font-weight: bold; + @extend %title_1; + color: white; - text-align: center; - text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); } .clock-message-label { font-size: 14pt; - font-weight: bold; color: #cccccc; - text-align: center; - text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); margin-top: $base_margin; } .clock-message-author { font-size: 12pt; - font-weight: bold; color: #acacac; text-align: center; - text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); } } // Album art widget .albumart-widget { - padding: 10px; - spacing: 8px; - - .albumart-info-container { - background-color: $bg_color; - border-radius: 0; - border: 1px solid $borders_color; - spacing: $base_margin * 2; - min-width: 220px; - - &:awake { - border-radius: 0 0 $modal_dialog_radius $modal_dialog_radius; - } + padding: $base_padding * 2; + spacing: $base_padding * 2; + min-width: 400px; + background-color: transparentize($fg_color, 0.85); + border: 1px solid transparentize($fg_color, 0.9); + border-radius: $modal_dialog_radius; - .albumart-cover-bin { - padding: 8px; - background-color: $bg_color; - } + .albumart-track-info-box { + spacing: $base_padding / 2; + max-width: 300px; - .albumart-track-info-overlay { - spacing: 2px; - padding: 6px 6px; - background-gradient-direction: vertical; - background-gradient-start: transparentize($bg_color, 0.4); - background-gradient-end: $bg_color; - - .albumart-title-overlay { - font-size: 11pt; - font-weight: bold; - text-align: center; - color: white; - text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); - } + .albumart-title { + @extend %title_3; - .albumart-artist-overlay { - font-size: 10pt; - text-align: center; - color: rgba(255, 255, 255, 0.9); - text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); - } + font-weight: bold; + } - .albumart-album-overlay { - font-size: 10pt; - text-align: center; - color: rgba(255, 255, 255, 0.8); - text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); - } + .albumart-artist { + @extend %title_4; + } + + .albumart-album { + @extend %heading; } .albumart-controls { - spacing: 8px; - - .albumart-control-button { - width: 36px; - height: 36px; - border-radius: 18px; - background-color: transparentize($fg_color, 0.9); - - &:hover { - background-color: transparentize($fg_color, 0.8); - } - - &:active { - background-color: transparentize($fg_color, 0.7); - } - - &:insensitive { - color: transparentize($fg_color, 0.7); - background-color: transparentize($fg_color, 0.95); - } - - StIcon { - icon-size: 20px; - } + spacing: $base_padding; + padding-top: $base_padding; + + .icon-button { + padding: to_em(8px); + border: 1px solid transparentize($fg_color, 0.9); + background-color: transparentize($fg_color, 0.85); } } .albumart-volume-box { - spacing: 8px; + spacing: $base_padding; .albumart-volume-icon { icon-size: 16px; @@ -136,7 +122,7 @@ .albumart-volume-slider { height: 20px; - min-width: 150px; + min-width: 280px; -slider-height: 4px; -slider-background-color: transparentize($fg_color, 0.8); -slider-border-color: transparent; @@ -180,20 +166,4 @@ } } } - - // On-screen keyboard toggle - - .osk-activate-button { - @extend %button; - - border-radius: 9999px; - padding: $base_padding; - min-height: 16px; - - StIcon { - icon-size: 24px; - } - - &.flat { @extend %flat_button; } - } } diff --git a/js/ui/screensaver/albumArtWidget.js b/js/ui/screensaver/albumArtWidget.js index d65985eabf..756fe1488f 100644 --- a/js/ui/screensaver/albumArtWidget.js +++ b/js/ui/screensaver/albumArtWidget.js @@ -19,15 +19,14 @@ const SignalManager = imports.misc.signalManager; const Slider = imports.ui.slider; const SCREENSAVER_SCHEMA = 'org.cinnamon.desktop.screensaver'; -const ALBUM_ART_SIZE_BASE = 300; -const CONTROL_ICON_SIZE_BASE = 24; +const ALBUM_ART_SIZE_BASE = 110; +const CONTROL_ICON_SIZE_BASE = 16; var AlbumArtWidget = GObject.registerClass( class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { _init() { super._init({ style_class: 'albumart-widget', - vertical: true, x_expand: false, y_expand: false }); @@ -153,43 +152,25 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { } _buildUI() { - this._infoContainer = new St.BoxLayout({ - style_class: 'albumart-info-container', - vertical: true, - x_align: Clutter.ActorAlign.CENTER - }); - this.add_child(this._infoContainer); - - // Art container using FixedLayout to overlay track info on album art - this._artContainer = new St.Widget({ - layout_manager: new Clutter.FixedLayout(), - width: this._artSize, - height: this._artSize - }); - this._infoContainer.add_child(this._artContainer); - this._artBin = new St.Bin({ style_class: 'albumart-cover-bin', width: this._artSize, height: this._artSize }); - this._artContainer.add_child(this._artBin); + this.add_child(this._artBin); this._showDefaultArt(); - // Track info overlay - anchored to bottom of album art this._trackInfoBox = new St.BoxLayout({ - style_class: 'albumart-track-info-overlay', + style_class: 'albumart-track-info-box', vertical: true, - width: this._artSize + x_expand: true, + y_expand: true, + y_align: Clutter.ActorAlign.CENTER, }); - - this._trackInfoBox.connect('notify::height', () => { - this._trackInfoBox.set_position(0, this._artSize - this._trackInfoBox.height); - }); - this._artContainer.add_child(this._trackInfoBox); + this.add_child(this._trackInfoBox); this._titleLabel = new St.Label({ - style_class: 'albumart-title-overlay', + style_class: 'albumart-title', x_align: Clutter.ActorAlign.CENTER }); this._titleLabel.clutter_text.ellipsize = Pango.EllipsizeMode.END; @@ -197,7 +178,7 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { this._trackInfoBox.add_child(this._titleLabel); this._artistLabel = new St.Label({ - style_class: 'albumart-artist-overlay', + style_class: 'albumart-artist', x_align: Clutter.ActorAlign.CENTER }); this._artistLabel.clutter_text.ellipsize = Pango.EllipsizeMode.END; @@ -205,7 +186,7 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { this._trackInfoBox.add_child(this._artistLabel); this._albumLabel = new St.Label({ - style_class: 'albumart-album-overlay', + style_class: 'albumart-album', x_align: Clutter.ActorAlign.CENTER }); this._albumLabel.clutter_text.ellipsize = Pango.EllipsizeMode.END; @@ -236,11 +217,12 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { ); this._controlsBox.add_child(this._nextButton); - this._infoContainer.add_child(this._controlsBox); + this._trackInfoBox.add_child(this._controlsBox); this._volumeBox = new St.BoxLayout({ style_class: 'albumart-volume-box', - x_align: Clutter.ActorAlign.CENTER + x_align: Clutter.ActorAlign.START, + x_expand: true, }); this._volumeIcon = new St.Icon({ @@ -255,10 +237,7 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { this._volumeSlider.connect('value-changed', this._onVolumeChanged.bind(this)); this._volumeBox.add_child(this._volumeSlider.actor); - this._infoContainer.add_child(this._volumeBox); - - this._controlsBox.hide(); - this._volumeBox.hide(); + this._trackInfoBox.add_child(this._volumeBox); } this.hide(); @@ -266,7 +245,7 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { _createControlButton(iconName, callback) { let button = new St.Button({ - style_class: 'albumart-control-button', + style_class: 'icon-button', can_focus: true, child: new St.Icon({ icon_name: iconName, @@ -579,22 +558,6 @@ class AlbumArtWidget extends ScreensaverWidget.ScreensaverWidget { this._cleanupTempFile(); } - onAwake() { - if (this._allowMediaControl && this._controlsBox) { - this._controlsBox.show(); - this._volumeBox.show(); - this._infoContainer.add_style_pseudo_class('awake'); - } - } - - onSleep() { - if (this._allowMediaControl && this._controlsBox) { - this._controlsBox.hide(); - this._volumeBox.hide(); - this._infoContainer.remove_style_pseudo_class('awake'); - } - } - _cleanupTempFile() { if (this._coverFileTmp) { try { diff --git a/js/ui/screensaver/screenShield.js b/js/ui/screensaver/screenShield.js index 258f6a8d1b..0acc2e0742 100644 --- a/js/ui/screensaver/screenShield.js +++ b/js/ui/screensaver/screenShield.js @@ -169,15 +169,32 @@ var ScreenShield = GObject.registerClass({ this.add_child(this._keyboardBox); this._oskVisible = false; + this._bottomButtonLayout = new St.BoxLayout(); + this._keyboardBox.add_child(this._bottomButtonLayout); + this._oskButton = new St.Button({ - style_class: 'osk-activate-button', + style_class: 'icon-button', important: true, can_focus: true, reactive: true }); this._oskButton.set_child(new St.Icon({ icon_name: 'xsi-input-keyboard-symbolic' })); this._oskButton.connect('clicked', this._toggleScreensaverKeyboard.bind(this)); - this._keyboardBox.add_child(this._oskButton); + this._bottomButtonLayout.add_child(this._oskButton); + + this._screensaverSettings = new Gio.Settings({ schema_id: 'org.cinnamon.desktop.screensaver' }); + if (this._screensaverSettings.get_boolean('user-switch-enabled') && + !Main.lockdownSettings.get_boolean('disable-user-switching')) { + this._switchUserButton = new St.Button({ + style_class: 'icon-button', + important: true, + can_focus: true, + reactive: true, + icon_name: 'xsi-switch-user-symbolic', + }); + this._bottomButtonLayout.add_child(this._switchUserButton); + this._switchUserButton.connect('clicked', this._onSwitchUser.bind(this)); + } this._capturedEventId = 0; this._lastMotionX = -1; @@ -603,6 +620,10 @@ var ScreenShield = GObject.registerClass({ }); } + _onSwitchUser() { + Util.switchToGreeter(); + } + isLocked() { return this._state === State.LOCKED || this._state === State.UNLOCKING; } @@ -776,7 +797,7 @@ var ScreenShield = GObject.registerClass({ if (this._oskVisible) return; - this._oskButton.hide(); + this._bottomButtonLayout.hide(); Main.virtualKeyboardManager.openForScreensaver(this._keyboardBox, this); this._oskVisible = true; this._positionKeyboardBox(); @@ -789,7 +810,7 @@ var ScreenShield = GObject.registerClass({ Main.virtualKeyboardManager.closeForScreensaver(); this._oskVisible = false; - this._oskButton.show(); + this._bottomButtonLayout.show(); this._positionKeyboardBox(); this._positionUnlockDialog(); } @@ -814,8 +835,8 @@ var ScreenShield = GObject.registerClass({ keyboard.height = height; } } else { - let [, natWidth] = this._oskButton.get_preferred_width(-1); - let [, natHeight] = this._oskButton.get_preferred_height(natWidth); + let [, natWidth] = this._bottomButtonLayout.get_preferred_width(-1); + let [, natHeight] = this._bottomButtonLayout.get_preferred_height(natWidth); let padding = 24 * global.ui_scale; let x = monitor.x + (monitor.width - natWidth) / 2; diff --git a/js/ui/screensaver/unlockDialog.js b/js/ui/screensaver/unlockDialog.js index f38f9c4cb5..ddea5af9bb 100644 --- a/js/ui/screensaver/unlockDialog.js +++ b/js/ui/screensaver/unlockDialog.js @@ -117,64 +117,6 @@ class UnlockDialog extends St.BoxLayout { this._sourceChangedId = this._inputSourceManager.connect( 'current-source-changed', this._updateLayoutIndicator.bind(this)); - this._buttonLayout = new St.Widget({ - style_class: 'dialog-button-box', - important: true, - layout_manager: new Clutter.BoxLayout({ - homogeneous: true, - spacing: 12 * global.ui_scale - }) - }); - this._dialogBox.add(this._buttonLayout, { - x_align: St.Align.MIDDLE, - y_align: St.Align.MIDDLE - }); - - this._cancelButton = new St.Button({ - style_class: 'dialog-button', - important: true, - label: _("Cancel"), - reactive: true, - can_focus: true, - x_expand: true, - y_expand: true - }); - this._cancelButton.connect('clicked', this._onCancel.bind(this)); - this._buttonLayout.add_child(this._cancelButton); - - this._screensaverSettings = new Gio.Settings({ schema_id: 'org.cinnamon.desktop.screensaver' }); - if (this._screensaverSettings.get_boolean('user-switch-enabled') && - !Main.lockdownSettings.get_boolean('disable-user-switching')) { - this._switchUserButton = new St.Button({ - style_class: 'dialog-button', - important: true, - label: _("Switch User"), - can_focus: true, - reactive: true, - x_expand: true, - y_expand: true - }); - this._switchUserButton.connect('clicked', this._onSwitchUser.bind(this)); - this._buttonLayout.add_child(this._switchUserButton); - } - - this._unlockButton = new St.Button({ - style_class: 'dialog-button', - important: true, - label: _("Unlock"), - can_focus: true, - reactive: false, - x_expand: true, - y_expand: true - }); - this._unlockButton.add_style_pseudo_class('default'); - this._unlockButton.connect('clicked', this._onUnlock.bind(this)); - this._buttonLayout.add_child(this._unlockButton); - - this._passwordEntry.clutter_text.connect('text-changed', text => { - this._unlockButton.reactive = text.get_text().length > 0; - }); - this._authClient = new AuthClient.AuthClient(); this._authClient.connect('auth-success', this._onAuthSuccess.bind(this)); this._authClient.connect('auth-failure', this._onAuthFailure.bind(this)); @@ -348,10 +290,6 @@ class UnlockDialog extends St.BoxLayout { this._screenShield.hideUnlockDialog(); } - _onSwitchUser() { - Util.switchToGreeter(); - } - initializePam() { if (!this._authClient.initialized) return this._authClient.initialize(); @@ -362,11 +300,9 @@ class UnlockDialog extends St.BoxLayout { _setPasswordEntryVisible(visible) { if (visible) { this._passwordEntry.show(); - this._unlockButton.show(); this._capsLockWarning.show(); } else { this._passwordEntry.hide(); - this._unlockButton.hide(); this._capsLockWarning.hide(); } }