from __future__ import annotations from typing import Callable, Any import os import pwd import time import logging import subprocess from newm.layout import Layout from newm.helper import WobRunner, PaCtl from pywm import ( PYWM_MOD_LOGO, PYWM_MOD_ALT ) logger = logging.getLogger(__name__) background = { 'path': os.environ["HOME"] + '/Downloads/space.jpg', 'anim': True } wob_runner = WobRunner("wob -a bottom -M 100") pactl = PaCtl(0, wob_runner) def key_bindings(layout: Layout) -> list[tuple[str, Callable[[], Any]]]: return [ ("L-j", lambda: layout.move(-1, 0)), ("L-o", lambda: layout.move(0, 1)), ("L-i", lambda: layout.move(0, -1)), ("L-semicolon", lambda: layout.move(1, 0)), ("L-k", lambda: layout.basic_scale(1)), ("L-l", lambda: layout.basic_scale(-1)), ("L-t", lambda: layout.move_in_stack(1)), ("L-J", lambda: layout.move_focused_view(-1, 0)), ("L-O", lambda: layout.move_focused_view(0, 1)), ("L-I", lambda: layout.move_focused_view(0, -1)), ("L-S-semicolon", lambda: layout.move_focused_view(1, 0)), ("L-C-j", lambda: layout.resize_focused_view(-1, 0)), ("L-C-o", lambda: layout.resize_focused_view(0, 1)), ("L-C-i", lambda: layout.resize_focused_view(0, -1)), ("L-C-semicolon", lambda: layout.resize_focused_view(1, 0)), ("L-Return", lambda: os.system("foot &")), ("L-c", lambda: layout.close_focused_view()), ("L-L", lambda: layout.ensure_locked(dim=True)), ("L-P", lambda: layout.terminate()), ("L-C", lambda: layout.update_config()), ("L-f", lambda: layout.toggle_fullscreen()), ("L-p", lambda: os.system("sirula &")), ("L-", lambda: layout.toggle_overview()), ] panels = { 'lock': { 'cmd': 'alacritty -e newm-panel-basic lock', }, 'launcher': { 'cmd': 'alacritty -e newm-panel-basic launcher' }, 'top_bar': { 'native': { 'enabled': True, 'texts': lambda: [ # pwd.getpwuid(os.getuid())[0], time.strftime("%-I:%M%p, %d %B %Y"), subprocess.check_output(['acpi']).decode('utf-8').rstrip(), ], } }, 'bottom_bar': { 'native': { 'enabled': False, 'texts': lambda: [ "newm", "powered by pywm" ], } }, } pywm = { 'enable_xwayland': True, 'xkb_options': "caps:super", } def view_rules(view): return None view = { 'rules': view_rules, } focus = { 'color': '#FFFFFFFF', } def on_startup(): os.system("kmonad " + os.environ["HOME"] + "/.kmonad/config.kbd")