Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure Desktop environments use normal hint type and tiling window managers use utility hint type #507

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
16 changes: 16 additions & 0 deletions src/desktop-integration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ namespace Peek {

return folder;
}
public static bool is_tiling () {
var tiling_window =true;
var de_list = new List<string> ();
de_list.append ("Unity");
de_list.append ("GNOME");
de_list.append ("X-Cinnamon");
de_list.append ("XFCE");
de_list.append ("KDE");
foreach (string element in de_list) {
if ( xdg_current_desktop_contains (element) ) {
tiling_window = false;
stdout.printf ("Using %s Desktop Environment\n", element);
}
}
return tiling_window;
}

public static bool is_unity () {
return xdg_current_desktop_contains ("Unity");
Expand Down
4 changes: 4 additions & 0 deletions src/ui/application-window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ namespace Peek.Ui {
SettingsBindFlags.DEFAULT);

// Configure window
if (DesktopIntegration.is_tiling () ){
this.type_hint= UTILITY;
}

this.set_keep_above (true);
this.load_geometry ();
this.on_window_screen_changed (null);
Expand Down
2 changes: 1 addition & 1 deletion ui/application-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Author: Philipp Wolfer <ph.wolfer@gmail.com>
<property name="default_width">440</property>
<property name="default_height">250</property>
<property name="icon_name">com.uploadedlobster.peek</property>
<property name="type_hint">utility</property>
<property name="type_hint">normal</property>
<property name="show_menubar">False</property>
<signal name="draw" handler="on_window_draw" swapped="no"/>
<signal name="screen-changed" handler="on_window_screen_changed" swapped="no"/>
Expand Down