Browse Source

changes

main
Michael Pappe 6 months ago
parent
commit
191764bf51
  1. 6
      .config/fontconfig/fonts.conf
  2. 2
      .config/htop/htoprc##default
  3. 11
      .config/kitty/kitty.conf
  4. 19
      .config/mako/config
  5. 2
      .config/scc/config.json
  6. 14
      .config/sway/conf.d/bind.conf
  7. 2
      .config/sway/conf.d/input.conf
  8. 8
      .config/sway/conf.d/vars.conf
  9. 2
      .config/sway/config
  10. 11
      .config/systemd/user/waybar.service
  11. 216
      .config/waybar/bottom
  12. 144
      .config/waybar/style.css
  13. 123
      .config/waybar/top
  14. 3
      .config/zsh/90_alias.zsh
  15. 2
      .local/bin/profiles.sh
  16. 61
      .local/bin/wssh
  17. 100
      .local/bin/wwindows
  18. 1
      .zshrc

6
.config/fontconfig/fonts.conf

@ -6,7 +6,7 @@
<string>monospace</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>MesloLGLDZ Nerd Font Mono</string>
<string>MesloLGSDZ Nerd Font Mono</string>
</edit>
</match>
<match target="pattern">
@ -14,7 +14,7 @@
<string>sans-serif</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>MesloLGLDZ Nerd Font</string>
<string>MesloLGSDZ Nerd Font</string>
</edit>
</match>
<match target="pattern">
@ -22,7 +22,7 @@
<string>serif</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>MesloLGLDZ Nerd Font</string>
<string>MesloLGSDZ Nerd Font</string>
</edit>
</match>
</fontconfig>

2
.config/htop/htoprc##default

@ -18,7 +18,7 @@ highlight_changes_delay_secs=5
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=1
tree_view=1
tree_view=0
tree_view_always_by_pid=0
header_margin=1
detailed_cpu_time=1

11
.config/kitty/kitty.conf

@ -1,5 +1,6 @@
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
touch_scroll_multiplier 6.0
#: Fonts {{{
#font_family CaskaydiaCoveNerdFontComplete-Regular
@ -9,10 +10,10 @@
#italic_font CaskaydiaCoveNerdFontComplete-SemiLight
#bold_italic_font CaskaydiaCoveNerdFontComplete-ExtraLight
font_family MesloLGSNerdFontComplete-Regular
bold_font MesloLGSNerdFontComplete-Bold
italic_font MesloLGSNerdFontComplete-Italic
bold_italic_font MesloLGS-Nerd-Font
font_family MesloLGSDZNerdFontCompleteM-Regular
bold_font MesloLGSDZNerdFontCompleteM-Bold
italic_font MesloLGSDZNerdFontCompleteM-Italic
bold_italic_font MesloLGSDZ-Nerd-Font-Mono
font_size 10
adjust_line_height 0
@ -75,7 +76,7 @@ pointer_shape_when_grabbed arrow
#: }}}
#: Performance tuning {{{
repaint_delay 1
repaint_delay 10
input_delay 3
sync_to_monitor yes
#: }}}

19
.config/mako/config

@ -1,24 +1,25 @@
sort=-time
layer=overlay
background-color=#2e3440
background-color=#262626CC
width=300
height=110
border-size=2
border-color=#88c0d0
border-radius=1
border-size=0
text-color=#EBDBB2FF
border-color=#00000000
border-radius=0
icons=1
max-icon-size=64
max-icon-size=32
default-timeout=5000
ignore-timeout=1
ignore-timeout=0
[urgency=low]
border-color=#cccccc
border-size=0
[urgency=normal]
border-color=#d08770
border-size=0
[urgency=high]
border-color=#bf616a
background-color=#D75F5FCC
default-timeout=0
[category=mpd]

2
.config/scc/config.json

@ -73,6 +73,6 @@
"version": "0x110"
},
"recent_max": 10,
"recent_profiles": ["3ds-mix", "Desk", "Desktop", "XBox Controller", "X360", "X360_Camera", "XBox Controller with High Precision Camera", "DEsk"],
"recent_profiles": ["Desktop", "Desk", "3ds-mix", "XBox Controller", "X360", "X360_Camera", "XBox Controller with High Precision Camera", "DEsk"],
"windows_opacity": 1.0
}

14
.config/sway/conf.d/bind.conf

@ -10,8 +10,8 @@ bindsym $mod+Return exec $term
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec rofi -config ~/.config/rofi/config.min.rasi -show drun
# bindsym $mod+d exec rofi -config ~/.config/rofi/config.min.rasi -show drun
bindsym $mod+d exec wofi --show drun
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
@ -75,8 +75,6 @@ bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec wlogout -p layer-shell -b 2
# resize window (you can also use the mouse for that)
@ -87,12 +85,6 @@ mode "resize" {
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
@ -103,7 +95,7 @@ mode "resize" {
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
#filemanager
#bindsym $mod+shift+f exec $term -e ranger
#music

2
.config/sway/conf.d/input.conf

@ -7,5 +7,5 @@ input "type:keyboard" {
xkb_layout us,de
xkb_variant altgr-intl,
xkb_model apple_laptop
xkb_options "grp:win_space_toggle"
xkb_options "grp:alt_caps_toggle"
}

8
.config/sway/conf.d/vars.conf

@ -26,7 +26,7 @@ set $base0D #83adad
set $base0E #d485ad
set $base0F #d65d0e
client.focused $base0D $base0D $base00 $base0D $base0D
client.focused $base0C $base0C $base00 $base0C $base0C
client.focused_inactive $base01 $base01 $base05 $base01 $base01
client.unfocused $base01 $base00 $base05 $base01 $base01
client.urgent $base08 $base08 $base00 $base08 $base08
@ -43,9 +43,9 @@ set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
default_border pixel 1
default_floating_border pixel 1
default_border pixel 2
default_floating_border pixel 2
#gaps
gaps outer 3
gaps inner 4
#smart_gaps on
smart_gaps off

2
.config/sway/config

@ -1,5 +1,5 @@
output LVDS-1 {
bg ~/.cache/i3lock/current/wall.png fill
bg ~/.cache/i3lock/current/dim.png fill
}
exec mako
include ~/.config/sway/conf.d/vars.conf

11
.config/systemd/user/waybar.service

@ -1,11 +0,0 @@
[Unit]
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
Documentation=https://github.com/Alexays/Waybar/wiki/
PartOf=graphical-session.target
[Service]
Type=simple
ExecStart=/usr/bin/waybar
[Install]
WantedBy=sway-session.target

216
.config/waybar/bottom

@ -1,26 +1,89 @@
// -*- mode: json -*-
{
"position": "bottom", // Waybar position (top|bottom|left|right)
"height": 22,
"position": "bottom",
"height": 24,
"modules-left": [
"cpu",
"custom/arrow-rl-1",
"memory",
"custom/arrow-rl-1",
"temperature",
"custom/arrow-rs-1",
],
"modules-center": [
"custom/arrow-ls-1w",
"sway/window",
"custom/arrow-rs-1w",
],
"modules-right": [
"custom/arrow-ls-2",
"custom/media",
"custom/arrow-ls-1",
"tray",
"custom/media",
"pulseaudio",
"custom/weather",
],
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"8": "",
"9": "",
"focused": "🗔",
"urgent": "!",
"default": "🗔"
},
},
"sway/window": {
"max-length": 30,
"min-length": 0,
"rotate": 0,
},
"sway/mode": {
"format": ""
},
"tray": {
"icon-size": 16,
"spacing": 10
},
"cpu": {
"format": "{usage}% ",
"tooltip": false,
"min-length": 6,
},
"memory": {
"format": "{}% "
},
"temperature": {
"thermal-zone": 1,
"critical-threshold": 85,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": [
"",
"",
""
],
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"format-icons": {
"Playing": " ",
"Paused": " ",
},
"max-length": 30,
"exec": "playerctl -p spotify metadata --format '{\"text\": \"{{title}} - {{artist}}\", \"tooltip\": \"{{playerName}} : {{title}}\", \"alt\": \"{{status}}\", \"status\": \"{{class}}\"}' -F",
"exec-if": "pgrep spotify",
"on-click": "playerctl -p spotify play-pause",
},
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
@ -45,80 +108,115 @@
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
"icon-size": 16,
"spacing": 10
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
"clock": {
"format": "{:%H:%M}",
"format-alt": "{:%d.%m.%Y %H:%M}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
},
"memory": {
"format": "{}% "
},
"temperature": {
"thermal-zone": 1,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 85,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"backlight": {
//"format": "{percent}% {icon}",
"format": "{icon}",
"format-icons": [
"",
"",
""
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
]
},
"battery": {
"states": {
"good": 81,
"warning": 35,
"critical": 20
},
"format-charging": "{icon} ",
"format-full": "{icon}",
"format": "{icon}",
"format-icons": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"tooltip": false
},
"custom/media": {
"format": "{icon}{}",
"return-type": "json",
"network": {
"format-wifi": "",
"format-ethernet": "",
"format-linked": "(No IP) ",
"format-disconnected": ""
},
"pulseaudio": {
"scroll-step": 2.5, // %, can be a float
"tooltip-format": "{volume}% {icon}",
"format": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": "",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"Playing": " ",
"Paused": " ",
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ""
},
"max-length":70,
"exec": "playerctl -p spotify-qt metadata --format '{\"text\": \"{{title}} - {{artist}}\", \"tooltip\": \"{{playerName}} : {{title}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F",
"on-click": "playerctl -p spotify-qt play-pause",
},
"custom/arrow1": {
"format": "",
"on-click": "pavucontrol-qt",
"tooltip": false,
},
"custom/arrow-lt-1": {
"format": "",
"tooltip": false,
},
"custom/arrow-lt-2":
{
"format": "",
"tooltip": false,
},
"custom/arrow-lt-3":
{
"format": "",
"tooltip": false,
"custom/weather": {
"format": "{}",
"tooltip": true,
"interval": 600,
"exec": "/home/nokogiri/bin/waybar-wttr.py",
"return-type": "json"
},
"custom/arrow-ls-1": {
"format": "",
"tooltip": false,
},
"custom/arrow-ls-2": {
"format": "",
"custom/arrow-rs-1": {
"format": "",
"tooltip": false,
},
"custom/arrow-ls-3": {
"custom/arrow-ls-1w": {
"format": "",
"tooltip": false,
},
"custom/arrow-rl-1": {
"format": "",
"tooltip": false,
},
"custom/arrow-rs-1": {
"custom/arrow-rs-1w": {
"format": "",
"tooltip": false,
},
"custom/arrow2": {
"format": "",
"tooltip": false,
},
}

144
.config/waybar/style.css

@ -1,5 +1,6 @@
@define-color c0 #262626;
@define-color c0_8 rgba(38, 38, 38, 0.8);
@define-color c0_2 rgba(38, 38, 38, 0.4);
@define-color c1 #D75F5F;
@define-color c2 #AFAF00;
@define-color c3 #FFAF00;
@ -26,8 +27,8 @@
@define-color critical #D75F5F;
@define-color block-1 @dark;
@define-color block-2 @c20;
@define-color block-3 @c6;
@define-color block-2 @c6;
@define-color block-3 @c15;
* {
border: none;
@ -53,11 +54,11 @@ tooltip * {
#waybar {
font-family: "MesloLGMDZ Nerd Font";
font-size: 12px;
font-size: 9pt;
}
window#waybar {
background: @c0_8;
background: @c0_2;
color: @light;
transition-duration: 1.0s;
transition-property: color;
@ -68,7 +69,7 @@ window#waybar.hidden {
}
#workspaces {
font-size: 15px;
background-color: @dark;
background-color: @c0_8;
}
#workspaces button {
@ -95,55 +96,32 @@ window#waybar.hidden {
color: @critical;
}
#mode {
background-color: #64727D;
border-bottom: 1px solid #FFF;
}
#tray,
/* 1st block */
#custom-weather,
#clock,
#custom-weather {
background-color: @block-1;
color: @light;
margin: 0 0px;
padding: 0 10px;
}
#pulseaudio,
#network {
background-color: @block-3;
color: @dark;
margin: 0 0px;
padding: 0 10px;
}
#backlight,
#battery {
background-color: @block-2;
color: @dark;
margin: 0 0px;
padding: 0 10px;
}
#memory,
#battery,
#custom-media,
#cpu,
#temperature {
background-color: @block-1;
#memory,
#mode,
#temperature,
#network,
#window,
#pulseaudio,
#tray {
background-color: @c0_8;
color: @light;
margin: 0 0px;
padding: 0 10px;
}
#window {
window#waybar.empty #custom-arrow-ls-1w,
window#waybar.empty #custom-arrow-rs-1w,
window#waybar.empty #window {
padding: 0 0 0 0;
color: transparent;
background: none;
color: @light;
}
#window,
#workspaces {
margin: 0 0px;
padding-left: 2px;
padding-right: 2px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
@ -180,12 +158,6 @@ label:focus {
background-color: transparent;
}
#custom-media {
background-color: @block-2;
color: @dark;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #AFAF00;
}
@ -193,24 +165,11 @@ label:focus {
#custom-media.custom-vlc {
background-color: #FFA000;
}
#custom-spotify {
background: @c2;
color: @dark;
}
#temperature.critical {
background-color: #EB4D4B;
}
#idle_inhibitor {
background-color: #2D3436;
}
#idle_inhibitor.activated {
background-color: #ECF0F1;
color: #2D3436;
}
#language {
background: #00B093;
color: #740864;
@ -219,54 +178,13 @@ label:focus {
padding: 0 5px;
}
#custom-arrow1 {
background: #4E4E4E;
color: #949494;
font-size: 15px;
}
#custom-arrow2 {
font-size: 15px;
background: #949494;
color: #EBDBB2;
}
#custom-arrow-lt-1 {
background: @block-1;
color: @block-2;
font-size: 15px;
}
#custom-arrow-lt-2 {
background: @block-2;
color: @block-1;
font-size: 15px;
}
#custom-arrow-lt-3 {
background: @block-3;
color: @block-1;
font-size: 15px;
}
#custom-arrow-ls-1 {
background: @block-2;
color: @block-1;
font-size: 15px;
}
#custom-arrow-ls-2 {
background: @block-3;
color: @block-2;
font-size: 15px;
}
#custom-arrow-ls-3 {
background: transparent;
color: @block-3;
font-size: 15px;
}
#custom-arrow-rl-1 {
background: @block-1;
color: @block-2;
font-size: 15px;
}
#custom-arrow-ls-1w,
#custom-arrow-rs-1w,
#custom-arrow-ls-1,
#custom-arrow-rs-1 {
font-family: "MesloLGLDZ Nerd Font Mono";
font-size: 11pt;
background: none;
color: @block-1;
font-size: 15px;
color: @c0_8;
}

123
.config/waybar/top

@ -2,27 +2,23 @@
{
"position": "top",
"height": 22,
"height": 24,
"modules-left": [
"sway/workspaces",
"custom/arrow-rs-1"
"sway/mode",
"custom/arrow-rs-1",
],
"modules-center": [
"sway/window"
"custom/arrow-ls-1",
"clock",
"custom/arrow-rs-1",
],
"modules-right": [
"custom/arrow-ls-3",
"pulseaudio",
"custom/arrow-lt-3",
"custom/arrow-ls-1",
"network",
"custom/arrow-ls-2",
"backlight",
"custom/arrow-lt-2",
"battery",
"custom/arrow-ls-1",
"custom/weather",
"custom/arrow-lt-1",
"clock"
"tray",
],
"sway/workspaces": {
"disable-scroll": true,
@ -44,14 +40,50 @@
},
},
"sway/window": {
"max-length": 50,
"min-length": 10,
"max-length": 30,
"min-length": 0,
"rotate": 0,
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
"format": ""
},
"tray": {
"icon-size": 16,
"spacing": 10
},
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ ",
"cpu": {
"format": "{usage}% ",
"tooltip": false,
"min-length": 6,
},
"memory": {
"format": "{}% "
},
"temperature": {
"thermal-zone": 1,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 85,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": [
"",
"",
""
],
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"format-icons": {
"Playing": " ",
"Paused": " ",
},
"max-length": 30,
"exec": "playerctl -p spotify metadata --format '{\"text\": \"{{title}} - {{artist}}\", \"tooltip\": \"{{playerName}} : {{title}}\", \"alt\": \"{{status}}\", \"status\": \"{{class}}\"}' -F",
"exec-if": "pgrep spotify",
"on-click": "playerctl -p spotify play-pause",
},
"mpd": {
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
@ -89,26 +121,13 @@
"spacing": 10
},
"clock": {
"format": "{:%H:%M}",
"format": "{:%d.%m. - %H:%M}",
"format-alt": "{:%d.%m.%Y %H:%M}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
"thermal-zone": 1,
"critical-threshold": 85,
"format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
"format": "{percent}% {icon}",
//"format": "{percent}% {icon}",
"format": "{icon}",
"format-icons": [
"",
"",
@ -133,9 +152,9 @@
"warning": 35,
"critical": 20
},
"format-charging": "{capacity}% {icon} ",
"format-full": "{capacity}% {icon}",
"format": "{capacity}% {icon}",
"format-charging": "{icon} ",
"format-full": "{icon}",
"format": "{icon}",
"format-icons": [
"",
"",
@ -152,7 +171,7 @@
},
"network": {
"format-wifi": "{signalStrength}% ",
"format-wifi": "",
"format-ethernet": "",
"format-linked": "(No IP) ",
"format-disconnected": ""
@ -175,7 +194,7 @@
"car": "",
"default": ""
},
"on-click": "pavucontrol",
"on-click": "pavucontrol-qt",
"tooltip": false,
},
"custom/weather": {
@ -185,42 +204,12 @@
"exec": "/home/nokogiri/bin/waybar-wttr.py",
"return-type": "json"
},
"custom/arrow1": {
"format": "",
"tooltip": false,
},
"custom/arrow-lt-1": {
"format": "",
"tooltip": false,
},
"custom/arrow-lt-2":
{
"format": "",
"tooltip": false,
},
"custom/arrow-lt-3":
{
"format": "",
"tooltip": false,
},
"custom/arrow-ls-1": {
"format": "",
"tooltip": false,
},
"custom/arrow-ls-2": {
"format": "",
"tooltip": false,
},
"custom/arrow-ls-3": {
"format": "",
"tooltip": false,
},
"custom/arrow-rs-1": {
"format": "",
"tooltip": false,
},
"custom/arrow2": {
"format": "",
"tooltip": false,
},
}

3
.config/zsh/90_alias.zsh

@ -25,6 +25,7 @@ alias o='xdg-open'
alias rm!='\rm -rf'
alias rsync='rsync --verbose --archive --info=progress2 --human-readable --partial'
alias sudo='sudo -E '
alias sud='sudo '
alias tree='tree -a -I .git --dirsfirst'
alias ll='ls -l'
alias utc='env TZ=UTC date'
@ -39,7 +40,7 @@ alias o='xdg-open '
#systemctl
alias sys='systemctl'
alias sys='sud systemctl'
alias sysu='systemctl --user'
alias status='sys status'
alias statusu='sysu status'

2
.local/bin/profiles.sh

@ -10,7 +10,7 @@ curr_p=`scc info | tail -n1 | awk '{print $4}'|xargs -I % basename % .sccprofile
set_profile "Desk"
new_p=`scc list-profiles | rofi -dmenu -p "Profiles"`
new_p=`scc list-profiles | wofi --dmenu -c $HOME/.config/wofi/minimal -p "Profiles"`
if [ ! -z $new_p ]; then
set_profile $new_p
notify-send --app-name="SC-Controller" "SC-Controller" "${new_p}"

61
.local/bin/wssh

@ -0,0 +1,61 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
import subprocess
import json
import os
ssh_config_file = "~/.ssh/config"
# Returns a list of all hosts
def get_hosts():
hosts = []
with open(os.path.expanduser(ssh_config_file)) as f:
content = f.readlines()
for line in content:
line = line.lstrip()
# Ignore wildcards
if line.startswith('Host ') and not '*' in line:
for host in line.split()[1:]:
hosts.append(host)
# Removes duplicate entries
hosts = sorted(set(hosts))
return hosts
# Returns a newline seperated UFT-8 encoded string of all ssh hosts
def parse_hosts(hosts):
return "\n".join(hosts).encode("UTF-8")
# Executes wofi with the given input string
def show_wofi(hosts):
command="wofi -p \"SSH hosts: \" -d -i --hide-scroll"
process = subprocess.Popen(command,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
ret = process.communicate(input=hosts)
host, rest = ret
return host
# Switches the focus to the given id
def ssh_to_host(host, terminal, ssh_command):
command = "{terminal} {ssh_command} {host}".format(terminal=terminal, ssh_command=ssh_command, host=host)
process = subprocess.Popen(command,shell=True)
# Entry point
if __name__ == "__main__":
parser = ArgumentParser(description="Wofi based ssh launcher")
parser.add_argument("terminal", help='Terminal command to use')
parser.add_argument("--ssh-command", dest='ssh_command', default='ssh', help='ssh command to use (default=ssh)')
args = parser.parse_args()
hosts = get_hosts()
parsed_hosts = parse_hosts(hosts)
selected = show_wofi(parsed_hosts)
selected_host = selected.decode('utf-8').rstrip()
ssh_to_host(selected_host, args.terminal, args.ssh_command)

100
.local/bin/wwindows

@ -0,0 +1,100 @@
#!/bin/python3
from argparse import ArgumentParser
import subprocess
import json
enter="\n"
# Returns a list of all json window objects
def get_windows():
command="swaymsg -t get_tree"
active_outputs = []
process = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
data = json.loads(process.communicate()[0])
# Select outputs that are active
windows = []
for output in data['nodes']:
# The scratchpad (under __i3) is not supported
if output.get('name') != '__i3' and output.get('type') == 'output':
workspaces = output.get('nodes')
for ws in workspaces:
if ws.get('type') == 'workspace':
windows += extract_nodes_iterative(ws)
return windows
# Extracts all windows from a sway workspace json object
def extract_nodes_iterative(workspace):
all_nodes = []
floating_nodes = workspace.get('floating_nodes')
for floating_node in floating_nodes:
all_nodes.append(floating_node)
nodes = workspace.get('nodes')
for node in nodes:
# Leaf node
if len(node.get('nodes')) == 0:
all_nodes.append(node)
# Nested node, handled iterative
else:
for inner_node in node.get('nodes'):
nodes.append(inner_node)
return all_nodes
# Returns an array of all windows
def parse_windows(windows):
parsed_windows = []
for window in windows:
parsed_windows.append(window.get('name'))
return parsed_windows
# Returns a newline seperated UFT-8 encoded string of all windows for wofi
def build_wofi_string(windows):
return enter.join(windows).encode("UTF-8")
# Executes wofi with the given input string
def show_wofi(windows):
command="wofi -p \"Windows: \" -d -i --hide-scroll"
process = subprocess.Popen(command,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
return process.communicate(input=windows)[0]
# Returns the sway window id of the window that was selected by the user inside wofi
def parse_id(windows, parsed_windows, selected):
selected = (selected.decode("UTF-8"))[:-1] # Remove new line character
window_index = int(parsed_windows.index(selected)) # Get index of selected window in the parsed window array
return str(windows[window_index].get('id')) # Get sway window id based on the index
# Switches the focus to the given id
def switch_window(id):
command="swaymsg [con_id={}] focus".format(id)
process = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE)
process.communicate()[0]
# Entry point
if __name__ == "__main__":
parser = ArgumentParser(description="Wofi based window switcher")
windows = get_windows()
parsed_windows = parse_windows(windows)
wofi_string = build_wofi_string(parsed_windows)
selected = show_wofi(wofi_string)
selected_id = parse_id(windows, parsed_windows, selected)
switch_window(selected_id)

1
.zshrc

@ -104,4 +104,3 @@ for file in ${config_files}
do
source $file
done
export LC_ALL=
Loading…
Cancel
Save