Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/desktops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ extern RrInstance* rrinst; // defined in obconf-qt.cpp

static int num_desktops;

static const gchar* all_desktops_node_1 = "keyboard/keybind:key=A-Tab/action:name=NextWindow/allDesktops";
static const gchar* all_desktops_node_2 = "keyboard/keybind:key=A-S-Tab/action:name=PreviousWindow/allDesktops";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These long names are a bit ungainly and potentially fragile because of where the allDesktops entries are nested in the xml.

Ideally (IMO) allDesktops would be broken out of the keybinds to some more convenient and stable location, as the behaviour seems independent of them to me, but Openbox seems to be mature and unchanged for a long time so I guess that's unlikely to happen. Doubtless there are a lot of programs out there using the current configurations that any change would break.

Could maybe do something a bit more comprehensive here, like search the keybinds to see which ones have <action name="[Next|Previous]Window"> or allDesktops and fill into a template string such as "keyboard/keybind:key=%s/action:name=%s/allDesktops" with ``g_strdup_printf`. Just means a bit more processing and code, and i'm conscious of introducing bugs.


/*
static void desktops_read_names();
static void desktops_write_names();
Expand All @@ -52,6 +55,9 @@ void MainDialog::desktops_setup_tab() {
i = tree_get_int("desktops/popupTime", 875);
ui.desktop_popup->setChecked(i != 0);
ui.desktop_popup_time->setValue(i ? i : 875);

gboolean all_desktops = tree_get_bool(all_desktops_node_1, TRUE);
ui.all_desktops->setChecked(all_desktops);
}

void MainDialog::on_desktop_num_valueChanged(int newValue) {
Expand Down Expand Up @@ -167,6 +173,11 @@ void MainDialog::on_desktop_popup_toggled(bool checked) {
tree_set_int("desktops/popupTime", 0);
}

void MainDialog::on_all_desktops_toggled(bool checked) {
tree_set_bool(all_desktops_node_1, checked);
tree_set_bool(all_desktops_node_2, checked);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realise it's a little bit suboptimal having 2 calls to tree_apply() via these functions, maybe another function to avoid that is merited

}

void MainDialog::on_desktop_popup_time_valueChanged(int newValue) {
tree_set_int("desktops/popupTime", newValue);
}
Expand Down
1 change: 1 addition & 0 deletions src/maindialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private Q_SLOTS:
void on_desktop_popup_toggled(bool checked);
void on_desktop_popup_time_valueChanged(int newValue);
void on_desktop_names_itemChanged(QListWidgetItem * item);
void on_all_desktops_toggled(bool checked);

// docks
void on_dock_float_x_valueChanged(int newValue);
Expand Down
13 changes: 12 additions & 1 deletion src/obconf.ui
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,17 @@ D: Omnipresent (On all desktops)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="all_desktops">
<property name="text">
<string>&amp;Show windows from all desktops when task switching (Alt-Tab)</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QListWidget" name="desktop_names"/>
</item>
<item row="4" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="label_19">
<property name="text">
<string>&amp;Desktop names:</string>
Expand Down Expand Up @@ -1382,6 +1389,10 @@ D: Omnipresent (On all desktops)</string>
</hint>
</hints>
</connection>
<connection>
<sender>all_desktops</sender>
<signal>toggled(bool)</signal>
</connection>
<connection>
<sender>dock_hide</sender>
<signal>toggled(bool)</signal>
Expand Down