diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/_incr_version | 21 | ||||
-rwxr-xr-x | contrib/autoname-workspaces.py | 130 | ||||
-rwxr-xr-x | contrib/grimshot | 154 | ||||
-rw-r--r-- | contrib/grimshot.1 | 103 | ||||
-rw-r--r-- | contrib/grimshot.1.scd | 76 | ||||
-rwxr-xr-x | contrib/inactive-windows-transparency.py | 64 |
6 files changed, 0 insertions, 548 deletions
diff --git a/contrib/_incr_version b/contrib/_incr_version deleted file mode 100755 index a4fa2654..00000000 --- a/contrib/_incr_version +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #!/bin/sh -eu | ||
2 | old_version="$1" | ||
3 | new_version="$2" | ||
4 | |||
5 | if [ "$new_version" != "${new_version#v}" ] | ||
6 | then | ||
7 | echo "Error: The new version shouldn't be prefixed with a \"v\"." >&2 | ||
8 | exit 1 | ||
9 | fi | ||
10 | |||
11 | sed -i meson.build -e "s/^ version: .*#release_version/ version: '$new_version', #release_version/g" | ||
12 | |||
13 | printf "Minimum wlroots version? " | ||
14 | read wlr_version_min | ||
15 | printf "Maximum wlroots version? " | ||
16 | read wlr_version_max | ||
17 | |||
18 | sed -i meson.build -e "s/wlroots_version =.*/wlroots_version = ['>=$wlr_version_min', '<$wlr_version_max']/" | ||
19 | |||
20 | git add meson.build | ||
21 | git commit -m "Update version to $new_version" | ||
diff --git a/contrib/autoname-workspaces.py b/contrib/autoname-workspaces.py deleted file mode 100755 index 297d91b2..00000000 --- a/contrib/autoname-workspaces.py +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | #!/usr/bin/python | ||
2 | |||
3 | # This script requires i3ipc-python package (install it from a system package manager | ||
4 | # or pip). | ||
5 | # It adds icons to the workspace name for each open window. | ||
6 | # Set your keybindings like this: set $workspace1 workspace number 1 | ||
7 | # Add your icons to WINDOW_ICONS. | ||
8 | # Based on https://github.com/maximbaz/dotfiles/blob/master/bin/i3-autoname-workspaces | ||
9 | |||
10 | import argparse | ||
11 | import i3ipc | ||
12 | import logging | ||
13 | import re | ||
14 | import signal | ||
15 | import sys | ||
16 | |||
17 | WINDOW_ICONS = { | ||
18 | "firefox": "", | ||
19 | } | ||
20 | |||
21 | DEFAULT_ICON = "" | ||
22 | |||
23 | |||
24 | def icon_for_window(window): | ||
25 | app_id = window.app_id | ||
26 | if app_id is not None and len(app_id) > 0: | ||
27 | app_id = app_id.lower() | ||
28 | if app_id in WINDOW_ICONS: | ||
29 | return WINDOW_ICONS[app_id] | ||
30 | logging.info("No icon available for window with app_id: %s" % str(app_id)) | ||
31 | else: | ||
32 | # xwayland support | ||
33 | class_name = window.window_class | ||
34 | if len(class_name) > 0: | ||
35 | class_name = class_name.lower() | ||
36 | if class_name in WINDOW_ICONS: | ||
37 | return WINDOW_ICONS[class_name] | ||
38 | logging.info( | ||
39 | "No icon available for window with class_name: %s" % str(class_name) | ||
40 | ) | ||
41 | return DEFAULT_ICON | ||
42 | |||
43 | |||
44 | def rename_workspaces(ipc): | ||
45 | for workspace in ipc.get_tree().workspaces(): | ||
46 | name_parts = parse_workspace_name(workspace.name) | ||
47 | icon_tuple = () | ||
48 | for w in workspace: | ||
49 | if w.app_id is not None or w.window_class is not None: | ||
50 | icon = icon_for_window(w) | ||
51 | if not ARGUMENTS.duplicates and icon in icon_tuple: | ||
52 | continue | ||
53 | icon_tuple += (icon,) | ||
54 | name_parts["icons"] = " ".join(icon_tuple) + " " | ||
55 | new_name = construct_workspace_name(name_parts) | ||
56 | ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name)) | ||
57 | |||
58 | |||
59 | def undo_window_renaming(ipc): | ||
60 | for workspace in ipc.get_tree().workspaces(): | ||
61 | name_parts = parse_workspace_name(workspace.name) | ||
62 | name_parts["icons"] = None | ||
63 | new_name = construct_workspace_name(name_parts) | ||
64 | ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name)) | ||
65 | ipc.main_quit() | ||
66 | sys.exit(0) | ||
67 | |||
68 | |||
69 | def parse_workspace_name(name): | ||
70 | return re.match( | ||
71 | "(?P<num>[0-9]+):?(?P<shortname>\w+)? ?(?P<icons>.+)?", name | ||
72 | ).groupdict() | ||
73 | |||
74 | |||
75 | def construct_workspace_name(parts): | ||
76 | new_name = str(parts["num"]) | ||
77 | if parts["shortname"] or parts["icons"]: | ||
78 | new_name += ":" | ||
79 | |||
80 | if parts["shortname"]: | ||
81 | new_name += parts["shortname"] | ||
82 | |||
83 | if parts["icons"]: | ||
84 | new_name += " " + parts["icons"] | ||
85 | |||
86 | return new_name | ||
87 | |||
88 | |||
89 | if __name__ == "__main__": | ||
90 | parser = argparse.ArgumentParser( | ||
91 | description="This script automatically changes the workspace name in sway depending on your open applications." | ||
92 | ) | ||
93 | parser.add_argument( | ||
94 | "--duplicates", | ||
95 | "-d", | ||
96 | action="store_true", | ||
97 | help="Set it when you want an icon for each instance of the same application per workspace.", | ||
98 | ) | ||
99 | parser.add_argument( | ||
100 | "--logfile", | ||
101 | "-l", | ||
102 | type=str, | ||
103 | default="/tmp/sway-autoname-workspaces.log", | ||
104 | help="Path for the logfile.", | ||
105 | ) | ||
106 | args = parser.parse_args() | ||
107 | global ARGUMENTS | ||
108 | ARGUMENTS = args | ||
109 | |||
110 | logging.basicConfig( | ||
111 | level=logging.INFO, | ||
112 | filename=ARGUMENTS.logfile, | ||
113 | filemode="w", | ||
114 | format="%(message)s", | ||
115 | ) | ||
116 | |||
117 | ipc = i3ipc.Connection() | ||
118 | |||
119 | for sig in [signal.SIGINT, signal.SIGTERM]: | ||
120 | signal.signal(sig, lambda signal, frame: undo_window_renaming(ipc)) | ||
121 | |||
122 | def window_event_handler(ipc, e): | ||
123 | if e.change in ["new", "close", "move"]: | ||
124 | rename_workspaces(ipc) | ||
125 | |||
126 | ipc.on("window", window_event_handler) | ||
127 | |||
128 | rename_workspaces(ipc) | ||
129 | |||
130 | ipc.main() | ||
diff --git a/contrib/grimshot b/contrib/grimshot deleted file mode 100755 index 461a5eef..00000000 --- a/contrib/grimshot +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ## Grimshot: a helper for screenshots within sway | ||
4 | ## Requirements: | ||
5 | ## - `grim`: screenshot utility for wayland | ||
6 | ## - `slurp`: to select an area | ||
7 | ## - `swaymsg`: to read properties of current window | ||
8 | ## - `wl-copy`: clipboard utility | ||
9 | ## - `jq`: json utility to parse swaymsg output | ||
10 | ## - `notify-send`: to show notifications | ||
11 | ## Those are needed to be installed, if unsure, run `grimshot check` | ||
12 | ## | ||
13 | ## See `man 1 grimshot` or `grimshot usage` for further details. | ||
14 | |||
15 | getTargetDirectory() { | ||
16 | test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && \ | ||
17 | . ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs | ||
18 | |||
19 | echo ${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}} | ||
20 | } | ||
21 | |||
22 | if [ "$1" = "--notify" ]; then | ||
23 | NOTIFY=yes | ||
24 | shift 1 | ||
25 | else | ||
26 | NOTIFY=no | ||
27 | fi | ||
28 | |||
29 | ACTION=${1:-usage} | ||
30 | SUBJECT=${2:-screen} | ||
31 | FILE=${3:-$(getTargetDirectory)/$(date -Ins).png} | ||
32 | |||
33 | if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then | ||
34 | echo "Usage:" | ||
35 | echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE]" | ||
36 | echo " grimshot check" | ||
37 | echo " grimshot usage" | ||
38 | echo "" | ||
39 | echo "Commands:" | ||
40 | echo " copy: Copy the screenshot data into the clipboard." | ||
41 | echo " save: Save the screenshot to a regular file." | ||
42 | echo " check: Verify if required tools are installed and exit." | ||
43 | echo " usage: Show this message and exit." | ||
44 | echo "" | ||
45 | echo "Targets:" | ||
46 | echo " active: Currently active window." | ||
47 | echo " screen: All visible outputs." | ||
48 | echo " output: Currently active output." | ||
49 | echo " area: Manually select a region." | ||
50 | echo " window: Manually select a window." | ||
51 | exit | ||
52 | fi | ||
53 | |||
54 | notify() { | ||
55 | notify-send -t 3000 -a grimshot "$@" | ||
56 | } | ||
57 | notifyOk() { | ||
58 | [ "$NOTIFY" = "no" ] && return | ||
59 | |||
60 | TITLE=${2:-"Screenshot"} | ||
61 | MESSAGE=${1:-"OK"} | ||
62 | notify "$TITLE" "$MESSAGE" | ||
63 | } | ||
64 | notifyError() { | ||
65 | if [ $NOTIFY = "yes" ]; then | ||
66 | TITLE=${2:-"Screenshot"} | ||
67 | MESSAGE=${1:-"Error taking screenshot with grim"} | ||
68 | notify -u critical "$TITLE" "$MESSAGE" | ||
69 | else | ||
70 | echo $1 | ||
71 | fi | ||
72 | } | ||
73 | |||
74 | die() { | ||
75 | MSG=${1:-Bye} | ||
76 | notifyError "Error: $MSG" | ||
77 | exit 2 | ||
78 | } | ||
79 | |||
80 | check() { | ||
81 | COMMAND=$1 | ||
82 | if command -v "$COMMAND" > /dev/null 2>&1; then | ||
83 | RESULT="OK" | ||
84 | else | ||
85 | RESULT="NOT FOUND" | ||
86 | fi | ||
87 | echo " $COMMAND: $RESULT" | ||
88 | } | ||
89 | |||
90 | takeScreenshot() { | ||
91 | FILE=$1 | ||
92 | GEOM=$2 | ||
93 | OUTPUT=$3 | ||
94 | if [ ! -z "$OUTPUT" ]; then | ||
95 | grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim" | ||
96 | elif [ -z "$GEOM" ]; then | ||
97 | grim "$FILE" || die "Unable to invoke grim" | ||
98 | else | ||
99 | grim -g "$GEOM" "$FILE" || die "Unable to invoke grim" | ||
100 | fi | ||
101 | } | ||
102 | |||
103 | if [ "$ACTION" = "check" ] ; then | ||
104 | echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..." | ||
105 | check grim | ||
106 | check slurp | ||
107 | check swaymsg | ||
108 | check wl-copy | ||
109 | check jq | ||
110 | check notify-send | ||
111 | exit | ||
112 | elif [ "$SUBJECT" = "area" ] ; then | ||
113 | GEOM=$(slurp -d) | ||
114 | # Check if user exited slurp without selecting the area | ||
115 | if [ -z "$GEOM" ]; then | ||
116 | exit | ||
117 | fi | ||
118 | WHAT="Area" | ||
119 | elif [ "$SUBJECT" = "active" ] ; then | ||
120 | FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)') | ||
121 | GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"') | ||
122 | APP_ID=$(echo "$FOCUSED" | jq -r '.app_id') | ||
123 | WHAT="$APP_ID window" | ||
124 | elif [ "$SUBJECT" = "screen" ] ; then | ||
125 | GEOM="" | ||
126 | WHAT="Screen" | ||
127 | elif [ "$SUBJECT" = "output" ] ; then | ||
128 | GEOM="" | ||
129 | OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') | ||
130 | WHAT="$OUTPUT" | ||
131 | elif [ "$SUBJECT" = "window" ] ; then | ||
132 | GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp) | ||
133 | # Check if user exited slurp without selecting the area | ||
134 | if [ -z "$GEOM" ]; then | ||
135 | exit | ||
136 | fi | ||
137 | WHAT="Window" | ||
138 | else | ||
139 | die "Unknown subject to take a screen shot from" "$SUBJECT" | ||
140 | fi | ||
141 | |||
142 | if [ "$ACTION" = "copy" ] ; then | ||
143 | takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error" | ||
144 | notifyOk "$WHAT copied to buffer" | ||
145 | else | ||
146 | if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then | ||
147 | TITLE="Screenshot of $SUBJECT" | ||
148 | MESSAGE=$(basename "$FILE") | ||
149 | notifyOk "$MESSAGE" "$TITLE" | ||
150 | echo $FILE | ||
151 | else | ||
152 | notifyError "Error taking screenshot with grim" | ||
153 | fi | ||
154 | fi | ||
diff --git a/contrib/grimshot.1 b/contrib/grimshot.1 deleted file mode 100644 index f6c8a377..00000000 --- a/contrib/grimshot.1 +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | .\" Generated by scdoc 1.11.1 | ||
2 | .\" Complete documentation for this program is not available as a GNU info page | ||
3 | .ie \n(.g .ds Aq \(aq | ||
4 | .el .ds Aq ' | ||
5 | .nh | ||
6 | .ad l | ||
7 | .\" Begin generated content: | ||
8 | .TH "grimshot" "1" "2020-12-20" | ||
9 | .P | ||
10 | .SH NAME | ||
11 | .P | ||
12 | grimshot - a helper for screenshots within sway | ||
13 | .P | ||
14 | .SH SYNOPSIS | ||
15 | .P | ||
16 | \fBgrimshot\fR [--notify] (copy|save) [TARGET] [FILE] | ||
17 | .br | ||
18 | \fBgrimshot\fR check | ||
19 | .br | ||
20 | \fBgrimshot\fR usage | ||
21 | .P | ||
22 | .SH OPTIONS | ||
23 | .P | ||
24 | \fB--notify\fR | ||
25 | .RS 4 | ||
26 | Show notifications to the user that a screenshot has been taken.\& | ||
27 | .P | ||
28 | .RE | ||
29 | \fBsave\fR | ||
30 | .RS 4 | ||
31 | Save the screenshot into a regular file.\& Grimshot will write images | ||
32 | files to \fBXDG_SCREENSHOTS_DIR\fR if this is set (or defined | ||
33 | in \fBuser-dirs.\&dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.\& | ||
34 | .P | ||
35 | .RE | ||
36 | \fBcopy\fR | ||
37 | .RS 4 | ||
38 | Copy the screenshot data (as image/png) into the clipboard.\& | ||
39 | .P | ||
40 | .RE | ||
41 | .SH DESCRIPTION | ||
42 | .P | ||
43 | Grimshot is an easy-to-use screenshot utility for sway.\& It provides a | ||
44 | convenient interface over grim, slurp and jq, and supports storing the | ||
45 | screenshot either directly to the clipboard using wl-copy or to a file.\& | ||
46 | .P | ||
47 | .SH EXAMPLES | ||
48 | .P | ||
49 | An example usage pattern is to add these bindings to your sway config: | ||
50 | .P | ||
51 | .nf | ||
52 | .RS 4 | ||
53 | # Screenshots: | ||
54 | # Super+P: Current window | ||
55 | # Super+Shift+p: Select area | ||
56 | # Super+Alt+p Current output | ||
57 | # Super+Ctrl+p Select a window | ||
58 | |||
59 | bindsym Mod4+p exec grimshot save active | ||
60 | bindsym Mod4+Shift+p exec grimshot save area | ||
61 | bindsym Mod4+Mod1+p exec grimshot save output | ||
62 | bindsym Mod4+Ctrl+p exec grimshot save window | ||
63 | .fi | ||
64 | .RE | ||
65 | .P | ||
66 | .SH TARGETS | ||
67 | .P | ||
68 | grimshot can capture the following named targets: | ||
69 | .P | ||
70 | \fIactive\fR | ||
71 | .RS 4 | ||
72 | Captures the currently active window.\& | ||
73 | .P | ||
74 | .RE | ||
75 | \fIscreen\fR | ||
76 | .RS 4 | ||
77 | Captures the entire screen.\& This includes all visible outputs.\& | ||
78 | .P | ||
79 | .RE | ||
80 | \fIarea\fR | ||
81 | .RS 4 | ||
82 | Allows manually selecting a rectangular region, and captures that.\& | ||
83 | .P | ||
84 | .RE | ||
85 | \fIwindow\fR | ||
86 | .RS 4 | ||
87 | Allows manually selecting a single window (by clicking on it), and | ||
88 | captures it.\& | ||
89 | .P | ||
90 | .RE | ||
91 | \fIoutput\fR | ||
92 | .RS 4 | ||
93 | Captures the currently active output.\& | ||
94 | .P | ||
95 | .RE | ||
96 | .SH OUTPUT | ||
97 | .P | ||
98 | Grimshot will print the filename of the captured screenshot to stdout if called | ||
99 | with the \fIsave\fR subcommand.\& | ||
100 | .P | ||
101 | .SH SEE ALSO | ||
102 | .P | ||
103 | \fBgrim\fR(1) | ||
diff --git a/contrib/grimshot.1.scd b/contrib/grimshot.1.scd deleted file mode 100644 index 4ab58532..00000000 --- a/contrib/grimshot.1.scd +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | grimshot(1) | ||
2 | |||
3 | # NAME | ||
4 | |||
5 | grimshot - a helper for screenshots within sway | ||
6 | |||
7 | # SYNOPSIS | ||
8 | |||
9 | *grimshot* [--notify] (copy|save) [TARGET] [FILE]++ | ||
10 | *grimshot* check++ | ||
11 | *grimshot* usage | ||
12 | |||
13 | # OPTIONS | ||
14 | |||
15 | *--notify* | ||
16 | Show notifications to the user that a screenshot has been taken. | ||
17 | |||
18 | *save* | ||
19 | Save the screenshot into a regular file. Grimshot will write images | ||
20 | files to *XDG_SCREENSHOTS_DIR* if this is set (or defined | ||
21 | in *user-dirs.dir*), or otherwise fall back to *XDG_PICTURES_DIR*. | ||
22 | |||
23 | *copy* | ||
24 | Copy the screenshot data (as image/png) into the clipboard. | ||
25 | |||
26 | # DESCRIPTION | ||
27 | |||
28 | Grimshot is an easy-to-use screenshot utility for sway. It provides a | ||
29 | convenient interface over grim, slurp and jq, and supports storing the | ||
30 | screenshot either directly to the clipboard using wl-copy or to a file. | ||
31 | |||
32 | # EXAMPLES | ||
33 | |||
34 | An example usage pattern is to add these bindings to your sway config: | ||
35 | |||
36 | ``` | ||
37 | # Screenshots: | ||
38 | # Super+P: Current window | ||
39 | # Super+Shift+p: Select area | ||
40 | # Super+Alt+p Current output | ||
41 | # Super+Ctrl+p Select a window | ||
42 | |||
43 | bindsym Mod4+p exec grimshot save active | ||
44 | bindsym Mod4+Shift+p exec grimshot save area | ||
45 | bindsym Mod4+Mod1+p exec grimshot save output | ||
46 | bindsym Mod4+Ctrl+p exec grimshot save window | ||
47 | ``` | ||
48 | |||
49 | # TARGETS | ||
50 | |||
51 | grimshot can capture the following named targets: | ||
52 | |||
53 | _active_ | ||
54 | Captures the currently active window. | ||
55 | |||
56 | _screen_ | ||
57 | Captures the entire screen. This includes all visible outputs. | ||
58 | |||
59 | _area_ | ||
60 | Allows manually selecting a rectangular region, and captures that. | ||
61 | |||
62 | _window_ | ||
63 | Allows manually selecting a single window (by clicking on it), and | ||
64 | captures it. | ||
65 | |||
66 | _output_ | ||
67 | Captures the currently active output. | ||
68 | |||
69 | # OUTPUT | ||
70 | |||
71 | Grimshot will print the filename of the captured screenshot to stdout if called | ||
72 | with the _save_ subcommand. | ||
73 | |||
74 | # SEE ALSO | ||
75 | |||
76 | *grim*(1) | ||
diff --git a/contrib/inactive-windows-transparency.py b/contrib/inactive-windows-transparency.py deleted file mode 100755 index 77b1f221..00000000 --- a/contrib/inactive-windows-transparency.py +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #!/usr/bin/python | ||
2 | |||
3 | # This script requires i3ipc-python package (install it from a system package manager | ||
4 | # or pip). | ||
5 | # It makes inactive windows transparent. Use `transparency_val` variable to control | ||
6 | # transparency strength in range of 0…1 or use the command line argument -o. | ||
7 | |||
8 | import argparse | ||
9 | import i3ipc | ||
10 | import signal | ||
11 | import sys | ||
12 | from functools import partial | ||
13 | |||
14 | def on_window_focus(inactive_opacity, ipc, event): | ||
15 | global prev_focused | ||
16 | global prev_workspace | ||
17 | |||
18 | focused = event.container | ||
19 | workspace = ipc.get_tree().find_focused().workspace().num | ||
20 | |||
21 | if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859 | ||
22 | focused.command("opacity 1") | ||
23 | if workspace == prev_workspace: | ||
24 | prev_focused.command("opacity " + inactive_opacity) | ||
25 | prev_focused = focused | ||
26 | prev_workspace = workspace | ||
27 | |||
28 | |||
29 | def remove_opacity(ipc): | ||
30 | for workspace in ipc.get_tree().workspaces(): | ||
31 | for w in workspace: | ||
32 | w.command("opacity 1") | ||
33 | ipc.main_quit() | ||
34 | sys.exit(0) | ||
35 | |||
36 | |||
37 | if __name__ == "__main__": | ||
38 | transparency_val = "0.80" | ||
39 | |||
40 | parser = argparse.ArgumentParser( | ||
41 | description="This script allows you to set the transparency of unfocused windows in sway." | ||
42 | ) | ||
43 | parser.add_argument( | ||
44 | "--opacity", | ||
45 | "-o", | ||
46 | type=str, | ||
47 | default=transparency_val, | ||
48 | help="set opacity value in range 0...1", | ||
49 | ) | ||
50 | args = parser.parse_args() | ||
51 | |||
52 | ipc = i3ipc.Connection() | ||
53 | prev_focused = None | ||
54 | prev_workspace = ipc.get_tree().find_focused().workspace().num | ||
55 | |||
56 | for window in ipc.get_tree(): | ||
57 | if window.focused: | ||
58 | prev_focused = window | ||
59 | else: | ||
60 | window.command("opacity " + args.opacity) | ||
61 | for sig in [signal.SIGINT, signal.SIGTERM]: | ||
62 | signal.signal(sig, lambda signal, frame: remove_opacity(ipc)) | ||
63 | ipc.on("window::focus", partial(on_window_focus, args.opacity)) | ||
64 | ipc.main() \ No newline at end of file | ||