Files
bananarchy/patches/sxmo/0001-bananarchy-sxmo-240x320-keypad-ui.patch
2026-10-19 09:23:54 +03:00

227 lines
9.2 KiB
Diff

# Bananarchy Sxmo 240x320 Native Resolution & Physical Keypad Patch
# Targets: Nokia 8110 4G (nokia-argon), Nokia 2720 Flip (nokia-beatles),
# Nokia 800 Tough (nokia-coconut), Nokia 8000 4G (nokia-sparkler)
#
# Full modified files are tracked in overlay/rootfs/:
# - usr/bin/sxmo_deviceprofile_nokia,{argon,beatles,coconut,sparkler,leo}.sh
# - usr/share/sxmo/appcfg/{sway_template,conky.conf,wofi.config,wofi.css,foot.ini,wob.ini,dunst.conf}
# - usr/share/sxmo/default_hooks/{sxmo_hook_inputhandler.sh,sxmo_hook_start.sh}
# - home/user/.config/sxmo/{profile,sway,conky.conf}
--- a/usr/share/sxmo/appcfg/profile_template 2026-05-10 19:25:12.000000000 +0300
+++ b/overlay/rootfs/home/user/.config/sxmo/profile 2026-10-18 12:06:20.163476428 +0300
@@ -69,3 +69,10 @@
#Set to the default text for a new text message.
export SXMO_DEFAULT_DRAFT="Enter new message here."
+
+export GTK_IM_MODULE=fcitx
+export QT_IM_MODULE=fcitx
+export XMODIFIERS=@im=fcitx
+export SXMO_MENU=wofi
+
+export SXMO_BG_IMG="/usr/share/wallpapers/bananarchy.png"
--- a/usr/share/sxmo/appcfg/i3_template 2026-05-10 19:25:12.000000000 +0300
+++ b/overlay/rootfs/usr/share/sxmo/appcfg/sway_template 2026-10-18 14:06:00.979385569 +0300
@@ -1,9 +1,9 @@
-# Default config for i3
-# configversion: 7fd9eb1f82c8403c974da53df81b9d1e
+# Default config for sway
+# configversion: 076611fe8cc699bcaa01092a8e4481c0
#
-# Copy this to ~/.config/i3/config and edit it to your liking.
+# Copy this to ~/.config/sway/config and edit it to your liking.
#
-# Please see https://i3wm.org/docs/userguide.html for a complete reference!
+# Read `man 5 sway` for a complete reference.
### Variables
#
@@ -17,25 +17,59 @@
# Your preferred terminal emulator
set $term sxmo_terminal.sh
# Your preferred application launcher
-# Note: pass the final command to i3msg so that the resulting window can be opened
+# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
-set $menu dmenu_run
+set $menu bemenu-run
-font pango:Sxmo 11
+font "Sxmo 13"
+xwayland disable
+output * scale 1 bg /usr/share/wallpapers/bananarchy.png fill
+
+exec_always sxmo_swayinitconf.sh
+
+exec_always dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP
mode "menu" {
- # This is slower than remapping the keys using a keymap, but we don't need
- # to know the device names, so use it as a fallback so this functionality
- # keeps working if a deviceprofile doesn't exist.
- bindsym XF86PowerOff exec xdotool type Return
- bindsym XF86AudioRaiseVolume exec xdotool type Up
- bindsym XF86AudioLowerVolume exec xdotool type Down
+ bindsym --locked XF86PowerOff exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym --locked XF86PickupPhone exec sh -c "if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; else wtype -k Return; fi"
+ bindsym --locked XF86KbdLcdMenu1 exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym --locked XF86KbdLcdMenu2 exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym XF86AudioRaiseVolume exec wtype -k Up
+ bindsym XF86AudioLowerVolume exec wtype -k Down
+ bindswitch --locked lid:on exec sh -c "sxmo_dmenu.sh close; brightnessctl -d white:kbd_backlight set 0; sxmo_state.sh set screenoff"
+ bindswitch --locked lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_state.sh set unlock; sxmo_wm.sh display on"
+}
+
+# Mode specifically for use with Nokia N900 hardware keyboard
+mode "N900" {
+ # follow the standard sxmo keybinds as far as possible
+ bindsym t exec $term; mode "default"
+ bindsym q mode "default"
+ bindsym Shift+p exec sxmo_appmenu.sh sys; mode "default"
+ bindsym p exec sxmo_appmenu.sh; mode "default"
+ bindsym d exec $menu; mode "default"
+ bindsym Shift+q kill; mode "default"
+ bindsym i exec sxmo_wmmenu.sh windowswitcher; mode "default"
+ bindsym Shift+c reload; mode "default"
+ bindsym f fullscreen; mode "default"
+ bindsym Shift+space floating toggle; mode "default"
+ bindsym a focus parent; mode "default"
}
### Key bindings
#
# Basics:
#
+ input * xkb_options compose:ralt
+
+ # Nokia N900 hardware keyboard
+ input "1:1:TWL4030_Keypad" {
+ xkb_model "nokiarx51"
+ xkb_layout "us"
+ # ralt has special meaning on N900 keyboard so do not use as
+ # compose key
+ xkb_options compose:rwin
+ }
# Start a terminal
bindsym $mod+Return exec $term
@@ -58,13 +92,13 @@
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
- floating_modifier $mod
+ floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
- # Exit i3 (logs you out of your i3 session)
- bindsym $mod+Shift+e exec i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your i3 session.' -b 'Yes, exit i3' 'i3-msg exit'
+ # Exit sway (logs you out of your Wayland session)
+ bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'sxmo_power.sh logout'
#
# Moving around:
#
@@ -157,7 +191,7 @@
#
# Scratchpad:
#
- # i3 has a "scratchpad", which is a bag of holding for windows.
+ # Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
@@ -194,48 +228,68 @@
#
# Status Bar:
#
-# Read `man 5 i3bar` for more information about this section.
+# Read `man 5 sway-bar` for more information about this section.
bar {
position top
+ height 24
+ font "Sxmo 13"
- # When the status_command prints a new line to stdout, i3bar updates.
+ # When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
- status_command sxmo_status_watch.sh -o plain
- font pango:Sxmo 11
+ status_command sxmo_status_watch.sh -o pango
- padding 0 20px 8px 8px
+ pango_markup enabled
colors {
statusline #ffffff
background #323232
inactive_workspace #323232 #323232 #ffffff
-
+ font "Sxmo 13"
}
}
-for_window [class="pinentry-.*"] floating enable
-for_window [class="st" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
-for_window [class="megapixels"] inhibit_idle open
-for_window [class="ep[yr].*"] inhibit_idle visible
-for_window [class="tabbed"] border pixel 0
-no_focus [class="svkbd"]
-
-smart_gaps on
+for_window [app_id="pinentry-.*"] floating true
+for_window [app_id="foot" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
+for_window [title="megapixels"] inhibit_idle open
+for_window [title="ep[yr].*"] inhibit_idle visible
+
+default_border pixel 2
+titlebar_border_thickness 2
+hide_edge_borders smart
# Need playerctl installed and running
-bindsym XF86AudioPlay exec playerctl play-pause
-bindsym XF86AudioPause exec playerctl play-pause
-bindsym XF86AudioStop exec playerctl stop
-bindsym XF86AudioNext exec playerctl next
-bindsym XF86AudioPrev exec playerctl previous
-
-bindsym XF86MonBrightnessUp exec sxmo_brightness.sh up
-bindsym XF86MonBrightnessDown exec sxmo_brightness.sh down
+bindsym --locked XF86AudioPlay exec playerctl play-pause
+bindsym --locked XF86AudioPause exec playerctl play-pause
+bindsym --locked XF86AudioStop exec playerctl stop
+bindsym --locked XF86AudioNext exec playerctl next
+bindsym --locked XF86AudioPrev exec playerctl previous
+
+bindsym --locked XF86MonBrightnessUp exec sxmo_brightness.sh up
+bindsym --locked XF86MonBrightnessDown exec sxmo_brightness.sh down
+
+# Nokia N900-specific key bindings:
+# 1. Bind lock key (XF86ScreenSaver)
+# Use keycode due to https://github.com/swaywm/sway/issues/8438
+bindcode --release --locked --input-device="1:1:gpio_keys" 160 exec sxmo_state.sh set unlock
+# 2. Workaround the lack of a free ModX key on hardware keyboard
+bindsym --input-device="1:1:TWL4030_Keypad" Shift+space mode "N900"
bindsym Print exec sxmo_screenshot.sh
bindsym button2 kill
-exec i3 --get-socketpath > "$XDG_RUNTIME_DIR"/sxmo.i3sock
+bindswitch --locked lid:on exec sh -c "brightnessctl -d white:kbd_backlight set 0; sxmo_state.sh set screenoff"
+bindswitch --locked lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_state.sh set unlock; sxmo_wm.sh display on"
+
+# Nokia 8110 4G hardware keypad bindings (User:Ybon)
+bindsym --locked --no-repeat XF86KbdLcdMenu1 exec sxmo_hook_inputhandler.sh menuleft_one
+bindsym --locked --no-repeat XF86KbdLcdMenu2 exec sxmo_hook_inputhandler.sh menuright_one
+bindsym --locked --no-repeat XF86PickupPhone exec sxmo_hook_inputhandler.sh enter_one
+
+include /etc/sway/config.d/*
+
+exec 'printf %s "$SWAYSOCK" > "$XDG_RUNTIME_DIR"/sxmo.swaysock'
+
+exec sxmo_hook_start.sh
-# vim: ft=i3config
+# vim: ft=swayconfig