updated unite extension

This commit is contained in:
davedatum 2019-11-03 15:54:04 +00:00
parent df81cf0307
commit c0541c66f2
8 changed files with 68 additions and 36 deletions

View File

@ -10,5 +10,5 @@
], ],
"url": "https://github.com/hardpixel/unite-shell", "url": "https://github.com/hardpixel/unite-shell",
"uuid": "unite@hardpixel.eu", "uuid": "unite@hardpixel.eu",
"version": 33 "version": 34
} }

View File

@ -8,13 +8,12 @@ var ThemeMods = class ThemeMods extends Base {
_onInitialize() { _onInitialize() {
this.gtkSettings = Gtk.Settings.get_default() this.gtkSettings = Gtk.Settings.get_default()
this._extraSpace = minorVersion < 34 this._extraSpace = minorVersion < 34
this._mainStyle = Main.uiGroup.get_style()
this._panelStyle = Main.panel.get_style()
this._appMenu = Main.panel.statusArea.appMenu this._appMenu = Main.panel.statusArea.appMenu
this._aggMenu = Main.panel.statusArea.aggregateMenu this._aggMenu = Main.panel.statusArea.aggregateMenu
this._leftBox = Main.panel._leftBox this._leftBox = Main.panel._leftBox
this._centerBox = Main.panel._centerBox this._centerBox = Main.panel._centerBox
this._rightBox = Main.panel._rightBox this._rightBox = Main.panel._rightBox
this._uiStyles = {}
} }
_onActivate() { _onActivate() {
@ -75,7 +74,7 @@ var ThemeMods = class ThemeMods extends Base {
const gtkFont = this.gtkSettings.gtk_font_name const gtkFont = this.gtkSettings.gtk_font_name
const cssFont = gtkFont.replace(/\s\d+$/, '') const cssFont = gtkFont.replace(/\s\d+$/, '')
Main.uiGroup.set_style(`font-family: ${cssFont};`) this._addStyle('uiGroup', `font-family: ${cssFont};`)
this._addClass('system-fonts') this._addClass('system-fonts')
} }
@ -83,15 +82,15 @@ var ThemeMods = class ThemeMods extends Base {
this._addClass('small-spacing') this._addClass('small-spacing')
} }
Main.panel.set_style('font-size: 11.25pt;') this._addStyle('panel', 'font-size: 11.25pt;')
} }
_unsetPanelStyle() { _unsetPanelStyle() {
this._removeClass('small-spacing') this._removeClass('small-spacing')
this._removeClass('system-fonts') this._removeClass('system-fonts')
Main.uiGroup.set_style(this._mainStyle) this._removeStyle('uiGroup')
Main.panel.set_style(this._panelStyle) this._removeStyle('panel')
} }
_toggleAppMenuIcon() { _toggleAppMenuIcon() {
@ -207,4 +206,25 @@ var ThemeMods = class ThemeMods extends Base {
_removeClass(name) { _removeClass(name) {
Main.panel._removeStyleClassName(name) Main.panel._removeStyleClassName(name)
} }
_addStyle(name, style) {
this._uiStyles[name] = style
let widget = Main[name]
let styles = widget.get_style() || ''
widget.set_style(style + styles)
}
_removeStyle(name) {
let style = this._uiStyles[name]
if (!style) return
let widget = Main[name]
let styles = widget.get_style() || ''
widget.set_style(styles.replace(style, ''))
delete this._uiStyles[name]
}
} }

View File

@ -1,23 +1,22 @@
headerbar, window headerbar,
.titlebar { window .titlebar {
padding-left: 0; padding-left: 0;
} }
.titlebar headerbar ~ headerbar { window headerbar ~ headerbar,
window headerbar ~ .titlebar,
window .titlebar ~ .titlebar,
window .titlebar ~ headerbar {
padding-left: 6px; padding-left: 6px;
} }
.titlebar .titlebar { window headerbar > box.left,
padding-left: 0; window .titlebar > box.left {
}
headerbar > box.left,
.titlebar > box.left {
margin: 0 0 0 -200px; margin: 0 0 0 -200px;
opacity: 0; opacity: 0;
} }
.titlebar.default-decoration { window .titlebar.default-decoration {
margin: -200px 0 0; margin: -200px 0 0;
opacity: 0; opacity: 0;
} }

View File

@ -3,14 +3,13 @@
padding-left: 0; padding-left: 0;
} }
.tiled .titlebar headerbar ~ headerbar { .tiled headerbar ~ headerbar,
.tiled headerbar ~ .titlebar,
.tiled .titlebar ~ .titlebar,
.tiled .titlebar ~ headerbar {
padding-left: 6px; padding-left: 6px;
} }
.tiled .titlebar .titlebar {
padding-left: 0;
}
.tiled headerbar > box.left, .tiled headerbar > box.left,
.tiled .titlebar > box.left { .tiled .titlebar > box.left {
margin: 0 0 0 -200px; margin: 0 0 0 -200px;

View File

@ -3,14 +3,13 @@
padding-left: 0; padding-left: 0;
} }
.maximized .titlebar headerbar ~ headerbar { .maximized headerbar ~ headerbar,
.maximized headerbar ~ .titlebar,
.maximized .titlebar ~ .titlebar,
.maximized .titlebar ~ headerbar {
padding-left: 6px; padding-left: 6px;
} }
.maximized .titlebar .titlebar {
padding-left: 0;
}
.maximized headerbar > box.left, .maximized headerbar > box.left,
.maximized .titlebar > box.left { .maximized .titlebar > box.left {
margin: 0 0 0 -200px; margin: 0 0 0 -200px;

View File

@ -1,15 +1,20 @@
headerbar, window > headerbar,
.titlebar { window > .titlebar,
window > headerbar > headerbar,
window > .titlebar > .titlebar,
window > .titlebar > stack > headerbar,
window headerbar:last-child,
window .titlebar:last-child {
padding-right: 0; padding-right: 0;
} }
headerbar > box.right, window headerbar > box.right,
.titlebar > box.right { window .titlebar > box.right {
margin: 0 -200px 0 0; margin: 0 -200px 0 0;
opacity: 0; opacity: 0;
} }
.titlebar.default-decoration { window .titlebar.default-decoration {
margin: -200px 0 0; margin: -200px 0 0;
opacity: 0; opacity: 0;
} }

View File

@ -1,5 +1,10 @@
.tiled headerbar, .tiled > headerbar,
.tiled .titlebar { .tiled > .titlebar,
.tiled > headerbar > headerbar,
.tiled > .titlebar > .titlebar,
.tiled > .titlebar > stack > headerbar,
.tiled headerbar:last-child,
.tiled .titlebar:last-child {
padding-right: 0; padding-right: 0;
} }

View File

@ -1,5 +1,10 @@
.maximized headerbar, .maximized > headerbar,
.maximized .titlebar { .maximized > .titlebar,
.maximized > headerbar > headerbar,
.maximized > .titlebar > .titlebar,
.maximized > .titlebar > stack > headerbar,
.maximized headerbar:last-child,
.maximized .titlebar:last-child {
padding-right: 0; padding-right: 0;
} }