diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/autoname-workspaces.py | 28 | ||||
-rwxr-xr-x | contrib/grimshot | 4 | ||||
-rw-r--r-- | contrib/grimshot.1 | 3 | ||||
-rw-r--r-- | contrib/grimshot.1.scd | 1 | ||||
-rwxr-xr-x | contrib/inactive-windows-transparency.py | 7 |
5 files changed, 22 insertions, 21 deletions
diff --git a/contrib/autoname-workspaces.py b/contrib/autoname-workspaces.py index 297d91b2..3ec39928 100755 --- a/contrib/autoname-workspaces.py +++ b/contrib/autoname-workspaces.py | |||
@@ -22,24 +22,17 @@ DEFAULT_ICON = "" | |||
22 | 22 | ||
23 | 23 | ||
24 | def icon_for_window(window): | 24 | def icon_for_window(window): |
25 | app_id = window.app_id | 25 | name = None |
26 | if app_id is not None and len(app_id) > 0: | 26 | if window.app_id is not None and len(window.app_id) > 0: |
27 | app_id = app_id.lower() | 27 | name = window.app_id.lower() |
28 | if app_id in WINDOW_ICONS: | 28 | elif window.window_class is not None and len(window.window_class) > 0: |
29 | return WINDOW_ICONS[app_id] | 29 | name = window.window_class.lower() |
30 | logging.info("No icon available for window with app_id: %s" % str(app_id)) | 30 | |
31 | else: | 31 | if name in WINDOW_ICONS: |
32 | # xwayland support | 32 | return WINDOW_ICONS[name] |
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 | 33 | ||
34 | logging.info("No icon available for window with name: %s" % str(name)) | ||
35 | return DEFAULT_ICON | ||
43 | 36 | ||
44 | def rename_workspaces(ipc): | 37 | def rename_workspaces(ipc): |
45 | for workspace in ipc.get_tree().workspaces(): | 38 | for workspace in ipc.get_tree().workspaces(): |
@@ -128,3 +121,4 @@ if __name__ == "__main__": | |||
128 | rename_workspaces(ipc) | 121 | rename_workspaces(ipc) |
129 | 122 | ||
130 | ipc.main() | 123 | ipc.main() |
124 | |||
diff --git a/contrib/grimshot b/contrib/grimshot index 461a5eef..921837f9 100755 --- a/contrib/grimshot +++ b/contrib/grimshot | |||
@@ -32,13 +32,13 @@ FILE=${3:-$(getTargetDirectory)/$(date -Ins).png} | |||
32 | 32 | ||
33 | if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then | 33 | if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then |
34 | echo "Usage:" | 34 | echo "Usage:" |
35 | echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE]" | 35 | echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE|-]" |
36 | echo " grimshot check" | 36 | echo " grimshot check" |
37 | echo " grimshot usage" | 37 | echo " grimshot usage" |
38 | echo "" | 38 | echo "" |
39 | echo "Commands:" | 39 | echo "Commands:" |
40 | echo " copy: Copy the screenshot data into the clipboard." | 40 | echo " copy: Copy the screenshot data into the clipboard." |
41 | echo " save: Save the screenshot to a regular file." | 41 | echo " save: Save the screenshot to a regular file or '-' to pipe to STDOUT." |
42 | echo " check: Verify if required tools are installed and exit." | 42 | echo " check: Verify if required tools are installed and exit." |
43 | echo " usage: Show this message and exit." | 43 | echo " usage: Show this message and exit." |
44 | echo "" | 44 | echo "" |
diff --git a/contrib/grimshot.1 b/contrib/grimshot.1 index f6c8a377..e4baccfd 100644 --- a/contrib/grimshot.1 +++ b/contrib/grimshot.1 | |||
@@ -5,7 +5,7 @@ | |||
5 | .nh | 5 | .nh |
6 | .ad l | 6 | .ad l |
7 | .\" Begin generated content: | 7 | .\" Begin generated content: |
8 | .TH "grimshot" "1" "2020-12-20" | 8 | .TH "grimshot" "1" "2021-02-23" |
9 | .P | 9 | .P |
10 | .SH NAME | 10 | .SH NAME |
11 | .P | 11 | .P |
@@ -31,6 +31,7 @@ Show notifications to the user that a screenshot has been taken.\& | |||
31 | Save the screenshot into a regular file.\& Grimshot will write images | 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 | 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.\& | 33 | in \fBuser-dirs.\&dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.\& |
34 | Set FILE to '-' to pipe the output to STDOUT.\& | ||
34 | .P | 35 | .P |
35 | .RE | 36 | .RE |
36 | \fBcopy\fR | 37 | \fBcopy\fR |
diff --git a/contrib/grimshot.1.scd b/contrib/grimshot.1.scd index 4ab58532..d2a57759 100644 --- a/contrib/grimshot.1.scd +++ b/contrib/grimshot.1.scd | |||
@@ -19,6 +19,7 @@ grimshot - a helper for screenshots within sway | |||
19 | Save the screenshot into a regular file. Grimshot will write images | 19 | Save the screenshot into a regular file. Grimshot will write images |
20 | files to *XDG_SCREENSHOTS_DIR* if this is set (or defined | 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*. | 21 | in *user-dirs.dir*), or otherwise fall back to *XDG_PICTURES_DIR*. |
22 | Set FILE to '-' to pipe the output to STDOUT. | ||
22 | 23 | ||
23 | *copy* | 24 | *copy* |
24 | Copy the screenshot data (as image/png) into the clipboard. | 25 | Copy the screenshot data (as image/png) into the clipboard. |
diff --git a/contrib/inactive-windows-transparency.py b/contrib/inactive-windows-transparency.py index 77b1f221..b81134dd 100755 --- a/contrib/inactive-windows-transparency.py +++ b/contrib/inactive-windows-transparency.py | |||
@@ -15,8 +15,13 @@ def on_window_focus(inactive_opacity, ipc, event): | |||
15 | global prev_focused | 15 | global prev_focused |
16 | global prev_workspace | 16 | global prev_workspace |
17 | 17 | ||
18 | focused_workspace = ipc.get_tree().find_focused() | ||
19 | |||
20 | if focused_workspace == None: | ||
21 | return | ||
22 | |||
18 | focused = event.container | 23 | focused = event.container |
19 | workspace = ipc.get_tree().find_focused().workspace().num | 24 | workspace = focused_workspace.workspace().num |
20 | 25 | ||
21 | if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859 | 26 | if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859 |
22 | focused.command("opacity 1") | 27 | focused.command("opacity 1") |