Skip to content

Commit

Permalink
Merge branch 'WayfireWM:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsteve0924 authored Mar 15, 2024
2 parents d3728b6 + b134f11 commit 643b451
Show file tree
Hide file tree
Showing 88 changed files with 1,549 additions and 504 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- run: sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
- run: pacman --noconfirm --noprogressbar -Syyu
- run: pacman --noconfirm --noprogressbar -Sy git clang lld libc++ pkgconf cmake meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd hwdata libdisplay-info
- run: pacman --noconfirm --noprogressbar -Sy git clang lld libc++ pkgconf cmake meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd hwdata libdisplay-info openmp

# Build Wayfire
- uses: actions/checkout@v1
Expand Down
54 changes: 54 additions & 0 deletions ipc-scripts/input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import wayfire_socket as ws
import os
import argparse
import tabulate

# Usage:
# input.py list-inputs
# input.py enable <id>
# input.py disable <id>

# argparse is used to parse the command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('action', choices=['list-inputs', 'enable', 'disable'])
parser.add_argument('device', nargs='?', default=None)
args = parser.parse_args()

if args.action == 'list-inputs' and args.device is not None:
print('Invalid usage, no arguments allowed when listing inputs!')
exit(-1)

if args.device is None and args.action != 'list-inputs':
print('Invalid usage, an input id >= 0 is required!')
exit(-1)

addr = os.getenv('WAYFIRE_SOCKET')
sock = ws.WayfireSocket(addr)

devices = sock.list_input_devices()

def find_device_id(name_or_id_or_type):
for dev in devices:
if dev['name'] == name_or_id_or_type or str(dev['id']) == name_or_id_or_type or dev['type'] == name_or_id_or_type:
return dev['id']
return None

if args.action == 'list-inputs':

headers = ["Name", "ID", "Type", "Vendor/Product", "Enabled"]
data = []
for dev in devices:
data.append([
dev['name'],
str(dev['id']),
dev['type'],
str(dev['vendor']) + ', ' + str(dev['product']),
dev['enabled']
])

print(tabulate.tabulate(data, headers))

elif args.action == 'enable':
print(sock.configure_input_device(find_device_id(args.device), True))
elif args.action == 'disable':
print(sock.configure_input_device(find_device_id(args.device), False))
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ glesv2 = dependency('glesv2')
glm = dependency('glm')
libinput = dependency('libinput', version: '>=1.7.0')
pixman = dependency('pixman-1')
threads = dependency('threads')
xkbcommon = dependency('xkbcommon')
libdl = meson.get_compiler('cpp').find_library('dl')

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
option('enable_gles32', type: 'boolean', value: true, description: 'Enable usage of GLES 3.2')
option('enable_openmp', type: 'boolean', value: true, description: 'Enable usage of OpenMP')
option('use_system_wfconfig', type: 'feature', value: 'auto', description: 'Use the system-wide installation of wf-config')
option('use_system_wlroots', type: 'feature', value: 'auto', description: 'Use the system-wide installation of wlroots')
option('xwayland', type: 'feature', value: 'auto', description: 'Build with xwayland support. Requires wlroots also built with xwayland support')
Expand Down
20 changes: 10 additions & 10 deletions metadata/animate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,48 +53,48 @@
<_long>Specifies the window types to be animated.</_long>
<default>(type equals "toplevel" | (type equals "x-or" &amp; focusable equals true))</default>
</option>
<option name="duration" type="int">
<option name="duration" type="animation">
<_short>Duration</_short>
<_long>Sets the duration of the animation in milliseconds.</_long>
<default>400</default>
<default>400ms</default>
</option>
<option name="startup_duration" type="int">
<option name="startup_duration" type="animation">
<_short>System fade duration when Wayfire starts</_short>
<_long>Sets the duration of fading (in milliseconds) when Wayfire starts.</_long>
<default>600</default>
<default>600ms linear</default>
</option>
<!-- Fade animation -->
<option name="fade_enabled_for" type="string">
<_short>Fade animation enabled for specified window types</_short>
<_long>Specifies the window types to be animated with a fade effect.</_long>
<default>type equals "overlay"</default>
</option>
<option name="fade_duration" type="int">
<option name="fade_duration" type="animation">
<_short>Fade duration</_short>
<_long>Sets the duration for the _fade_ animation in milliseconds. Only applies for windows matched by `animate.fade_enabled_for`.</_long>
<default>400</default>
<default>400ms</default>
</option>
<!-- Zoom animation -->
<option name="zoom_enabled_for" type="string">
<_short>Zoom animation enabled for specified window types</_short>
<_long>Specifies the window types to be animated with a zoom effect.</_long>
<default>none</default>
</option>
<option name="zoom_duration" type="int">
<option name="zoom_duration" type="animation">
<_short>Zoom duration</_short>
<_long>Sets the duration for the _zoom_ animation in milliseconds. Only applies for windows matched by `animate.zoom_enabled_for`.</_long>
<default>500</default>
<default>500ms circle</default>
</option>
<!-- Fire animation -->
<option name="fire_enabled_for" type="string">
<_short>Fire animation enabled for specified window types</_short>
<_long>Specifies the window types to be animated with a fire effect.</_long>
<default>none</default>
</option>
<option name="fire_duration" type="int">
<option name="fire_duration" type="animation">
<_short>Fire duration</_short>
<_long>Sets the duration for the _fire_ animation in milliseconds. Only applies for windows matched by `animate.fire_enabled_for`.</_long>
<default>300</default>
<default>300ms linear</default>
</option>
<option name="fire_particles" type="int">
<_short>Fire particles</_short>
Expand Down
4 changes: 2 additions & 2 deletions metadata/cube.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
<default>0.1</default>
<precision>0.01</precision>
</option>
<option name="initial_animation" type="int">
<option name="initial_animation" type="animation">
<_short>Duration</_short>
<_long>Sets the initial animation duration in milliseconds.</_long>
<default>350</default>
<default>350ms</default>
</option>
<!-- Velocity -->
<option name="speed_zoom" type="double">
Expand Down
4 changes: 2 additions & 2 deletions metadata/expo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<_long>Sets the background color.</_long>
<default>0.1 0.1 0.1 1.0</default>
</option>
<option name="duration" type="int">
<option name="duration" type="animation">
<_short>Zoom duration</_short>
<_long>Sets the zoom duration in milliseconds.</_long>
<default>300</default>
<default>300ms circle</default>
</option>
<option name="offset" type="int">
<_short>Delimiter offset</_short>
Expand Down
4 changes: 2 additions & 2 deletions metadata/grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<_short>Grid</_short>
<_long>A plugin to position the windows in certain regions of the output.</_long>
<category>Window Management</category>
<option name="duration" type="int">
<option name="duration" type="animation">
<_short>Duration</_short>
<_long>Sets the duration of the animation in milliseconds.</_long>
<default>300</default>
<default>300ms</default>
</option>
<option name="type" type="string">
<_short>Type</_short>
Expand Down
8 changes: 8 additions & 0 deletions metadata/input-method-v1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<wayfire>
<plugin name="input-method-v1">
<_short>Input-Method-V1 Protocol</_short>
<_long>An implementation of the input-method-v1 protocol. Needed for proper functioning of input methods like Fcitx5.</_long>
<category>Utility</category>
</plugin>
</wayfire>
1 change: 1 addition & 0 deletions metadata/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ install_data('gtk-shell.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('idle.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('input.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('input-device.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('input-method-v1.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('invert.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('ipc.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
install_data('ipc-rules.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
Expand Down
10 changes: 8 additions & 2 deletions metadata/scale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<_long>Toggles scale showing windows from all workspaces.</_long>
<default></default>
</option>
<option name="duration" type="int">
<option name="duration" type="animation">
<_short>Animation Transition Time</_short>
<_long>Time it takes for views to transition. Units are in milliseconds.</_long>
<default>750</default>
<default>750ms</default>
<min>0</min>
</option>
<option name="allow_zoom" type="bool">
Expand All @@ -46,6 +46,12 @@
<default>50</default>
<min>0</min>
</option>
<option name="outer_margin" type="int">
<_short>Outer Margin</_short>
<_long>The outer margin is the space reserved between the scaled windows and the monitor edges while scale is active.</_long>
<default>0</default>
<min>0</min>
</option>
<option name="inactive_alpha" type="double">
<_short>Inactive Opacity</_short>
<_long>Set the opacity value of the inactive windows.</_long>
Expand Down
2 changes: 1 addition & 1 deletion metadata/simple-tile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<_long>Number of pixels to shrink of a view when it has no neighbor above or below.</_long>
<default>0</default>
</option>
<option name="animation_duration" type="int">
<option name="animation_duration" type="animation">
<_short>Resize animation duration</_short>
<_long>The duration of the crossfade animation in situations where a tiled view's geometry changes.</_long>
<default>0</default>
Expand Down
2 changes: 1 addition & 1 deletion metadata/switcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<default>&lt;alt&gt; &lt;shift&gt; KEY_TAB</default>
</option>
<!-- Effects -->
<option name="speed" type="int">
<option name="speed" type="animation">
<_short>Duration</_short>
<_long>Sets the duration of the animation in milliseconds.</_long>
<default>500</default>
Expand Down
4 changes: 2 additions & 2 deletions metadata/vswipe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<_long>Enables or disables smooth transition.</_long>
<default>false</default>
</option>
<option name="duration" type="int">
<option name="duration" type="animation">
<_short>Duration</_short>
<_long>Sets the duration of the animation in milliseconds.</_long>
<default>180</default>
<default>180ms</default>
</option>
<option name="background" type="color">
<_short>Background color</_short>
Expand Down
2 changes: 1 addition & 1 deletion metadata/vswitch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</entry>
</option>

<option name="duration" type="int">
<option name="duration" type="animation">
<_short>Duration</_short>
<_long>Sets the duration of the workspace switching animation in milliseconds.</_long>
<default>300</default>
Expand Down
4 changes: 4 additions & 0 deletions metadata/workarounds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<option name="discard_command_output" type="bool">
<_short>Discard output from commands invoked by Wayfire, so that they don't end up in the logs.</_short>
<default>true</default>
</option>
<option name="enable_input_method_v2" type="bool">
<_short>Enable support for the newer input-method-v2 protocol. Note that the input-method-v1 protocol works better in many cases.</_short>
<default>false</default>
</option>
</plugin>
</wayfire>
4 changes: 2 additions & 2 deletions metadata/wsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<_long>A binding to move the currently focused window to the workspace set #N.</_long>
<entry prefix="send_to_wset_" type="activator"/>
</option>
<option name="label_duration" type="int">
<option name="label_duration" type="animation">
<_short>Label duration</_short>
<_long>Sets the duration in milliseconds for which the workspace set label is shown.</_long>
<default>2000</default>
<default>2s linear</default>
</option>
</plugin>
</wayfire>
4 changes: 2 additions & 2 deletions metadata/zoom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<default>0.01</default>
<precision>0.001</precision>
</option>
<option name="smoothing_duration" type="int">
<option name="smoothing_duration" type="animation">
<_short>Smoothing duration</_short>
<_long>Sets the smoothing duration in milliseconds.</_long>
<default>300</default>
<default>300ms linear</default>
</option>
<option name="interpolation_method" type="int">
<_short>Interpolation method</_short>
Expand Down
22 changes: 10 additions & 12 deletions plugins/animate/animate.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include <cstddef>
#include <wayfire/per-output-plugin.hpp>
#include <wayfire/output.hpp>
#include <wayfire/signal-definitions.hpp>
#include <wayfire/render-manager.hpp>
#include <wayfire/workspace-set.hpp>
#include <type_traits>
#include <map>
#include <wayfire/core.hpp>
#include "animate.hpp"
#include "system_fade.hpp"
Expand All @@ -19,7 +17,7 @@
#include "wayfire/view.hpp"
#include <wayfire/matcher.hpp>

void animation_base::init(wayfire_view, int, wf_animation_type)
void animation_base::init(wayfire_view, wf::animation_description_t, wf_animation_type)
{}
bool animation_base::step()
{
Expand Down Expand Up @@ -122,7 +120,7 @@ struct animation_hook : public animation_hook_base
set_output(view->get_output());
};

animation_hook(wayfire_view view, int duration, wf_animation_type type,
animation_hook(wayfire_view view, wf::animation_description_t duration, wf_animation_type type,
std::string name)
{
this->type = type;
Expand Down Expand Up @@ -269,12 +267,12 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_
wf::option_wrapper_t<std::string> open_animation{"animate/open_animation"};
wf::option_wrapper_t<std::string> close_animation{"animate/close_animation"};

wf::option_wrapper_t<int> default_duration{"animate/duration"};
wf::option_wrapper_t<int> fade_duration{"animate/fade_duration"};
wf::option_wrapper_t<int> zoom_duration{"animate/zoom_duration"};
wf::option_wrapper_t<int> fire_duration{"animate/fire_duration"};
wf::option_wrapper_t<wf::animation_description_t> default_duration{"animate/duration"};
wf::option_wrapper_t<wf::animation_description_t> fade_duration{"animate/fade_duration"};
wf::option_wrapper_t<wf::animation_description_t> zoom_duration{"animate/zoom_duration"};
wf::option_wrapper_t<wf::animation_description_t> fire_duration{"animate/fire_duration"};

wf::option_wrapper_t<int> startup_duration{"animate/startup_duration"};
wf::option_wrapper_t<wf::animation_description_t> startup_duration{"animate/startup_duration"};

wf::view_matcher_t animation_enabled_for{"animate/enabled_for"};
wf::view_matcher_t fade_enabled_for{"animate/fade_enabled_for"};
Expand Down Expand Up @@ -308,7 +306,7 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_
struct view_animation_t
{
std::string animation_name;
int duration;
wf::animation_description_t duration;
};

view_animation_t get_animation_for_view(
Expand Down Expand Up @@ -337,7 +335,7 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_
return {anim_type, default_duration};
}

return {"none", 0};
return {"none", wf::animation_description_t{0, {}, ""}};
}

bool try_reverse(wayfire_view view, wf_animation_type type, std::string name,
Expand All @@ -359,7 +357,7 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_

template<class animation_t>
void set_animation(wayfire_view view,
wf_animation_type type, int duration, std::string name)
wf_animation_type type, wf::animation_description_t duration, std::string name)
{
name = "animation-hook-" + name;

Expand Down
2 changes: 1 addition & 1 deletion plugins/animate/animate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum wf_animation_type
class animation_base
{
public:
virtual void init(wayfire_view view, int duration, wf_animation_type type);
virtual void init(wayfire_view view, wf::animation_description_t duration, wf_animation_type type);
virtual bool step(); /* return true if continue, false otherwise */
virtual void reverse(); /* reverse the animation */
virtual int get_direction();
Expand Down
Loading

0 comments on commit 643b451

Please sign in to comment.