-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Animation PR #1032
Animation PR #1032
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,24 @@ enum backend { | |
NUM_BKEND, | ||
}; | ||
|
||
enum open_window_animation { | ||
OPEN_WINDOW_ANIMATION_NONE = 0, | ||
OPEN_WINDOW_ANIMATION_FLYIN, | ||
OPEN_WINDOW_ANIMATION_SLIDE_UP, | ||
OPEN_WINDOW_ANIMATION_SLIDE_DOWN, | ||
OPEN_WINDOW_ANIMATION_SLIDE_LEFT, | ||
OPEN_WINDOW_ANIMATION_SLIDE_RIGHT, | ||
OPEN_WINDOW_ANIMATION_SLIDE_IN, | ||
OPEN_WINDOW_ANIMATION_SLIDE_OUT, | ||
OPEN_WINDOW_ANIMATION_SLIDE_IN_CENTER, | ||
OPEN_WINDOW_ANIMATION_SLIDE_OUT_CENTER, | ||
OPEN_WINDOW_ANIMATION_ZOOM, | ||
OPEN_WINDOW_ANIMATION_MINIMIZE, | ||
OPEN_WINDOW_ANIMATION_SQUEEZE, | ||
OPEN_WINDOW_ANIMATION_SQUEEZE_BOTTOM, | ||
OPEN_WINDOW_ANIMATION_INVALID, | ||
}; | ||
|
||
typedef struct win_option_mask { | ||
bool shadow : 1; | ||
bool fade : 1; | ||
|
@@ -49,6 +67,7 @@ typedef struct win_option_mask { | |
bool redir_ignore : 1; | ||
bool opacity : 1; | ||
bool clip_shadow_above : 1; | ||
enum open_window_animation animation; | ||
} win_option_mask_t; | ||
|
||
typedef struct win_option { | ||
|
@@ -60,6 +79,7 @@ typedef struct win_option { | |
bool redir_ignore; | ||
double opacity; | ||
bool clip_shadow_above; | ||
enum open_window_animation animation; | ||
} win_option_t; | ||
|
||
enum blur_method { | ||
|
@@ -172,6 +192,32 @@ typedef struct options { | |
/// Fading blacklist. A linked list of conditions. | ||
c2_lptr_t *fade_blacklist; | ||
|
||
// === Animations === | ||
/// Whether to do window animations | ||
bool animations; | ||
/// Which animation to run when opening a window | ||
enum open_window_animation animation_for_open_window; | ||
/// Which animation to run when opening a transient window | ||
enum open_window_animation animation_for_transient_window; | ||
/// Which animation to run when unmapping a window | ||
enum open_window_animation animation_for_unmap_window; | ||
/// Which animation to run when swapping to new tag | ||
enum open_window_animation animation_for_tag_change; | ||
/// number of desktops to strip at the end of the list | ||
int animation_extra_desktops; | ||
/// Spring stiffness for animation | ||
double animation_stiffness; | ||
/// Spring stiffness for current tag animation | ||
double animation_stiffness_tag_change; | ||
/// Window mass for animation | ||
double animation_window_mass; | ||
/// Animation dampening | ||
double animation_dampening; | ||
/// Whether to clamp animations | ||
bool animation_clamping; | ||
/// Animation blacklist. A linked list of conditions. | ||
c2_lptr_t *animation_blacklist; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
// === Opacity === | ||
/// Default opacity for inactive windows. | ||
/// 32-bit integer with the format of _NET_WM_WINDOW_OPACITY. | ||
|
@@ -271,6 +317,7 @@ bool must_use parse_rule_window_shader(c2_lptr_t **, const char *, const char *) | |
char *must_use locate_auxiliary_file(const char *scope, const char *path, | ||
const char *include_dir); | ||
enum blur_method must_use parse_blur_method(const char *src); | ||
enum open_window_animation must_use parse_open_window_animation(const char *src); | ||
|
||
/** | ||
* Add a pattern to a condition linked list. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,17 @@ static const struct picom_option picom_options[] = { | |
"you want to attach a debugger to picom"}, | ||
{"no-ewmh-fullscreen" , no_argument , 803, NULL , "Do not use EWMH to detect fullscreen windows. Reverts to checking if a " | ||
"window is fullscreen based only on its size and coordinates."}, | ||
{"animations" ,no_argument , 804, NULL , "Enable/disable animations."}, | ||
{"animation-stiffness-in-tag" , required_argument, 805, NULL , "Animation speed in current tag (float)."}, | ||
{"animation-stiffness-tag-change", required_argument, 806, NULL , "Animation speed when tag changes (change to a new desktop)."}, | ||
{"animation-dampening" , required_argument, 807, NULL , "Animation dampening ratio (spring dampening as an example)."}, | ||
{"animation-window-mass" , required_argument, 808, NULL , "Animation window mass (lower mass makes animations bumpy)."}, | ||
{"animation-clamping" , no_argument , 809, NULL , "Enable/disable animation clamping. Disabling increases performance"}, | ||
{"animation-for-open-window" , required_argument, 810, NULL , "Set animation for opening window (Check sample.conf for options)."}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I switched to hyprland in the meantime and quite happy with it so I'm not sure I'll spend a lot of time on this PR, I can do some tiny things but maybe not more... note that most of the code isn't from me, I just simplified some of the code and added a couple of things after fixing it for my own use case. Looks like FTLabs made another branch which could be worth checking: https://github.com/FT-Labs/picom/tree/generalanimation |
||
{"animation-for-transient-window", required_argument, 811, NULL , "Set animation for transient (child) windows."}, | ||
// blacklist ?? | ||
{"animation-for-tag-change", required_argument , 813, NULL , "Set animation for switching desktops."}, | ||
{"animation-extra-desktops", required_argument , 814, NULL , "N desktops will not be considered as standard desktops (useful for some window managers)."}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no command for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, it's always the "mirror" animation of the "open". |
||
}; | ||
// clang-format on | ||
|
||
|
@@ -738,6 +749,72 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, | |
break; | ||
P_CASEBOOL(802, debug_mode); | ||
P_CASEBOOL(803, no_ewmh_fullscreen); | ||
P_CASEBOOL(804, animations); | ||
case 805: | ||
// --animation-stiffness | ||
opt->animation_stiffness = atof(optarg); | ||
break; | ||
case 806: | ||
// --animation-stiffness-for-tags | ||
opt->animation_stiffness_tag_change = atof(optarg); | ||
break; | ||
case 807: | ||
// --animation-dampening | ||
opt->animation_dampening = atof(optarg); | ||
break; | ||
case 808: | ||
// --animation-window-masss | ||
opt->animation_window_mass = atof(optarg); | ||
break; | ||
case 809: | ||
// --animation-clamping | ||
opt->animation_clamping = true; | ||
break; | ||
case 810: { | ||
// --animation-for-open-window | ||
enum open_window_animation animation = parse_open_window_animation(optarg); | ||
if (animation >= OPEN_WINDOW_ANIMATION_INVALID) { | ||
log_warn("Invalid open-window animation %s, ignoring.", optarg); | ||
} else { | ||
opt->animation_for_open_window = animation; | ||
} | ||
break; | ||
} | ||
case 811: { | ||
// --animation-for-transient-window | ||
enum open_window_animation animation = parse_open_window_animation(optarg); | ||
if (animation >= OPEN_WINDOW_ANIMATION_INVALID) { | ||
log_warn("Invalid transient-window animation %s, ignoring.", optarg); | ||
} else { | ||
opt->animation_for_transient_window = animation; | ||
} | ||
break; | ||
} | ||
case 812: { | ||
// --animation-exclude | ||
condlst_add(&opt->animation_blacklist, optarg); | ||
break; | ||
} | ||
case 813: { | ||
// --animation-for-tag-change | ||
enum open_window_animation animation = parse_open_window_animation(optarg); | ||
if (animation >= OPEN_WINDOW_ANIMATION_INVALID) { | ||
log_warn("Invalid tag-change animation %s, ignoring.", optarg); | ||
} else { | ||
if (animation == OPEN_WINDOW_ANIMATION_SLIDE_RIGHT) { | ||
animation = OPEN_WINDOW_ANIMATION_SLIDE_LEFT; | ||
} | ||
if (animation == OPEN_WINDOW_ANIMATION_SLIDE_DOWN) { | ||
animation = OPEN_WINDOW_ANIMATION_SLIDE_UP; | ||
} | ||
opt->animation_for_tag_change = animation; | ||
} | ||
break; | ||
} | ||
case 814: { | ||
opt->animation_extra_desktops = atoi(optarg); | ||
break; | ||
} | ||
default: usage(argv[0], 1); break; | ||
#undef P_CASEBOOL | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo
window_animation
is more suited name