Skip to content

Commit

Permalink
activities: add option to use text in button
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Oct 17, 2023
1 parent f3fc2e9 commit 40110fc
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions unite@hardpixel.eu/convenience.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const SettingsManager = GObject.registerClass(
'show-window-title': 'enum',
'show-appmenu-button': 'boolean',
'show-desktop-name': 'boolean',
'use-activities-text': 'boolean',
'desktop-name-text': 'string',
'extend-left-box': 'boolean',
'notifications-position': 'enum',
Expand Down
25 changes: 25 additions & 0 deletions unite@hardpixel.eu/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,30 @@ class ActivitiesButton extends Handlers.Feature {
}
}

class ActivitiesText extends Handlers.Feature {
constructor() {
super('use-activities-text', setting => setting == true)
}

activate() {
this.label = new St.Label({ y_align: Clutter.ActorAlign.CENTER })
this.label.set_text(Activities.get_accessible_name())

this.switcher = Activities.get_first_child()
Activities.remove_child(this.switcher)

Activities.add_actor(this.label)
}

destroy() {
Activities.remove_actor(this.label)
this.label.destroy()

Activities.add_child(this.switcher)
this.switcher = null
}
}

class DesktopName extends Handlers.Feature {
constructor() {
super('show-desktop-name', setting => setting == true)
Expand Down Expand Up @@ -802,6 +826,7 @@ export const PanelManager = GObject.registerClass(
this.features.add(WindowButtons)
this.features.add(ExtendLeftBox)
this.features.add(ActivitiesButton)
this.features.add(ActivitiesText)
this.features.add(DesktopName)
this.features.add(TrayIcons)
this.features.add(TitlebarActions)
Expand Down
Binary file modified unite@hardpixel.eu/schemas/gschemas.compiled
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
<summary>Show appmenu in top bar.</summary>
</key>

<key name="use-activities-text" type="b">
<default>true</default>
<summary>Use text in activities button.</summary>
</key>

<key name="show-desktop-name" type="b">
<default>true</default>
<summary>Show desktop name in top bar.</summary>
Expand Down
20 changes: 20 additions & 0 deletions unite@hardpixel.eu/settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,26 @@
</child>
</object>
</child>
<child>
<object class="GtkBox" id="use_activities_text_section">
<property name="spacing">50</property>
<child>
<object class="GtkLabel">
<property name="can-focus">0</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Use text in activities button</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="use_activities_text">
<property name="hexpand">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="greyscale_tray_icons_section">
<property name="spacing">50</property>
Expand Down

0 comments on commit 40110fc

Please sign in to comment.