Skip to content

Commit

Permalink
fix up Ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
smason authored and OctopusET committed Dec 10, 2023
1 parent 05622e4 commit da3ffa4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion autoname-workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
# Based on https://github.com/maximbaz/dotfiles/blob/master/bin/i3-autoname-workspaces

import argparse
import i3ipc
import logging
import re
import signal
import sys

import i3ipc

WINDOW_ICONS = {
"firefox": "",
}
Expand Down
6 changes: 4 additions & 2 deletions inactive-windows-transparency.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
# transparency strength in range of 0…1 or use the command line argument -o.

import argparse
import i3ipc
import signal
import sys
from functools import partial

import i3ipc


def on_window_focus(inactive_opacity, ipc, event):
global prev_focused
global prev_workspace

focused_workspace = ipc.get_tree().find_focused()

if focused_workspace == None:
if focused_workspace is None:
return

focused = event.container
Expand Down
11 changes: 6 additions & 5 deletions switch-top-level.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import i3ipc

#
# This script requires i3ipc-python package (install it from a system package manager
# or pip).
Expand Down Expand Up @@ -35,7 +36,7 @@ def __init__(self):
self.prev = None # previously focused container id

self.i3 = i3ipc.Connection()
self.i3.on('window::focus', self.on_window_focus)
self.i3.on("window::focus", self.on_window_focus)
self.i3.on(i3ipc.Event.BINDING, self.on_binding)

self.update_top_level()
Expand Down Expand Up @@ -85,14 +86,14 @@ def on_top(self, _i3, _event, diff: int):
top_idx = (top_idx + diff + len(ws)) % len(ws)
next_top = ws[top_idx]
next_window = self.top_to_selected.get(next_top)
self.i3.command('[con_id=%s] focus' % next_window)
self.i3.command("[con_id=%s] focus" % next_window)

def on_binding(self, i3, event):
if event.binding.command.startswith('nop top_next'):
if event.binding.command.startswith("nop top_next"):
self.on_top(i3, event, 1)
elif event.binding.command.startswith('nop top_prev'):
elif event.binding.command.startswith("nop top_prev"):
self.on_top(i3, event, -1)


if __name__ == '__main__':
if __name__ == "__main__":
TopLevelSwitcher()

0 comments on commit da3ffa4

Please sign in to comment.