Lint code with project settings

This commit is contained in:
Hirnmoder
2025-07-10 20:50:14 +02:00
parent c725bd0e02
commit e774aab595
3 changed files with 118 additions and 86 deletions

View File

@@ -182,18 +182,18 @@ export const Panel = GObject.registerClass(
} }
panelBoxes.forEach((p) => (this[p] = Main.panel[p])) panelBoxes.forEach((p) => (this[p] = Main.panel[p]))
;['activities', systemMenuInfo.name, 'dateMenu'].forEach((b) => { ;['activities', systemMenuInfo.name, 'dateMenu'].forEach((b) => {
let container = this.statusArea[b].container let container = this.statusArea[b].container
let parent = container.get_parent() let parent = container.get_parent()
let siblings = parent.get_children() let siblings = parent.get_children()
let index = siblings.indexOf(container) let index = siblings.indexOf(container)
container._dtpOriginalParent = parent container._dtpOriginalParent = parent
container._dtpOriginalIndex = container._dtpOriginalIndex =
index && index == siblings.length - 1 ? -1 : index index && index == siblings.length - 1 ? -1 : index
parent ? parent.remove_child(container) : null parent ? parent.remove_child(container) : null
this.panel.add_child(container) this.panel.add_child(container)
}) })
} }
this.geom = this.getGeometry() this.geom = this.getGeometry()
@@ -870,10 +870,10 @@ export const Panel = GObject.registerClass(
_setAllocationMap() { _setAllocationMap() {
this.allocationMap = {} this.allocationMap = {}
let setMap = (name, actor) => let setMap = (name, actor) =>
(this.allocationMap[name] = { (this.allocationMap[name] = {
actor: actor, actor: actor,
box: new Clutter.ActorBox(), box: new Clutter.ActorBox(),
}) })
setMap(Pos.SHOW_APPS_BTN, this.showAppsIconWrapper.realShowAppsIcon) setMap(Pos.SHOW_APPS_BTN, this.showAppsIconWrapper.realShowAppsIcon)
setMap( setMap(
@@ -1142,7 +1142,7 @@ export const Panel = GObject.registerClass(
this.panel[ this.panel[
(St.Side[p] == this.geom.position ? 'add' : 'remove') + (St.Side[p] == this.geom.position ? 'add' : 'remove') +
'_style_class_name' '_style_class_name'
](cssName) ](cssName)
}) })
@@ -1442,9 +1442,11 @@ export const Panel = GObject.registerClass(
} }
_getDefaultLineColor(isBrightOverride) { _getDefaultLineColor(isBrightOverride) {
return (typeof isBrightOverride === 'undefined' && this._getBackgroundBrightness()) || isBrightOverride return (typeof isBrightOverride === 'undefined' &&
? "rgba(55, 55, 55, .2)" this._getBackgroundBrightness()) ||
: "rgba(200, 200, 200, .2)" isBrightOverride
? 'rgba(55, 55, 55, .2)'
: 'rgba(200, 200, 200, .2)'
} }
_setShowDesktopButtonStyle() { _setShowDesktopButtonStyle() {
@@ -1561,7 +1563,7 @@ export const Panel = GObject.registerClass(
let showWsPopup = SETTINGS.get_boolean('scroll-panel-show-ws-popup') let showWsPopup = SETTINGS.get_boolean('scroll-panel-show-ws-popup')
showWsPopup showWsPopup
? 0 ? 0
: (Main.wm._workspaceSwitcherPopup = { display: () => { } }) : (Main.wm._workspaceSwitcherPopup = { display: () => {} })
Main.wm._showWorkspaceSwitcher.call(Main.wm, ...args, { Main.wm._showWorkspaceSwitcher.call(Main.wm, ...args, {
get_name: () => 'switch---' + direction, get_name: () => 'switch---' + direction,
@@ -1596,7 +1598,7 @@ export const Panel = GObject.registerClass(
const scrollDelay = SETTINGS.get_int('scroll-panel-delay') const scrollDelay = SETTINGS.get_int('scroll-panel-delay')
if (scrollDelay) { if (scrollDelay) {
this._timeoutsHandler.add([T6, scrollDelay, () => { }]) this._timeoutsHandler.add([T6, scrollDelay, () => {}])
} }
} }
} }

View File

@@ -1086,13 +1086,13 @@ const Preferences = class {
'sensitive', 'sensitive',
Gio.SettingsBindFlags.INVERT_BOOLEAN, Gio.SettingsBindFlags.INVERT_BOOLEAN,
) )
; (function () { ;(function () {
let rgba = new Gdk.RGBA() let rgba = new Gdk.RGBA()
rgba.parse(this._settings.get_string('focus-highlight-color')) rgba.parse(this._settings.get_string('focus-highlight-color'))
this._builder this._builder
.get_object('focus_highlight_color_colorbutton') .get_object('focus_highlight_color_colorbutton')
.set_rgba(rgba) .set_rgba(rgba)
}).apply(this) }).apply(this)
this._builder this._builder
.get_object('focus_highlight_opacity_spinbutton') .get_object('focus_highlight_opacity_spinbutton')
@@ -1481,46 +1481,60 @@ const Preferences = class {
dialog.set_default_size(1, 1) dialog.set_default_size(1, 1)
}) })
// Panel border // Panel border
this._settings.bind('trans-use-border', this._settings.bind(
'trans-use-border',
this._builder.get_object('trans_border_switch'), this._builder.get_object('trans_border_switch'),
'active', 'active',
Gio.SettingsBindFlags.DEFAULT) Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind('trans-use-border', this._settings.bind(
'trans-use-border',
this._builder.get_object('trans_border_color_box'), this._builder.get_object('trans_border_color_box'),
'sensitive', 'sensitive',
Gio.SettingsBindFlags.DEFAULT) Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind('trans-use-border', this._settings.bind(
'trans-use-border',
this._builder.get_object('trans_border_width_box'), this._builder.get_object('trans_border_width_box'),
'sensitive', 'sensitive',
Gio.SettingsBindFlags.DEFAULT) Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind('trans-border-use-custom-color', this._settings.bind(
'trans-border-use-custom-color',
this._builder.get_object('trans_border_color_switch'), this._builder.get_object('trans_border_color_switch'),
'active', 'active',
Gio.SettingsBindFlags.DEFAULT) Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind('trans-border-use-custom-color', this._settings.bind(
'trans-border-use-custom-color',
this._builder.get_object('trans_border_color_colorbutton'), this._builder.get_object('trans_border_color_colorbutton'),
'sensitive', 'sensitive',
Gio.SettingsBindFlags.DEFAULT) Gio.SettingsBindFlags.DEFAULT,
)
rgba.parse(this._settings.get_string('trans-border-custom-color')) rgba.parse(this._settings.get_string('trans-border-custom-color'))
this._builder.get_object('trans_border_color_colorbutton').set_rgba(rgba) this._builder.get_object('trans_border_color_colorbutton').set_rgba(rgba)
this._builder.get_object('trans_border_color_colorbutton').connect('color-set', (button) => { this._builder
let rgba = button.get_rgba() .get_object('trans_border_color_colorbutton')
let css = rgba.to_string() .connect('color-set', (button) => {
this._settings.set_string('trans-border-custom-color', css) let rgba = button.get_rgba()
}) let css = rgba.to_string()
this._settings.set_string('trans-border-custom-color', css)
this._builder.get_object('trans_border_width_spinbutton').set_value(this._settings.get_int('trans-border-width')) })
this._builder.get_object('trans_border_width_spinbutton').connect('value-changed', (widget) => {
this._settings.set_int('trans-border-width', widget.get_value())
})
this._builder
.get_object('trans_border_width_spinbutton')
.set_value(this._settings.get_int('trans-border-width'))
this._builder
.get_object('trans_border_width_spinbutton')
.connect('value-changed', (widget) => {
this._settings.set_int('trans-border-width', widget.get_value())
})
this._settings.bind( this._settings.bind(
'desktop-line-use-custom-color', 'desktop-line-use-custom-color',
@@ -1592,7 +1606,7 @@ const Preferences = class {
.get_object('intellihide_behaviour_options') .get_object('intellihide_behaviour_options')
.set_sensitive( .set_sensitive(
this._settings.get_boolean('intellihide-hide-from-windows') || this._settings.get_boolean('intellihide-hide-from-windows') ||
hideFromMonitorWindows, hideFromMonitorWindows,
) )
} }
@@ -2531,15 +2545,15 @@ const Preferences = class {
widget.get_active_id(), widget.get_active_id(),
) )
}) })
; (function () { ;(function () {
let rgba = new Gdk.RGBA() let rgba = new Gdk.RGBA()
rgba.parse( rgba.parse(
this._settings.get_string('window-preview-title-font-color'), this._settings.get_string('window-preview-title-font-color'),
) )
this._builder this._builder
.get_object('grid_preview_title_font_color_colorbutton') .get_object('grid_preview_title_font_color_colorbutton')
.set_rgba(rgba) .set_rgba(rgba)
}).apply(this) }).apply(this)
dialog.show() dialog.show()
}) })
@@ -2739,22 +2753,22 @@ const Preferences = class {
widget.get_active_id(), widget.get_active_id(),
) )
}) })
; (function () { ;(function () {
let rgba = new Gdk.RGBA() let rgba = new Gdk.RGBA()
rgba.parse(this._settings.get_string('group-apps-label-font-color')) rgba.parse(this._settings.get_string('group-apps-label-font-color'))
this._builder this._builder
.get_object('group_apps_label_font_color_colorbutton') .get_object('group_apps_label_font_color_colorbutton')
.set_rgba(rgba) .set_rgba(rgba)
}).apply(this) }).apply(this)
; (function () { ;(function () {
let rgba = new Gdk.RGBA() let rgba = new Gdk.RGBA()
rgba.parse( rgba.parse(
this._settings.get_string('group-apps-label-font-color-minimized'), this._settings.get_string('group-apps-label-font-color-minimized'),
) )
this._builder this._builder
.get_object('group_apps_label_font_color_minimized_colorbutton') .get_object('group_apps_label_font_color_minimized_colorbutton')
.set_rgba(rgba) .set_rgba(rgba)
}).apply(this) }).apply(this)
this._builder this._builder
.get_object('group_apps_label_max_width_spinbutton') .get_object('group_apps_label_max_width_spinbutton')
@@ -3763,7 +3777,7 @@ const Preferences = class {
versionLinkButton.set_label( versionLinkButton.set_label(
this._metadata.version.toString() + this._metadata.version.toString() +
(this._metadata.commit ? ' (' + this._metadata.commit + ')' : ''), (this._metadata.commit ? ' (' + this._metadata.commit + ')' : ''),
) )
versionLinkButton.set_uri( versionLinkButton.set_uri(
`${this._metadata.url}/${this._metadata.commit ? `commit/${this._metadata.commit}` : `releases/tag/v${this._metadata.version}`}`, `${this._metadata.url}/${this._metadata.commit ? `commit/${this._metadata.commit}` : `releases/tag/v${this._metadata.version}`}`,
@@ -3817,7 +3831,7 @@ const Preferences = class {
stdin.splice( stdin.splice(
settingsFile.read(null), settingsFile.read(null),
Gio.OutputStreamSpliceFlags.CLOSE_SOURCE | Gio.OutputStreamSpliceFlags.CLOSE_SOURCE |
Gio.OutputStreamSpliceFlags.CLOSE_TARGET, Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
null, null,
) )
} }

View File

@@ -90,7 +90,7 @@ export const DynamicTransparency = class {
'changed::trans-border-custom-color', 'changed::trans-border-custom-color',
'changed::trans-border-width', 'changed::trans-border-width',
], ],
() => this._updateBorderAndSet() () => this._updateBorderAndSet(),
], ],
[ [
SETTINGS, SETTINGS,
@@ -192,19 +192,31 @@ export const DynamicTransparency = class {
} }
_updateBorder() { _updateBorder() {
let rgba = this._dtpPanel._getDefaultLineColor(Utils.checkIfColorIsBright(this.backgroundColorRgb)) // supply parameter manually or else an exception (something is undefined) will arise let rgba = this._dtpPanel._getDefaultLineColor(
Utils.checkIfColorIsBright(this.backgroundColorRgb),
) // supply parameter manually or else an exception (something is undefined) will arise
const isLineCustom = SETTINGS.get_boolean('trans-border-use-custom-color') const isLineCustom = SETTINGS.get_boolean('trans-border-use-custom-color')
rgba = isLineCustom ? SETTINGS.get_string('trans-border-custom-color') : rgba rgba = isLineCustom
? SETTINGS.get_string('trans-border-custom-color')
: rgba
const showBorder = SETTINGS.get_boolean('trans-use-border') const showBorder = SETTINGS.get_boolean('trans-use-border')
const borderWidth = SETTINGS.get_int('trans-border-width') const borderWidth = SETTINGS.get_int('trans-border-width')
const position = this._dtpPanel.getPosition() const position = this._dtpPanel.getPosition()
let borderPosition = '' let borderPosition = ''
if (position == St.Side.LEFT) { borderPosition = 'right' } if (position == St.Side.LEFT) {
if (position == St.Side.RIGHT) { borderPosition = 'left' } borderPosition = 'right'
if (position == St.Side.TOP) { borderPosition = 'bottom' } }
if (position == St.Side.BOTTOM) { borderPosition = 'top' } if (position == St.Side.RIGHT) {
borderPosition = 'left'
}
if (position == St.Side.TOP) {
borderPosition = 'bottom'
}
if (position == St.Side.BOTTOM) {
borderPosition = 'top'
}
const style = `border: 0 solid ${rgba}; border-${borderPosition}-width:${borderWidth}px; ` const style = `border: 0 solid ${rgba}; border-${borderPosition}-width:${borderWidth}px; `
this._borderStyle = showBorder ? style : '' this._borderStyle = showBorder ? style : ''
@@ -214,7 +226,8 @@ export const DynamicTransparency = class {
this._gradientStyle = '' this._gradientStyle = ''
if (SETTINGS.get_boolean('trans-use-custom-gradient')) { if (SETTINGS.get_boolean('trans-use-custom-gradient')) {
this._backgroundStyle = 'background: none; border-image: none; background-image: none;' this._backgroundStyle =
'background: none; border-image: none; background-image: none;'
this._gradientStyle += this._gradientStyle +=
'background-gradient-direction: ' + 'background-gradient-direction: ' +
(this._dtpPanel.geom.vertical ? 'horizontal;' : 'vertical;') + (this._dtpPanel.geom.vertical ? 'horizontal;' : 'vertical;') +
@@ -246,7 +259,10 @@ export const DynamicTransparency = class {
const transition = 'transition-duration:' + this.animationDuration const transition = 'transition-duration:' + this.animationDuration
this._dtpPanel.panel.set_style( this._dtpPanel.panel.set_style(
transition + this._backgroundStyle + this._gradientStyle + this._borderStyle transition +
this._backgroundStyle +
this._gradientStyle +
this._borderStyle,
) )
console.log('Set DTP Panel style to', this._dtpPanel.panel.get_style()) console.log('Set DTP Panel style to', this._dtpPanel.panel.get_style())
} }