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

View File

@@ -1086,13 +1086,13 @@ const Preferences = class {
'sensitive',
Gio.SettingsBindFlags.INVERT_BOOLEAN,
)
; (function () {
let rgba = new Gdk.RGBA()
rgba.parse(this._settings.get_string('focus-highlight-color'))
this._builder
.get_object('focus_highlight_color_colorbutton')
.set_rgba(rgba)
}).apply(this)
;(function () {
let rgba = new Gdk.RGBA()
rgba.parse(this._settings.get_string('focus-highlight-color'))
this._builder
.get_object('focus_highlight_color_colorbutton')
.set_rgba(rgba)
}).apply(this)
this._builder
.get_object('focus_highlight_opacity_spinbutton')
@@ -1481,46 +1481,60 @@ const Preferences = class {
dialog.set_default_size(1, 1)
})
// Panel border
this._settings.bind('trans-use-border',
this._settings.bind(
'trans-use-border',
this._builder.get_object('trans_border_switch'),
'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'),
'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'),
'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'),
'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'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT)
Gio.SettingsBindFlags.DEFAULT,
)
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').connect('color-set', (button) => {
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_color_colorbutton')
.connect('color-set', (button) => {
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._settings.bind(
'desktop-line-use-custom-color',
@@ -1592,7 +1606,7 @@ const Preferences = class {
.get_object('intellihide_behaviour_options')
.set_sensitive(
this._settings.get_boolean('intellihide-hide-from-windows') ||
hideFromMonitorWindows,
hideFromMonitorWindows,
)
}
@@ -2531,15 +2545,15 @@ const Preferences = class {
widget.get_active_id(),
)
})
; (function () {
let rgba = new Gdk.RGBA()
rgba.parse(
this._settings.get_string('window-preview-title-font-color'),
)
this._builder
.get_object('grid_preview_title_font_color_colorbutton')
.set_rgba(rgba)
}).apply(this)
;(function () {
let rgba = new Gdk.RGBA()
rgba.parse(
this._settings.get_string('window-preview-title-font-color'),
)
this._builder
.get_object('grid_preview_title_font_color_colorbutton')
.set_rgba(rgba)
}).apply(this)
dialog.show()
})
@@ -2739,22 +2753,22 @@ const Preferences = class {
widget.get_active_id(),
)
})
; (function () {
let rgba = new Gdk.RGBA()
rgba.parse(this._settings.get_string('group-apps-label-font-color'))
this._builder
.get_object('group_apps_label_font_color_colorbutton')
.set_rgba(rgba)
}).apply(this)
; (function () {
let rgba = new Gdk.RGBA()
rgba.parse(
this._settings.get_string('group-apps-label-font-color-minimized'),
)
this._builder
.get_object('group_apps_label_font_color_minimized_colorbutton')
.set_rgba(rgba)
}).apply(this)
;(function () {
let rgba = new Gdk.RGBA()
rgba.parse(this._settings.get_string('group-apps-label-font-color'))
this._builder
.get_object('group_apps_label_font_color_colorbutton')
.set_rgba(rgba)
}).apply(this)
;(function () {
let rgba = new Gdk.RGBA()
rgba.parse(
this._settings.get_string('group-apps-label-font-color-minimized'),
)
this._builder
.get_object('group_apps_label_font_color_minimized_colorbutton')
.set_rgba(rgba)
}).apply(this)
this._builder
.get_object('group_apps_label_max_width_spinbutton')
@@ -3763,7 +3777,7 @@ const Preferences = class {
versionLinkButton.set_label(
this._metadata.version.toString() +
(this._metadata.commit ? ' (' + this._metadata.commit + ')' : ''),
(this._metadata.commit ? ' (' + this._metadata.commit + ')' : ''),
)
versionLinkButton.set_uri(
`${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(
settingsFile.read(null),
Gio.OutputStreamSpliceFlags.CLOSE_SOURCE |
Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
null,
)
}

View File

@@ -90,7 +90,7 @@ export const DynamicTransparency = class {
'changed::trans-border-custom-color',
'changed::trans-border-width',
],
() => this._updateBorderAndSet()
() => this._updateBorderAndSet(),
],
[
SETTINGS,
@@ -192,19 +192,31 @@ export const DynamicTransparency = class {
}
_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')
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 borderWidth = SETTINGS.get_int('trans-border-width')
const position = this._dtpPanel.getPosition()
let borderPosition = ''
if (position == St.Side.LEFT) { borderPosition = 'right' }
if (position == St.Side.RIGHT) { borderPosition = 'left' }
if (position == St.Side.TOP) { borderPosition = 'bottom' }
if (position == St.Side.BOTTOM) { borderPosition = 'top' }
if (position == St.Side.LEFT) {
borderPosition = 'right'
}
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; `
this._borderStyle = showBorder ? style : ''
@@ -214,7 +226,8 @@ export const DynamicTransparency = class {
this._gradientStyle = ''
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 +=
'background-gradient-direction: ' +
(this._dtpPanel.geom.vertical ? 'horizontal;' : 'vertical;') +
@@ -246,7 +259,10 @@ export const DynamicTransparency = class {
const transition = 'transition-duration:' + this.animationDuration
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())
}