nowe podejście

This commit is contained in:
2022-04-19 17:56:00 +02:00
parent 8c1b3b2423
commit 060b2022d2
25 changed files with 397 additions and 83 deletions

11
.config/sway/bin/alarms.py Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python3
"""
Alarmy moich SNS
"""
import boto3
client = boto3.client('sns')
print(client.list_subscriptions())

View File

@ -10,4 +10,4 @@ swaylock --indicator-radius 100 \
--text-color ECEFF4 \
--text-caps-lock-color ECEFF4 \
--show-failed-attempts \
-i /home/paramah/Wallpapers/relax.png
-i /home/paramah/Downloads/lockscreen.png

98
.config/sway/bin/mysway.py Executable file
View File

@ -0,0 +1,98 @@
#!/usr/bin/env python3
"""
Prosty demoninik do aktualizacji nazw workspace
"""
from i3ipc import Connection, Event
i3 = Connection()
def glyph(ws_number):
"""
Nazwy worspace
"""
# glyphs = ["", "", "", "", "", "", "", ""]
glyphs = [
".::term:::.",
".:::web:::.",
".:::work::.",
".::((4))::.",
".::debug::.",
".::((6))::.",
".::books::.",
".::meets::.",
".::music::.",
".::mail:::."
]
try:
return glyphs[ws_number - 1]
except IndexError:
return "?"
def change_workspace_name(name):
"""
Zmiana nazwy
"""
try:
pass
except Exception:
raise
else:
pass
finally:
pass
def assign_generic_name(i3, e):
"""
i3 events
"""
try:
if not e.change == 'rename': # avoid looping
con = i3.get_tree().find_focused()
if not con.type == 'workspace':
if not e.change == 'new':
is_floating = con.type == 'floating_con' or con.floating and '_on' in con.floating
# Tiling mode or floating indication. Change symbols if necessary.
ws_old_name = con.workspace().name
ws_name = "%s: %s " % (
con.workspace().num, glyph(con.workspace().num))
i3.command('rename workspace "%s" to %s' %
(ws_old_name, ws_name))
else:
# In sway we may open a new window w/o moving focus; let's give the workspace a name anyway.
con = i3.get_tree().find_by_id(e.container.id)
ws_num = con.workspace().num
w_name = con.name if con.name else ''
if w_name and ws_num:
name = "%s: %s\u00a0%s" % (
ws_num, glyph(ws_num), w_name)
i3.command('rename workspace "%s" to %s' %
(ws_num, name))
else:
# Give the (empty) workspace a generic name: "number: glyph" (like "1: ")
ws_num = con.workspace().num
ws_new_name = "%s: %s" % (ws_num, glyph(ws_num))
i3.command('rename workspace to "{}"'.format(ws_new_name))
except:
pass
def main():
# Subscribe to events
i3.on(Event.WORKSPACE_FOCUS, assign_generic_name)
i3.on(Event.BINDING, assign_generic_name)
i3.main()
if __name__ == "__main__":
main()

8
.config/sway/bin/test.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
WS=$(i3-msg -t 'get_workspaces' | sed -e 's/{"num/\n{"num/g' | grep \"focused\":true | sed -e 's/,"/\n/g' | grep name | cut -d\" -f 3)
WS_TEXT=$(echo $WS | cut -d \: -f 2)
WS_NR=$(echo $WS | cut -d \: -f 1)
NEW=$(zenity --text="Enter new name:" --entry --title="Rename workspace $WS" --entry-text="$WS_TEXT")
i3-msg "rename workspace \"$WS\" to \"$WS_NR:$NEW\""

14
.config/sway/bin/workspaces.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
swaymsg rename workspace number 1 to '1: .>'
swaymsg rename workspace number 2 to '2: .::web::.'
swaymsg rename workspace number 3 to '3: .::IDE::.'
swaymsg rename workspace number 4 to '4: .::VSCode::.'
swaymsg rename workspace number 5 to '5: .::debug::.'
swaymsg rename workspace number 6 to '6: .::tmux::.'
swaymsg rename workspace number 7 to '7: .::sessions::.'
swaymsg rename workspace number 8 to '8: .::terraform::.'
swaymsg rename workspace number 9 to '9: .::music::.'
swaymsg rename workspace number 10 to '10: .::mail::.'

View File

@ -1,12 +1,23 @@
# Define names for workspaces
set $ws1 "1: terminal "
set $ws2 "2: web "
set $ws3 "3: code "
set $ws1 "1: .>"
set $ws2 "2: (web)"
set $ws3 "3: (work)"
set $ws4 "4: (frontend)"
set $ws5 "5: (debug)"
set $ws9 "9: (music)"
set $ws10 "10: (mail)"
workspace 1 output eDP-1
workspace 2 output eDP-1
workspace 1 output eDP1
workspace 2 output eDP1
workspace 3 output DP-3
workspace 4 output DP-3
workspace 5 output DP-4
workspace 10 output eDP-1

View File

@ -12,5 +12,9 @@ for_window [class="zoom"] move scratchpad, floating enable
for_window [class="Signal"] move scratchpad
for_window [class="pavucontrol"] floating enable
for_window [app_id="zenity"] floating enable
for_window [app_id="gnome-calendar"] floating enable
for_window [class="Joplin"] move scratchpad, floating enable

View File

@ -141,6 +141,8 @@ bindsym $mod+r mode "resize"
## Lock screen
bindsym $mod+z exec ~/.config/sway/bin/lock.sh
bindsym Shift+$mod+b exec rofi-buku
## Screenshot // Screenshot active display // <Print> ##
#bindsym Print exec $BIN_DIR/screenshots.sh display
#bindsym --locked Print exec grim -o "$(swaymsg --type get_outputs --raw | jq -r '.[] | select(.focused) | .name')" - | swappy -f -
@ -208,4 +210,4 @@ bindsym $mod+u exec env RUST_BACKTRACE=1 swayr switch-window >> /tmp/swayr.log 2
bindsym $mod+Tab exec env RUST_BACKTRACE=1 swayr switch-to-urgent-or-lru-window >> /tmp/swayr.log 2>&1
bindsym $mod+$alt+Space exec env RUST_BACKTRACE=1 swayr switch-workspace-or-window >> /tmp/swayr.log 2>&1
bindsym $mod+$alt+Space exec env RUST_BACKTRACE=1 swayr switch-workspace-or-window >> /tmp/swayr.log 2>&1

View File

@ -1,4 +1,4 @@
exec --no-startup-id swaymsg 'workspace 1; exec $TERMINAL; workspace 2; exec brave;'
exec --no-startup-id swaymsg 'workspace number 1; exec alacritty; workspace number 10; exec thunderbird; workspace number 9; exec spotify; workspace number 2; exec brave'
exec wl-paste -t text --watch clipman store
exec nm-applet --indicator
@ -13,5 +13,14 @@ exec_always {
gsettings set org.gnome.desktop.wm.preferences button-layout ''
}
exec --no-startup-id swaymsg rename workspace number 1 to $ws1
exec --no-startup-id swaymsg rename workspace number 2 to $ws2
exec --no-startup-id swaymsg rename workspace number 3 to $ws3
exec --no-startup-id swaymsg rename workspace number 4 to $ws4
exec --no-startup-id swaymsg rename workspace number 5 to $ws5
exec --no-startup-id swaymsg rename workspace number 9 to $ws9
exec --no-startup-id swaymsg rename workspace number 10 to $ws10
exec ~/.config/sway/bin/session.sh
#exec ~/.config/sway/bin/assign-cgroups.py