Skip to content

Commit

Permalink
New windowing tracker and large refactor of IconTasklist (#553)
Browse files Browse the repository at this point in the history
* windowing: Start work on new window tracker

Signed-off-by: Evan Maddock <[email protected]>

* windowing: Handle fullscreen state tracking for windows

Signed-off-by: Evan Maddock <[email protected]>

* [WIP] icon-tasklist: Begin port to libxfce4windowing

Signed-off-by: Evan Maddock <[email protected]>

* windowing: Add functions to get all groups and the active workspace

Signed-off-by: Evan Maddock <[email protected]>

* lib: Add desktop actions field to Budgie.Application

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Add new replacement GTK widgets using Windowing

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Move button geometry to it's own function and fix parameter

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement drawing the button indicators

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Make it compile

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Fix showing of popovers

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement handling left click on buttons

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement launching pinned apps

Signed-off-by: Evan Maddock <[email protected]>

* windowing, icon-tasklist: Implement adding and removing buttons when windows open and close

This sadly requires using Wnck/X11 specific APIs, and there really is no way around that unless we separate pinned launchers from running applications. But hey, it works!

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Fix button sizing

Signed-off-by: Evan Maddock <[email protected]>

* windowing: Fix tracking of active windows

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement scroll wheel handling for buttons

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Fix most of the styling with icon button popovers

Also fixes new window detection for the popover.

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Window indicator enhancements

- Move indicators away from the edge slightly
- Increase spacing for inactive window indicators
- Clean up and document (mostly) the code

The aim is to increase the indicator visibility. Before, the indicators were half off the screen, making them hard to see with certain themes.

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Hook up new window and close all buttons in popover

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Fix launch animation stopping immedietly

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Hook up pinning button functionality

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement icon reordering

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Reset button popover view on hide

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Make popover window control buttons start-aligned

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Dynamically create move to workspace buttons

Signed-off-by: Evan Maddock <[email protected]>

* windowing: Rebroadcast signals for workspace creation and deletion

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Popover cleanup

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement handling when a window becomes urgent

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Attempt to fix drag and drop for all scenarios

Spoiler: Doesn't work.

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Make indicator colors more like the old version

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Both dragging tasklist icons and desktop infos work now

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Fix launcher not being removed when unpinned

Signed-off-by: Evan Maddock <[email protected]>

* windowing/icon-tasklist: Correctly only show buttons on workspaces when
pref is set

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Cleanup

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement setting button tooltips

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Move button event handling to the main applet class

This will make it easier to implement the rest of the settings.

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement settings for launching apps

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Cleanup

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Hook up lock-icons setting

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Implement show all windows on click setting

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Remove unused files

Signed-off-by: Evan Maddock <[email protected]>

* windowing: Improve reliability of getting DesktopAppInfos for certain
applications

Signed-off-by: Evan Maddock <[email protected]>

* fix: do not have Budgie.Application be mandatory, rebase on new x4w

This should fix applications like Cinny and glxgears from not showing up in IconTasklist

* Apply suggestions from code review

Co-authored-by: Joshua Strobl <[email protected]>

* Apply suggestions from code review

Co-authored-by: Joshua Strobl <[email protected]>

* Apply suggestions from code review

Co-authored-by: Joshua Strobl <[email protected]>

* fix: compilation

* feat: implement budgie-app-(un)favorited vectors for use with ButtonPopover

* feat: clean up animations, change weird casing of widgets

* fix: remove extraneous TODO

* fix: left-align action button labels

* feat: implemented DESKTOP_IDS_TO_FORCE_WG_ICON to handle edge cases where we should not prefer app icon

* Revert "feat: implemented DESKTOP_IDS_TO_FORCE_WG_ICON to handle edge cases where we should not prefer app icon"

This reverts commit 32527ed.

* windowing: Resolve remaining TODO items

Signed-off-by: Evan Maddock <[email protected]>

* icon-tasklist: Update tooltip for pin button based on pin status

Signed-off-by: Evan Maddock <[email protected]>

---------

Signed-off-by: Evan Maddock <[email protected]>
Co-authored-by: Joshua Strobl <[email protected]>
Co-authored-by: Joshua Strobl <[email protected]>
  • Loading branch information
3 people authored Apr 16, 2024
1 parent bfab2ff commit bf436db
Show file tree
Hide file tree
Showing 28 changed files with 2,697 additions and 2,348 deletions.
2 changes: 2 additions & 0 deletions data/icons/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ app_icons = [
status_icons = [
join_paths('.', 'status', 'num-lock-symbolic.svg'),
join_paths('.', 'status', 'caps-lock-symbolic.svg'),
join_paths('.', 'status', 'budgie-app-favorited.svg'),
join_paths('.', 'status', 'budgie-app-unfavorited.svg'),
join_paths('.', 'status', 'budgie-caffeine-cup-full.svg'),
join_paths('.', 'status', 'budgie-caffeine-cup-empty.svg'),
]
Expand Down
22 changes: 22 additions & 0 deletions data/icons/status/budgie-app-favorited.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions data/icons/status/budgie-app-unfavorited.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/appindexer/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ subdir('fuzzer')

appindexer_sources = [
'AppIndex.vala',
'Application.vala',
'Category.vala',
'RelevancyService.vala',
'Switcheroo.vala'
]

libappindexer = shared_library(
Expand All @@ -16,6 +14,9 @@ libappindexer = shared_library(
dep_giounix,
dep_gtk3,
link_libfuzzer,
libpanelplugin_vapi,
link_libpanelplugin,
link_libbudgieprivate,
],
vala_args: [
'--pkg', 'gtk+-3.0',
Expand Down
3 changes: 3 additions & 0 deletions src/dialogs/run/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ rundialog_deps = [
dep_gee,
dep_giounix,
dep_gtk3,
libpanelplugin_vapi,
link_libpanelplugin,
link_libbudgieprivate,
link_libappindexer,
link_libconfig,
link_libtheme,
Expand Down
45 changes: 0 additions & 45 deletions src/lib/animation.vala
Original file line number Diff line number Diff line change
Expand Up @@ -127,62 +127,17 @@ namespace Budgie {
* and are available under the terms of the WTFPL
*/

public static double sine_ease_in_out(double p) {
return 0.5 * (1 - Math.cos(p * Math.PI));
}

public static double sine_ease_in(double p) {
return Math.sin((p - 1) * Math.PI_2) + 1;
}

public static double sine_ease_out(double p) {
return Math.sin(p * Math.PI_2);
}

public static double elastic_ease_in(double p) {
return Math.sin(13 * Math.PI_2 * p) * Math.pow(2, 10 * (p - 1));
}

public static double elastic_ease_out(double p) {
return Math.sin(-13 * Math.PI_2 * (p + 1)) * Math.pow(2, -10 * p) + 1;
}

public static double back_ease_in(double p) {
return p * p * p - p * Math.sin(p * Math.PI);
}

public static double back_ease_out(double p) {
double f = (1 - p);
return 1 - (f * f * f - f * Math.sin(f * Math.PI));
}

public static double expo_ease_in(double p) {
return (p == 0.0) ? p : Math.pow(2, 10 * (p - 1));
}

public static double expo_ease_out(double p) {
return (p == 1.0) ? p : 1 - Math.pow(2, -10 * p);
}

public static double quad_ease_in(double p) {
return p * p;
}

public static double quad_ease_out(double p) {
return -(p * (p - 2));
}

public static double quad_ease_in_out(double p) {
return p < 0.5 ? (2 * p * p) : (-2 * p * p) + (4 * p) - 1;
}

public static double circ_ease_in(double p) {
return 1 - Math.sqrt(1 - (p * p));
}

public static double circ_ease_out(double p) {
return Math.sqrt((2 - p) * p);
}

public const int64 MSECOND = 1000;
}
58 changes: 42 additions & 16 deletions src/appindexer/Application.vala → src/lib/application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Budgie {
public bool prefers_default_gpu { get; private set; default = false; }
public bool should_show { get; private set; default = true; }
public bool dbus_activatable { get; private set; default = false; }
public unowned string[] actions { get; private set; }

/**
* Emitted when the application is launched.
Expand Down Expand Up @@ -60,6 +61,7 @@ namespace Budgie {
this.prefers_default_gpu = !app_info.get_boolean("PrefersNonDefaultGPU");
this.should_show = app_info.should_show();
this.dbus_activatable = app_info.get_boolean("DBusActivatable");
this.actions = app_info.list_actions();

// Try to get an icon from the desktop file
var desktop_icon = app_info.get_icon();
Expand All @@ -76,13 +78,36 @@ namespace Budgie {
this.switcheroo = new Switcheroo();
}

public AppLaunchContext create_launch_context() {
// Create a launch context and try to apply a GPU profile
var context = new AppLaunchContext();

// Hook up our signals for rebroadcast
context.launched.connect((info, data) => {
this.launched(info, data);
});
context.launch_failed.connect((startup_id) => {
this.launch_failed(startup_id);
});

// Try to apply a GPU profile if necessary for multiple GPU setups
switcheroo.apply_gpu_profile(context, this.prefers_default_gpu);

return context;
}

public bool launch() {
var context = create_launch_context();
return launch_with_context(context);
}

/**
* Launch this application.
*
* Returns `true` if the application launched successfully,
* otherwise `false`.
*/
public bool launch() {
public bool launch_with_context(AppLaunchContext context) {
try {
var info = new DesktopAppInfo(this.desktop_id);
/*
Expand Down Expand Up @@ -117,21 +142,6 @@ namespace Budgie {
});
} else {
// No pkexec, use the DesktopAppInfo to launch the app
// Create a launch context and try to apply a GPU profile
var context = new AppLaunchContext();

// Hook up our signals for rebroadcast
context.launched.connect((info, data) => {
this.launched(info, data);
});
context.launch_failed.connect((startup_id) => {
this.launch_failed(startup_id);
});

// Try to apply a GPU profile if necessary for multiple GPU setups
switcheroo.apply_gpu_profile(context, this.prefers_default_gpu);

// Launch the application
new DesktopAppInfo(this.desktop_id).launch(null, context);
}
} catch (Error e) {
Expand All @@ -141,5 +151,21 @@ namespace Budgie {

return true;
}

/**
* Launch this application with the given action.
*/
public void launch_action(string action) {
var context = create_launch_context();

launch_action_with_context(action, context);
}

/**
* Launch this application with the given action and launch context.
*/
public void launch_action_with_context(string action, AppLaunchContext context) {
new DesktopAppInfo(this.desktop_id).launch_action(action, context);
}
}
}
4 changes: 3 additions & 1 deletion src/lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

libbudgieprivate_sources = [
'animation.vala',
'application.vala',
'toplevel.vala',
'shadow.vala',
'manager.vala',
'notification.vala'
'notification.vala',
'switcheroo.vala',
]

libbudgieprivate = shared_library(
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ subdir('config')
subdir('libsession')

# Needed for daemon + applets
subdir('appindexer')
subdir('appsys')
subdir('abomination')

subdir('theme')
subdir('lib')
subdir('raven')
subdir('windowing')
subdir('appindexer')

# Executable components
subdir('daemon')
Expand Down
2 changes: 1 addition & 1 deletion src/panel/applets/budgie-menu/BudgieMenuButtons.vala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class MenuButton : Gtk.Button {
hexpand = true,
};

const Gtk.TargetEntry[] drag_targets = { {"text/uri-list", 0, 0 }, {"application/x-desktop", 0, 0 } };
const Gtk.TargetEntry[] drag_targets = { {"text/uri-list", 0, 0 } };
Gtk.drag_source_set(this, Gdk.ModifierType.BUTTON1_MASK, drag_targets, Gdk.DragAction.COPY);
base.drag_begin.connect(this.drag_begin);
base.drag_end.connect(this.drag_end);
Expand Down
3 changes: 2 additions & 1 deletion src/panel/applets/budgie-menu/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ applet_budgiemenu_deps = [
dep_peas,
dep_accountsservice,
dep_cairo,
link_libappindexer,
link_libpanelplugin,
link_libbudgieprivate,
link_libappindexer,
]

shared_library(
Expand Down
91 changes: 0 additions & 91 deletions src/panel/applets/icon-tasklist/DesktopHelper.vala

This file was deleted.

Loading

0 comments on commit bf436db

Please sign in to comment.