Closed CRAG666 closed 2 years ago
Check the youtube video at 0:50 - this is what should happen. Can you describe what happens when you invoke that function?
That does not happen, it only blurs the screen, and you do not see the screen where it asks for the password
Okay that‘s a bug. On the other issue you mention that you can unlock the screen - does the lockscreen ever show up?
Could you please post a minimal log and your config?
from __future__ import annotations
import os
import pwd
import time
import psutil
from typing import Callable, Any
from subprocess import check_output
from newm.layout import Layout
from newm import (
SysBackendEndpoint_alsa,
SysBackendEndpoint_sysfs
)
from pywm import (
PYWM_MOD_LOGO,
)
OUTPUT_MANAGER = True
outputs = [
{'name': 'eDP-1', 'pos_x': 1833, 'pos_y': 0, 'scale': 0.7},
{'name': 'DP-2', 'pos_x': 0, 'pos_y': 0, 'scale': 0.7},
]
pywm = {
'xkb_layout': "es",
'xkb_options': "caps:swapescape",
'encourage_csd': False,
'debug_f1': True,
'enable_output_manager': OUTPUT_MANAGER,
'enable_xwayland': True,
'xcursor_theme': "Sweet-cursors",
'xcursor_size': 12,
'focus_follows_mouse': True,
'contstrain_popups_to_toplevel': True,
}
def should_float(view):
size = (700, 700)
position = (0.5, 0.35)
if view.app_id == "pavucontrol":
return True, size, position
if view.app_id == "blueman-manager":
return True, size, position
if view.app_id == "catapult":
return True, (700, 700), (0.5, 0.1)
return None
view = {
'xwayland_handle_scale_clientside': not OUTPUT_MANAGER,
'padding': 6,
'fullscreen_padding': 0,
'send_fullscreen': False,
'should_float': should_float
}
swipe_zoom = {
'grid_m': 1,
'grid_ovr': 0.02,
}
mod = PYWM_MOD_LOGO
wallpaper = os.environ["HOME"] + "/.cache/wallpaper.jpg"
corner_radius = 0
blend_time = 0.5
power_times = [7000, 7000, 7000]
term = 'kitty'
def key_bindings(layout: Layout) -> list[tuple[str, Callable[[], Any]]]:
menu = '~/.config/rofi/bin/launcher_misc'
clipboard = '~/.config/rofi/bin/clipboard'
favorites = '~/.config/rofi/bin/apps'
powermenu = '~/.config/rofi/bin/menu_powermenu'
bookmarks = '~/.config/rofi/bin/bookmarks'
return [
("M-h", lambda: layout.move(-1, 0)),
("M-j", lambda: layout.move(0, 1)),
("M-k", lambda: layout.move(0, -1)),
("M-l", lambda: layout.move(1, 0)),
("M-u", lambda: layout.basic_scale(1)),
("M-n", lambda: layout.basic_scale(-1)),
("M-t", lambda: layout.move_in_stack(1)),
("M-H", lambda: layout.move_focused_view(-1, 0)),
("M-J", lambda: layout.move_focused_view(0, 1)),
("M-K", lambda: layout.move_focused_view(0, -1)),
("M-L", lambda: layout.move_focused_view(1, 0)),
("M-C-h", lambda: layout.resize_focused_view(-1, 0)),
("M-C-j", lambda: layout.resize_focused_view(0, 1)),
("M-C-k", lambda: layout.resize_focused_view(0, -1)),
("M-C-l", lambda: layout.resize_focused_view(1, 0)),
("M-Return", lambda: os.system(f"{term} &")),
("M-e", lambda: layout.close_view()),
("M-p", lambda: layout.ensure_locked(dim=True)),
("M-P", lambda: layout.terminate()),
("M-R", lambda: layout.update_config()),
("M-f", lambda: layout.toggle_fullscreen()),
# ("ModPress", lambda: layout.toggle_overview()),
("ModPress", lambda: layout.toggle_overview(only_active_workspace=True)),
("M-q", lambda: os.system(f"{powermenu} &")),
("M-m", lambda: os.system("playerctl previous")),
("M-i", lambda: os.system("playerctl next")),
("M-ñ", lambda: os.system("playerctl play-pause &")),
("M-c", lambda: os.system(f'{clipboard} &')),
("M-b", lambda: os.system(f'{bookmarks} &')),
("XF86AudioRaiseVolume", lambda: os.system("amixer -q \
set Master 5%+")),
("XF86AudioLowerVolume", lambda: os.system("amixer -q \
set Master 5%-")),
("XF86AudioMute", lambda: os.system("amixer set Master toggle")),
("XF86AudioMicMute", lambda: os.system("amixer set Capture toggle")),
("XF86MonBrightnessDown", lambda: os.system("brightnessctl \
specific 3-")),
("XF86MonBrightnessUp", lambda: os.system("brightnessctl \
specific +3")),
("XF86Display", lambda: os.system("toggle_wcam uvcvideo &")),
("XF86Tools", lambda: os.system("kitty vim \
~/.config/newm/config.py &")),
("XF86Search", lambda: os.system("catapult --show &")),
("Menu", lambda: os.system("catapult --show &")),
("XF86Explorer", lambda: os.system(f"{menu} &")),
("Pause", lambda: os.system(f"{menu} &")),
("XF86LaunchA", lambda: os.system(f"{favorites} &")),
("Print", lambda: os.system('grim ~/screen-"$(date +%s)".png &')),
("M-Print", lambda: os.system('grim -g "$(slurp)" ~/screen-"$(date\
+%s)".png &')),
]
def on_startup():
gnome_schema = 'org.gnome.desktop.interface'
init_service = (
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1",
"systemctl --user import-environment DISPLAY WAYLAND_DISPLAY",
"hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY \
WAYLAND_DISPLAY",
f"gsettings set {gnome_schema} gtk-theme 'Sweet-mars'",
f"gsettings set {gnome_schema} icon-theme 'candy-icons'",
f"gsettings set {gnome_schema} cursor-theme 'Sweet-cursors'",
f"gsettings set {gnome_schema} font-name 'Lucida MAC 11'",
"gsettings set org.gnome.desktop.wm.preferences button-layout :",
"wl-paste -t text --watch clipman store",
"wlsunset -l 16.0867 -L -93.7561 -t 2500 -T 6000",
"thunar --daemon",
"/home/crag/Git/dotfiles/etc/dnscrypt-proxy/get_blocklist"
)
for service in init_service:
service = f"{service} &"
os.system(service)
sys_backend_endpoints = [
SysBackendEndpoint_sysfs(
"backlight",
"/sys/class/backlight/intel_backlight/brightness",
"/sys/class/backlight/intel_backlight/max_brightness"),
SysBackendEndpoint_sysfs(
"kbdlight",
"/sys/class/leds/smc::kbd_backlight/brightness",
"/sys/class/leds/smc::kbd_backlight/max_brightness"),
SysBackendEndpoint_alsa(
"volume")
]
panels = {
'launcher': {
'cmd': f'{term} newm-panel-basic launcher'
},
}
ssid = "nmcli -t -f active,ssid dev wifi | egrep '^sí'\
| cut -d\\: -f2"
brightness = "brightnessctl i | grep 'Current' | cut -d\\( -f2"
volume = "awk -F\"[][]\" '/Left:/ { print $2 }' <(amixer sget Master)"
def get_nw():
ifdevice = "wlan0"
ip = ""
try:
ip = psutil.net_if_addrs()[ifdevice][0].address
except Exception:
ip = "-/-"
ssid_string = check_output(ssid, shell=True).decode("utf-8")
return f" {ifdevice}: {ssid_string[:-1]} / {ip}"
bar = {
'font': 'JetBrainsMono Nerd Font',
'font_size': 15,
'height': 20,
'top_texts': lambda: [
pwd.getpwuid(os.getuid())[0],
f" {psutil.cpu_percent(interval=1)}",
f" {psutil.virtual_memory().percent}%",
f"/ {psutil.disk_usage('/').percent}%\
/home {psutil.disk_usage('/home').percent}%"
],
'bottom_texts': lambda: [
# f'{psutil.sensors_battery().percent} \
# {"↑" if psutil.sensors_battery().power_plugged else "↓"}',
f' {check_output(brightness, shell=True).decode("utf-8")[:-2]}',
f'墳 {check_output(volume, shell=True).decode("utf-8")[:-1]}',
get_nw(),
f' {time.strftime("%c")}'
]
}
The lock screen never appears
Is it something to do with the fact that I don't have alacritty installed and use kitty instead?
Yes, you're right, that's part of the problem, the other is that panels.lock
is not configured. This can be done easily by adapting
panels = {
'lock': {
'cmd': 'alacritty -e newm-panel-basic lock',
'w': 0.7,
'h': 0.6,
'corner_radius': 50,
},
}
to kitty.
thank you, don't you think it would be useful to have an option called terminal?
Does it work?
For newm itself such an option isn't necessary. The right way is to handle it via a variable in the config file, like you do. Probably I am going to include your config with some adjustments as new default config.
now it appears but typing my password just doesn't remove it
@jbuchermn I type my correct password and the lockscreen just won't remove
Does it accept input when you type?
yes
but when I press enter the lockscreen is not removed
Can you post a log? Passwords should not be logged, however best you check yourself.
Plus: Does pam authentication work in a python shell?
import pam
p = pam.pam()
p.authenticate("user","password")
ok i just tested pam, and the output is True
In the lockscreen it only asks for my password, is it possible that my user is not the correct one?
Okay that's good, pam works. Can you try adding some debug log to auth_backend.py to see if maybe the user is wrong, or sth similar?
Please also check $HOME/.cache/newm_panel_log
- does it look like this?
[DEBUG] lock.py:175 2021-11-26 08:05:12: Main loop...
[DEBUG] lock.py:149 2021-11-26 08:05:12: Connecting...
[DEBUG] lock.py:151 2021-11-26 08:05:12: ...connected
[DEBUG] lock.py:153 2021-11-26 08:05:12: Run loop...
[DEBUG] lock.py:158 2021-11-26 08:05:12: Sending...
[DEBUG] lock.py:160 2021-11-26 08:05:12: ...done
[DEBUG] lock.py:163 2021-11-26 08:05:14: ...received answer
[DEBUG] lock.py:121 2021-11-26 08:05:14: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'}
[DEBUG] lock.py:140 2021-11-26 08:05:17: ...done processing message
[DEBUG] lock.py:153 2021-11-26 08:05:17: Run loop...
[DEBUG] lock.py:158 2021-11-26 08:05:17: Sending...
[DEBUG] lock.py:160 2021-11-26 08:05:17: ...done
$HOME/.cache/newm_panel_log [DEBUG] lock.py:163 2021-11-25 21:22:45: ...received answer [DEBUG] lock.py:121 2021-11-25 21:22:45: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:22:47: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:22:47: Run loop... [DEBUG] lock.py:158 2021-11-25 21:22:47: Sending... [DEBUG] lock.py:160 2021-11-25 21:22:47: ...done [DEBUG] lock.py:163 2021-11-25 21:22:50: ...received answer [DEBUG] lock.py:121 2021-11-25 21:22:50: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:22:58: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:22:58: Run loop... [DEBUG] lock.py:158 2021-11-25 21:22:58: Sending... [DEBUG] lock.py:160 2021-11-25 21:22:58: ...done [DEBUG] lock.py:163 2021-11-25 21:23:00: ...received answer [DEBUG] lock.py:121 2021-11-25 21:23:00: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:23:07: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:23:07: Run loop... [DEBUG] lock.py:158 2021-11-25 21:23:07: Sending... [DEBUG] lock.py:160 2021-11-25 21:23:07: ...done [DEBUG] lock.py:163 2021-11-25 21:23:08: ...received answer [DEBUG] lock.py:121 2021-11-25 21:23:08: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:23:11: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:23:11: Run loop... [DEBUG] lock.py:158 2021-11-25 21:23:11: Sending... [DEBUG] lock.py:160 2021-11-25 21:23:11: ...done [DEBUG] lock.py:163 2021-11-25 21:23:14: ...received answer [DEBUG] lock.py:121 2021-11-25 21:23:14: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:23:19: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:23:19: Run loop... [DEBUG] lock.py:158 2021-11-25 21:23:19: Sending... [DEBUG] lock.py:160 2021-11-25 21:23:19: ...done [DEBUG] lock.py:163 2021-11-25 21:23:20: ...received answer [DEBUG] lock.py:121 2021-11-25 21:23:20: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:23:25: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:23:25: Run loop... [DEBUG] lock.py:158 2021-11-25 21:23:25: Sending... [DEBUG] lock.py:160 2021-11-25 21:23:25: ...done [DEBUG] lock.py:163 2021-11-25 21:23:27: ...received answer [DEBUG] lock.py:121 2021-11-25 21:23:27: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-25 21:23:32: ...done processing message [DEBUG] lock.py:153 2021-11-25 21:23:32: Run loop... [DEBUG] lock.py:158 2021-11-25 21:23:32: Sending... [DEBUG] lock.py:160 2021-11-25 21:23:32: ...done [DEBUG] lock.py:163 2021-11-25 21:23:34: ...received answer [DEBUG] lock.py:121 2021-11-25 21:23:34: Received message: {'kind': 'auth_request_cred', 'user': 'jonas', 'message': 'Password?'}
as I imagined I am using your username
How do I change the user: jonas to my user?
Thanks a lot!
I just realized the user is actually hardcoded in newm_panel_basic. So this is definitely a bug and not something you can change yourself. I'll fix it
Actually, the username is hardocded but overwritten if newm is able to find the current user (which always should be possible). The relevant lines are:
with open('/etc/passwd', 'r') as pwd:
for user in pwd:
u = user.split(":")
if "nologin" not in u[6]:
print([(u[0], int(u[2]), u[6], os.getuid())])
Could you run these in a python shell and verify that your user appears?
why not better ask an environment variable? I will try it anyway, although I still think that with the variable $ USER it would be solved
[('root', 0, '/bin/bash\n', 1000)] [('crag', 1000, '/bin/zsh\n', 1000)] [('git', 977, '/usr/bin/git-shell\n', 1000)] [('ntp', 87, '/bin/false\n', 1000)] [('greeter', 964, '/bin/bash\n', 1000)]
this is output
Yeah, in this particular case you're right - $USER
or whoami
works just as well. The thing is, this does not work when using newm as a login manager, where we need all possible users for login. That's why newm uses /etc/passwd
- let's see where the bug is first, then how to fix it.
okay, thats the expected output suggesting no issues with using /etc/passwd
- so I'll have to look elsewhere
@jbuchermn Do you use greetd? If so, could you show me your configuration file?
Yes I do, there's some info on setting it up in the README. However, we should really get the lock screen working before you try newm with greetd. Otherwise you might not be able to log in at all.
Could you update, retry and post both log files?
ok
The error persists
[DEBUG] lock.py:153 2021-11-26 08:45:37: Run loop... [DEBUG] lock.py:158 2021-11-26 08:45:37: Sending... [DEBUG] lock.py:160 2021-11-26 08:45:37: ...done [DEBUG] lock.py:175 2021-11-26 08:46:13: Main loop... [DEBUG] lock.py:149 2021-11-26 08:46:13: Connecting... [DEBUG] lock.py:151 2021-11-26 08:46:13: ...connected [DEBUG] lock.py:153 2021-11-26 08:46:13: Run loop... [DEBUG] lock.py:158 2021-11-26 08:46:13: Sending... [DEBUG] lock.py:160 2021-11-26 08:46:13: ...done [DEBUG] lock.py:175 2021-11-26 08:47:24: Main loop... [DEBUG] lock.py:149 2021-11-26 08:47:24: Connecting... [DEBUG] lock.py:151 2021-11-26 08:47:24: ...connected [DEBUG] lock.py:153 2021-11-26 08:47:24: Run loop... [DEBUG] lock.py:158 2021-11-26 08:47:24: Sending... [DEBUG] lock.py:160 2021-11-26 08:47:24: ...done [DEBUG] lock.py:175 2021-11-26 10:08:56: Main loop... [DEBUG] lock.py:149 2021-11-26 10:08:56: Connecting... [DEBUG] lock.py:151 2021-11-26 10:08:56: ...connected [DEBUG] lock.py:153 2021-11-26 10:08:56: Run loop... [DEBUG] lock.py:158 2021-11-26 10:08:56: Sending... [DEBUG] lock.py:160 2021-11-26 10:08:56: ...done [DEBUG] lock.py:163 2021-11-26 10:08:56: ...received answer [DEBUG] lock.py:121 2021-11-26 10:08:56: Received message: {'kind': 'auth_request_cred', 'user': 'test1', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-26 10:09:02: ...done processing message [DEBUG] lock.py:153 2021-11-26 10:09:02: Run loop... [DEBUG] lock.py:158 2021-11-26 10:09:02: Sending... [DEBUG] lock.py:160 2021-11-26 10:09:02: ...done [DEBUG] lock.py:163 2021-11-26 10:09:04: ...received answer [DEBUG] lock.py:121 2021-11-26 10:09:04: Received message: {'kind': 'auth_request_cred', 'user': 'test1', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-26 10:09:16: ...done processing message [DEBUG] lock.py:153 2021-11-26 10:09:16: Run loop... [DEBUG] lock.py:158 2021-11-26 10:09:16: Sending... [DEBUG] lock.py:160 2021-11-26 10:09:16: ...done [DEBUG] lock.py:163 2021-11-26 10:09:18: ...received answer [DEBUG] lock.py:121 2021-11-26 10:09:18: Received message: {'kind': 'auth_request_cred', 'user': 'test1', 'message': 'Password?'} [DEBUG] lock.py:140 2021-11-26 10:09:24: ...done processing message [DEBUG] lock.py:153 2021-11-26 10:09:24: Run loop... [DEBUG] lock.py:158 2021-11-26 10:09:24: Sending... [DEBUG] lock.py:160 2021-11-26 10:09:24: ...done [DEBUG] lock.py:163 2021-11-26 10:09:26: ...received answer [DEBUG] lock.py:121 2021-11-26 10:09:26: Received message: {'kind': 'auth_request_cred', 'user': 'test1', 'message': 'Password?'}
Please post both log files
the newm_log?
Yes, that's where the bug happens.
This is definitely a hard one to figure out... I still need more debug info. Can you update, rerun (also lock the screen) and again upload logs? Thank you
Ok
@jbuchermn This works and is great, Thanks, now before I close this, how do I open the newm launcher?
That's interesting, not sure what was causing the bug... This whole websockets thing needs a rewrite in v0.3
Do you mean the app launcher? Actually since rofi works I have never bothered using the newm one and I'm going to drop it soon. Or do you mean login manger?
Try logging in as greeter
in a TTY and run start-newm
. Once this works, you can try.
Thanks I just wanted to try to see how it looks, but the lockscreen is beautiful
That's interesting, not sure what was causing the bug... This whole websockets thing needs a rewrite in v0.3
Do you mean the app launcher? Actually since rofi works I have never bothered using the newm one and I'm going to drop it soon. Or do you mean login manger?
Try logging in as
greeter
in a TTY and runstart-newm
. Once this works, you can try.
I already have greetd configured, I even add some environment variables before starting newm, I would like to add the configurations that I have to the newm documentation
Sure, I very much appreciate improved documentation. Feel free to open a PR
Sure I will do it as soon as v2 is ready so it can be used massively
By mistake, I pressed this function, but I did not know how to remove it, I literally had to restart to use the system again, would there be a chance to tell me how it works?