You are not logged in.

#1 2017-01-15 17:50:27

tritri
Member
Registered: 2016-08-27
Posts: 13

unixporn: i3 lemonbar workspace-indicator [SOLVED]

Hello together,

i installed i3 and unsed this configuration files to make it look nice:

reddit post:
i3 everything
dotfiles (lemonbar and workspace script)

it works all execpt one thing. I get errors from the workspace-idicator-script:

when I run "sh startbar"

File "/home/****/.config/lemonbar/workspace", line 48, in <module>
print(workspace_string, flush=True)
UnicodeEncodeError: 'ascii' codec can't encode character '\uf111' in position 13: ordinal not in range(128)

Has probably something todo with that:

#!/usr/bin/env python3

import i3ipc

# Create the Connection object that can be used to send commands and subscribe
# to events.
i3 = i3ipc.Connection()
coloractive = '%{F#eeeeee}'
colorinactive = '%{F#93a0aa}'
colorwarning = '%{F#e84f4f}'

# Define a callback to be called when you switch workspaces.
def on_workspace_focus(self, e):
    workspace_string = '  '
    workspaces = i3.get_workspaces()

    ws_nums = [int(n['num']) for n in workspaces]
    focused = [n['visible'] for n in workspaces].index(True)
    urg = [n for n, _ in enumerate(workspaces) if workspaces[n]['urgent'] == True]
    names =[''.join([i for i in n['name'] if not i.isdigit()]) for n in workspaces]

    for n in range(len(ws_nums)):
        if focused == n:
            workspace_string += coloractive + names[n] + '  '
        elif n in urg:
            workspace_string += colorwarning + names[n] + '  '
        else:
            workspace_string += colorinactive + names[n] + '  '

    print(workspace_string, flush=True)

workspace_string = '  '
workspaces = i3.get_workspaces()

ws_nums = [int(n['num']) for n in workspaces]
focused = [n['visible'] for n in workspaces].index(True)
urg = [n for n, _ in enumerate(workspaces) if workspaces[n]['urgent'] == True]
names =[''.join([i for i in n['name'] if not i.isdigit()]) for n in workspaces]

for n in range(len(ws_nums)):
    if focused == n:
        workspace_string += coloractive + names[n] + '  '
    elif n in urg:
        workspace_string += colorwarning + names[n] + '  '
    else:
        workspace_string += colorinactive + names[n] + '  '

print(workspace_string, flush=True)

# Subscribe to events
i3.on('workspace', on_workspace_focus)

# Start the main loop and wait for events to come in.
i3.main()

Does anybody have an idea how I to fix that?

Thank you!

Last edited by tritri (2017-01-15 22:22:00)

Offline

#2 2017-01-15 17:55:35

nesk
Member
Registered: 2011-03-31
Posts: 187

Re: unixporn: i3 lemonbar workspace-indicator [SOLVED]

I have no idea what the problem is, but you tricked me into looking up "unixporn". You, sir, win 3 internets.

Offline

#3 2017-01-15 18:02:03

tritri
Member
Registered: 2016-08-27
Posts: 13

Re: unixporn: i3 lemonbar workspace-indicator [SOLVED]

Hehe.

Still I hope someone can help me smile

Offline

#4 2017-01-15 18:55:11

tritri
Member
Registered: 2016-08-27
Posts: 13

Re: unixporn: i3 lemonbar workspace-indicator [SOLVED]

I fixed it by myself. I had the wrong locale settings. Sorry.

Offline

#5 2017-01-15 19:08:05

nesk
Member
Registered: 2011-03-31
Posts: 187

Re: unixporn: i3 lemonbar workspace-indicator [SOLVED]

If you think others might benefit, post your solution and mark the thread [solved].

Offline

#6 2017-01-15 22:16:47

tritri
Member
Registered: 2016-08-27
Posts: 13

Re: unixporn: i3 lemonbar workspace-indicator [SOLVED]

I don't know excatly what I had for a locale configured.
I did:

localectl set-locale LANG=en_US.UTF-8

After that it worked.

Thanks for the awesome Forum here

[solved]

Last edited by tritri (2017-01-15 22:20:37)

Offline

Board footer

Powered by FluxBB