Allow panel size and position adjustment

This commit is contained in:
jderose9
2016-12-22 18:12:04 -05:00
parent ca85a18f3b
commit 2529448e8a
10 changed files with 1302 additions and 15 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.~
*~
gschemas.compiled
onebar@jderose9.github.com.zip
*.mo
po/onebar.pot
Settings.ui.h

84
Makefile Normal file
View File

@@ -0,0 +1,84 @@
# Basic Makefile
UUID = onebar@jderose9.github.com
BASE_MODULES = extension.js stylesheet.css metadata.json COPYING README.md
EXTRA_MODULES = convenience.js taskbar.js secondaryMenu.js windowPreview.js prefs.js Settings.ui
#EXTRA_MEDIA = logo.svg
TOLOCALIZE = prefs.js
MSGSRC = $(wildcard po/*.po)
ifeq ($(strip $(DESTDIR)),)
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions
else
INSTALLBASE = $(DESTDIR)/usr/share/gnome-shell/extensions
endif
INSTALLNAME = onebar@jderose9.github.com
# The command line passed variable VERSION is used to set the version string
# in the metadata and in the generated zip-file. If no VERSION is passed, the
# current commit SHA1 is used as version number in the metadata while the
# generated zip file has no string attached.
ifdef VERSION
VSTRING = _v$(VERSION)
else
VERSION = $(shell git rev-parse HEAD)
VSTRING =
endif
all: extension
clean:
rm -f ./schemas/gschemas.compiled
extension: ./schemas/gschemas.compiled $(MSGSRC:.po=.mo)
./schemas/gschemas.compiled: ./schemas/org.gnome.shell.extensions.onebar.gschema.xml
glib-compile-schemas ./schemas/
potfile: ./po/onebar.pot
mergepo: potfile
for l in $(MSGSRC); do \
msgmerge -U $$l ./po/onebar.pot; \
done;
./po/onebar.pot: $(TOLOCALIZE) Settings.ui
mkdir -p po
xgettext -k_ -kN_ -o po/onebar.pot --package-name "OneBar" $(TOLOCALIZE)
intltool-extract --type=gettext/glade Settings.ui
xgettext -k_ -kN_ --join-existing -o po/onebar.pot Settings.ui.h
./po/%.mo: ./po/%.po
msgfmt -c $< -o $@
install: install-local
install-local: _build
rm -rf $(INSTALLBASE)/$(INSTALLNAME)
mkdir -p $(INSTALLBASE)/$(INSTALLNAME)
cp -r ./_build/* $(INSTALLBASE)/$(INSTALLNAME)/
-rm -fR _build
echo done
zip-file: _build
cd _build ; \
zip -qr "$(UUID)$(VSTRING).zip" .
mv _build/$(UUID)$(VSTRING).zip ./
-rm -fR _build
_build: all
-rm -fR ./_build
mkdir -p _build
cp $(BASE_MODULES) $(EXTRA_MODULES) _build
#mkdir -p _build/media
#cd media ; cp $(EXTRA_MEDIA) ../_build/media/
mkdir -p _build/schemas
cp schemas/*.xml _build/schemas/
cp schemas/gschemas.compiled _build/schemas/
mkdir -p _build/locale
for l in $(MSGSRC:.po=.mo) ; do \
lf=_build/locale/`basename $$l .mo`; \
mkdir -p $$lf; \
mkdir -p $$lf/LC_MESSAGES; \
cp $$l $$lf/LC_MESSAGES/onebar.mo; \
done;
sed -i 's/"version": -1/"version": "$(VERSION)"/' _build/metadata.json;

View File

@@ -1,4 +1 @@
# Zorin Taskbar
The official taskbar for Zorin OS.
Based on the [Dash to Dock](https://github.com/micheleg/dash-to-dock) Gnome Shell extension by micheleg.
# gnome-onebar

757
Settings.ui Normal file
View File

@@ -0,0 +1,757 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkBox" id="box_middle_click_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="frame_middle_click_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="listbox_middle_click_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="listboxrow11">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="buitin_theme7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="builtin_theme_description4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">When set to minimize, double clicking minimizes all the windows of the application.</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="builtin_theme_label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Shift+Click action</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="shift_click_action_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize window</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
<item translatable="yes">Quit</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_middle_click">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_middle_click">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="description_middle_click">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Behavior for Middle-Click.</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_middle_click">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Middle-Click action</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="middle_click_action_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize window</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
<item translatable="yes">Quit</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_shift_middle_click">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_shift_middle_click">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="description_shift_middle_click">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Behavior for Shift+Middle-Click.</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_shift_middle_click">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Shift+Middle-Click action</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="shift_middle_click_action_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize window</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
<item translatable="yes">Quit</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<object class="GtkAdjustment" id="dot_border_width_adjustment">
<property name="upper">10</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="panel_size_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
</object>
<object class="GtkNotebook" id="settings_notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="show_tabs">False</property>
<child>
<object class="GtkBox" id="position_and_size">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">24</property>
<property name="margin_right">24</property>
<property name="margin_top">24</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<child>
<object class="GtkFrame" id="panel_display">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="panel_display_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="panel_position_listboxrow">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox" id="panel_position_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="spacing">32</property>
<child>
<object class="GtkLabel" id="panel_position_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Position on screen</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="panel_position_butttons_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">32</property>
<child>
<object class="GtkRadioButton" id="position_bottom_button">
<property name="label" translatable="yes">Bottom</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="position_bottom_button_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="position_top_button">
<property name="label" translatable="yes">Top</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="xalign">0</property>
<property name="image_position">bottom</property>
<property name="draw_indicator">True</property>
<property name="group">position_bottom_button</property>
<signal name="toggled" handler="position_top_button_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="size_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="size_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="panel_size_listboxrow">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="panel_size_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="panel_size_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Panel Size</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkScale" id="panel_size_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">baseline</property>
<property name="hexpand">True</property>
<property name="adjustment">panel_size_adjustment</property>
<property name="round_digits">0</property>
<property name="digits">0</property>
<property name="value_pos">right</property>
<signal name="format-value" handler="panel_size_scale_format_value_cb" swapped="no"/>
<signal name="value-changed" handler="panel_size_scale_value_changed_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="general_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Position and size</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="behaviour">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">24</property>
<property name="margin_right">24</property>
<property name="margin_top">24</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<child>
<object class="GtkFrame" id="customize_theme1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="listbox9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="listboxrow17">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="shrink_dash3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkSwitch" id="show_applications_button_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="shrink_dash_description1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">If disabled, these settings are acccessible from gnome-tweak-tool or the extension website.</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="shrink_dash_label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Show &lt;i&gt;Applications&lt;/i&gt; icon</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="application_button_first_button">
<property name="label" translatable="yes">Move the applications button at the beginning of the panel.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">12</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="application_button_animation_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">3</property>
<property name="xalign">0</property>
<property name="yalign">0.43000000715255737</property>
<property name="draw_indicator">True</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Animate &lt;i&gt;Show Applications&lt;/i&gt;.</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkFrame" id="built_in_theme_frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="listbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="listboxrow9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="buitin_theme5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="builtin_theme_description5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Behaviour when clicking on the icon of a running application.</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="builtin_theme_label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Click action</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="click_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="middle_click_options_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<child>
<object class="GtkImage" id="middle_click_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">emblem-system-symbolic</property>
</object>
</child>
<style>
<class name="circular"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="click_action_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
</items>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="behaviour_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Behavior</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
</interface>

View File

@@ -21,10 +21,75 @@
* Some code was also adapted from the upstream Gnome Shell source code.
*/
const ExtensionUtils = imports.misc.extensionUtils;
const Gettext = imports.gettext;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
/**
* initTranslations:
* @domain: (optional): the gettext domain to use
*
* Initialize Gettext to load translations from extensionsdir/locale.
* If @domain is not provided, it will be taken from metadata['gettext-domain']
*/
function initTranslations(domain) {
let extension = ExtensionUtils.getCurrentExtension();
domain = domain || extension.metadata['gettext-domain'];
// Check if this extension was built with "make zip-file", and thus
// has the locale files in a subfolder
// otherwise assume that extension has been installed in the
// same prefix as gnome-shell
let localeDir = extension.dir.get_child('locale');
if (localeDir.query_exists(null))
Gettext.bindtextdomain(domain, localeDir.get_path());
else
Gettext.bindtextdomain(domain, Config.LOCALEDIR);
}
/**
* getSettings:
* @schema: (optional): the GSettings schema id
*
* Builds and return a GSettings schema for @schema, using schema files
* in extensionsdir/schemas. If @schema is not provided, it is taken from
* metadata['settings-schema'].
*/
function getSettings(schema) {
let extension = ExtensionUtils.getCurrentExtension();
schema = schema || extension.metadata['settings-schema'];
const GioSSS = Gio.SettingsSchemaSource;
// Check if this extension was built with "make zip-file", and thus
// has the schema files in a subfolder
// otherwise assume that extension has been installed in the
// same prefix as gnome-shell (and therefore schemas are available
// in the standard folders)
let schemaDir = extension.dir.get_child('schemas');
let schemaSource;
if (schemaDir.query_exists(null))
schemaSource = GioSSS.new_from_directory(schemaDir.get_path(),
GioSSS.get_default(),
false);
else
schemaSource = GioSSS.get_default();
let schemaObj = schemaSource.lookup(schema, true);
if (!schemaObj)
throw new Error('Schema ' + schema + ' could not be found for extension '
+ extension.metadata.uuid + '. Please check your installation.');
return new Gio.Settings({
settings_schema: schemaObj
});
}
// simplify global signals and function injections handling
// abstract class
const BasicHandler = new Lang.Class({

View File

@@ -28,6 +28,8 @@ const Convenience = Me.imports.convenience;
const Taskbar = Me.imports.taskbar;
const Lang = imports.lang;
const Main = imports.ui.main;
const PanelBox = Main.layoutManager.panelBox;
const St = imports.gi.St;
let appMenu;
let container;
@@ -35,11 +37,19 @@ let panel;
let panelConnectId;
let signalsHandler;
let taskbar;
let settings;
let MonitorsChangedListener = null;
let HeightNotifyListener = null;
let oldPanelHeight;
let myPanelGhost;
function init() {
}
function enable() {
settings = Convenience.getSettings('org.gnome.shell.extensions.onebar');
panel = Main.panel;
container = panel._leftBox;
appMenu = panel.statusArea['appMenu'];
@@ -50,6 +60,24 @@ function enable() {
Main.overview.dashIconSize = taskbar.iconSize;
container.insert_child_at_index( taskbar.actor, 2 );
oldPanelHeight = panel.actor.get_height();
// The overview uses the panel height as a margin by way of a "ghost" transparent Clone
// This pushes everything down, which isn't desired when the panel is moved to the bottom
// I'm adding a 2nd ghost panel and will resize the top or bottom ghost depending on the panel position
myPanelGhost = new St.Bin({
child: new Clutter.Clone({ source: Main.overview._panelGhost.get_child(0) }),
reactive: false,
opacity: 0
});
Main.overview._overview.add_actor(myPanelGhost);
// panel styling
MonitorsChangedListener = global.screen.connect("monitors-changed", setPanelStyle);
HeightNotifyListener = PanelBox.connect("notify::height", setPanelStyle);
setPanelStyle();
Main.panel.actor.add_style_class_name("popup-menu");
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
//animate a null target since some variables are not initialized when the viewSelector is created
@@ -69,7 +97,7 @@ function enable() {
Main.overview.dashIconSize = taskbar.iconSize;
})
],
// This duplicate the similar signal which is in owerview.js.
// This duplicate the similar signal which is in overview.js.
// Being connected and thus executed later this effectively
// overwrite any attempt to use the size of the default dash
// which given the customization is usually much smaller.
@@ -82,7 +110,9 @@ function enable() {
})
]
);
}
bindSettingsChanges();
}
function disable() {
signalsHandler.destroy();
@@ -90,16 +120,58 @@ function disable() {
container.add_child(appMenu.container);
taskbar.destroy();
panel.actor.disconnect(panelConnectId);
settings.run_dispose();
// reset stored icon size to the default dash
Main.overview.dashIconSize = Main.overview._controls.dash.iconSize;
// remove panel styling
if(HeightNotifyListener !== null) {
PanelBox.disconnect(HeightNotifyListener);
}
if(MonitorsChangedListener !== null) {
global.screen.disconnect(MonitorsChangedListener);
}
panel.actor.set_height(oldPanelHeight);
PanelBox.set_anchor_point(0, 0);
Main.overview._overview.remove_child(myPanelGhost);
Main.overview._panelGhost.set_height(oldPanelHeight);
Main.panel.actor.remove_style_class_name("popup-menu");
// dereference
settings = null;
appMenu = null;
container = null;
panel = null;
panelConnectId = null;
signalsHandler = null;
taskbar = null;
MonitorsChangedListener = null;
HeightNotifyListener = null;
oldPanelHeight = null;
}
function setPanelStyle() {
size = settings.get_int('panel-size');
position = settings.get_enum('panel-position');
panel.actor.set_height(size);
Main.overview._panelGhost.set_height(position ? size : 0);
myPanelGhost.set_height(position ? 0 : size);
position ? PanelBox.set_anchor_point(0, 0) :
PanelBox.set_anchor_point(0,(-1)*(Main.layoutManager.primaryMonitor.height-PanelBox.height));
}
function bindSettingsChanges() {
settings.connect('changed::panel-position', function() {
setPanelStyle();
});
settings.connect('changed::panel-size', function() {
setPanelStyle();
});
}
function allocate(actor, box, flags) {
@@ -155,8 +227,8 @@ function allocate(actor, box, flags) {
childBox.y2 = allocHeight + cornerHeight;
panel._leftCorner.actor.allocate(childBox, flags);
let [cornerMinWidth, cornerWidth] = panel._rightCorner.actor.get_preferred_width(-1);
let [cornerMinHeight, cornerHeight] = panel._rightCorner.actor.get_preferred_width(-1);
[cornerMinWidth, cornerWidth] = panel._rightCorner.actor.get_preferred_width(-1);
[cornerMinHeight, cornerHeight] = panel._rightCorner.actor.get_preferred_width(-1);
childBox.x1 = allocWidth - cornerWidth;
childBox.x2 = allocWidth;
childBox.y1 = allocHeight;

13
metadata.json Executable file → Normal file
View File

@@ -1,8 +1,9 @@
{
"extension-id": "zorin-taskbar",
"uuid": "zorin-taskbar@zorinos.com",
"name": "Zorin Taskbar",
"description": "The official taskbar for Zorin OS.",
"shell-version": [ "3.18" ],
"url": "https://github.com/ZorinOS/zorin-taskbar"
"extension-id": "onebar",
"uuid": "onebar@jderose9.github.com",
"name": "OneBar",
"description": "Win7 style taskbar",
"shell-version": [ "3.20", "3.22" ],
"url": "https://github.com/jderose9/onebar",
"gettext-domain": "onebar"
}

224
prefs.js Normal file
View File

@@ -0,0 +1,224 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Gettext = imports.gettext.domain('onebar');
const _ = Gettext.gettext;
const N_ = function(e) { return e };
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
const SCALE_UPDATE_TIMEOUT = 500;
const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ];
const Settings = new Lang.Class({
Name: 'TaskBar.Settings',
_init: function() {
this._settings = Convenience.getSettings('org.gnome.shell.extensions.onebar');
this._rtl = (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL);
this._builder = new Gtk.Builder();
this._builder.set_translation_domain(Me.metadata['gettext-domain']);
this._builder.add_from_file(Me.path + '/Settings.ui');
this.widget = this._builder.get_object('settings_notebook');
// Timeout to delay the update of the settings
this._panel_size_timeout = 0;
this._bindSettings();
this._builder.connect_signals_full(Lang.bind(this, this._connector));
},
/**
* Connect signals
*/
_connector: function(builder, object, signal, handler) {
object.connect(signal, Lang.bind(this, this._SignalHandler[handler]));
},
_bindSettings: function() {
// Position and size panel
// Position option
let position = this._settings.get_enum('panel-position');
switch (position) {
case 0:
this._builder.get_object('position_bottom_button').set_active(true);
break;
case 1:
this._builder.get_object('position_top_button').set_active(true);
break;
}
// size options
let panel_size_scale = this._builder.get_object('panel_size_scale');
panel_size_scale.set_range(DEFAULT_PANEL_SIZES[DEFAULT_PANEL_SIZES.length-1], DEFAULT_PANEL_SIZES[0]);
panel_size_scale.set_value(this._settings.get_int('panel-size'));
DEFAULT_PANEL_SIZES.slice(1, -1).forEach(function(val) {
panel_size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString());
});
// Corrent for rtl languages
if (this._rtl) {
// Flip value position: this is not done automatically
panel_size_scale.set_value_pos(Gtk.PositionType.LEFT);
// I suppose due to a bug, having a more than one mark and one above a value of 100
// makes the rendering of the marks wrong in rtl. This doesn't happen setting the scale as not flippable
// and then manually inverting it
panel_size_scale.set_flippable(false);
panel_size_scale.set_inverted(true);
}
// Behavior panel
this._settings.bind('show-show-apps-button',
this._builder.get_object('show_applications_button_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('show-apps-at-top',
this._builder.get_object('application_button_first_button'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('show-show-apps-button',
this._builder.get_object('application_button_first_button'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('animate-show-apps',
this._builder.get_object('application_button_animation_button'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('show-show-apps-button',
this._builder.get_object('application_button_animation_button'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._builder.get_object('click_action_combo').set_active(this._settings.get_enum('click-action'));
this._builder.get_object('click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('click-action', widget.get_active());
}));
this._builder.get_object('shift_click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('shift-click-action', widget.get_active());
}));
this._builder.get_object('middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('middle-click-action', widget.get_active());
}));
this._builder.get_object('shift_middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('shift-middle-click-action', widget.get_active());
}));
// Create dialog for middle-click options
this._builder.get_object('middle_click_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Customize middle-click behavior'),
transient_for: this.widget.get_toplevel(),
use_header_bar: true,
modal: true });
// GTK+ leaves positive values for application-defined response ids.
// Use +1 for the reset action
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_middle_click_options');
dialog.get_content_area().add(box);
this._builder.get_object('shift_click_action_combo').set_active(this._settings.get_enum('shift-click-action'));
this._builder.get_object('middle_click_action_combo').set_active(this._settings.get_enum('middle-click-action'));
this._builder.get_object('shift_middle_click_action_combo').set_active(this._settings.get_enum('shift-middle-click-action'));
this._settings.bind('shift-click-action',
this._builder.get_object('shift_click_action_combo'),
'active-id',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('middle-click-action',
this._builder.get_object('middle_click_action_combo'),
'active-id',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('shift-middle-click-action',
this._builder.get_object('shift_middle_click_action_combo'),
'active-id',
Gio.SettingsBindFlags.DEFAULT);
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
// restore default settings for the relevant keys
let keys = ['shift-click-action', 'middle-click-action', 'shift-middle-click-action'];
keys.forEach(function(val) {
this._settings.set_value(val, this._settings.get_default_value(val));
}, this);
this._builder.get_object('shift_click_action_combo').set_active(this._settings.get_enum('shift-click-action'));
this._builder.get_object('middle_click_action_combo').set_active(this._settings.get_enum('middle-click-action'));
this._builder.get_object('shift_middle_click_action_combo').set_active(this._settings.get_enum('shift-middle-click-action'));
} else {
// remove the settings box so it doesn't get destroyed;
dialog.get_content_area().remove(box);
dialog.destroy();
}
return;
}));
dialog.show_all();
}));
},
/**
* Object containing all signals defined in the glade file
*/
_SignalHandler: {
position_bottom_button_toggled_cb: function(button) {
if (button.get_active())
this._settings.set_enum('panel-position', 0);
},
position_top_button_toggled_cb: function(button) {
if (button.get_active())
this._settings.set_enum('panel-position', 1);
},
panel_size_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
panel_size_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._panel_size_timeout > 0)
Mainloop.source_remove(this._panel_size_timeout);
this._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('panel-size', scale.get_value());
this._panel_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
}
});
function init() {
Convenience.initTranslations();
}
function buildPrefsWidget() {
let settings = new Settings();
let widget = settings.widget;
widget.show_all();
return widget;
}

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gnome-shell-extensions">
<enum id='org.gnome.shell.extensions.onebar.clickAction'>
<value value='0' nick='skip'/>
<value value='1' nick='minimize'/>
<value value='2' nick='launch'/>
<value value='3' nick='cycle-windows'/>
<value value='4' nick='quit'/>
</enum>
<!-- this is mean to Match StSide. LEFT and RIGHT actual position in reversed in
rtl languages -->
<enum id='org.gnome.shell.extensions.onebar.position'>
<value value='0' nick='BOTTOM'/>
<value value='1' nick='TOP'/>
</enum>
<schema path="/org/gnome/shell/extensions/onebar/" id="org.gnome.shell.extensions.onebar">
<key name="panel-position" enum="org.gnome.shell.extensions.onebar.position">
<default>'BOTTOM'</default>
<summary>Panel position</summary>
<description>Panel is shown on the Bottom or Top of the screen.</description>
</key>
<key type="i" name="panel-size">
<default>48</default>
<summary>Panel size</summary>
<description>Set the size of the panel.</description>
</key>
<key type="b" name="show-show-apps-button">
<default>true</default>
<summary>Show applications button</summary>
<description>Show appplications button in the dash</description>
</key>
<key type="b" name="show-apps-at-top">
<default>false</default>
<summary>Show application button at top</summary>
<description>Show appplication button at top of the dash</description>
</key>
<key type="b" name="animate-show-apps">
<default>true</default>
<summary>Animate Show Applications from the desktop</summary>
<description>Animate Show Applications from the desktop</description>
</key>
<key type="b" name="customize-click">
<default>true</default>
<summary>Customize click behaviour</summary>
<description>Customize action on various mouse events</description>
</key>
<key type="b" name="minimize-shift">
<default>true</default>
<summary>Minimize on shift+click</summary>
</key>
<key type="b" name="activate-single-window">
<default>true</default>
<summary>Activate only one window</summary>
</key>
<key name="click-action" enum="org.gnome.shell.extensions.onebar.clickAction">
<default>'cycle-windows'</default>
<summary>Action when clicking on a running app</summary>
<description>Set the action that is executed when clicking on the icon of a running application</description>
</key>
<key name="shift-click-action" enum="org.gnome.shell.extensions.onebar.clickAction">
<default>'minimize'</default>
<summary>Action when shit+clicking on a running app</summary>
<description>Set the action that is executed when shift+clicking on the icon of a running application</description>
</key>
<key name="middle-click-action" enum="org.gnome.shell.extensions.onebar.clickAction">
<default>'launch'</default>
<summary>Action when clicking on a running app</summary>
<description>Set the action that is executed when middle-clicking on the icon of a running application</description>
</key>
<key name="shift-middle-click-action" enum="org.gnome.shell.extensions.onebar.clickAction">
<default>'launch'</default>
<summary>Action when clicking on a running app</summary>
<description>Set the action that is executed when shift+middle-clicking on the icon of a running application</description>
</key>
</schema>
</schemalist>

View File

@@ -59,3 +59,7 @@
#thumbnailPreviewList .preview-window-title {
padding-top: 1em;
}
.popup-menu.panel-menu {
margin-bottom: 0;
}