walpaper: https://www.wallpaperbetter.com/en/hd-wallpaper-wgwgr
----------------------------------------------------------------
$HOME/.profile
--------------------------------------------------------------------
export EDITOR=/usr/bin/geany
export BROWSER=firefox
export TERM=alacritty
#export MAIL=geary
#export QT_QPA_PLATFORMTHEME="qt5ct"
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# Session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
# GTK
export MOZ_ENABLE_WAYLAND=1 # only start firefox in wayland mode and no other GTK apps
export MOZ_DBUS_REMOTE=1 # fixes firefox is already running, but is not responding
#export GDK_BACKEND=wayland # this can prevent programs from starting (e.g. chromium and electron apps). therefore, this should be set per app instead of globally.
# clutter
#export CLUTTER_BACKEND=wayland # this can prevent programs from starting. therefore, this should be set per app instead of globally.
# elementary
export ECORE_EVAS_ENGINE=wayland-egl
export ELM_ENGINE=wayland_egl
#export ELM_DISPLAY=wl
#export ELM_ACCEL=gl
# java
export _JAVA_AWT_WM_NONREPARENTING=1
export NO_AT_BRIDGE=1
export BEMENU_BACKEND=wayland
# sdl
#export SDL_VIDEODRIVER=wayland # this can prevent programs from starting old sdl games. therefore, this should be set per app instead of globally.
# Qt
export QT_QPA_PLATFORM=wayland
#export QT_WAYLAND_FORCE_DPI=physical
#export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
---------------------------------------------------------
$HOME/.gtkrc-2.0
------------------------------------------------------------------
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
gtk-theme-name="Nordic-darker"
gtk-icon-theme-name="Tela-circle-dark"
gtk-sound-theme-name="Smooth"
gtk-font-name="Google Sans Regular 10"
gtk-cursor-theme-name="capitaine-cursors"
gtk-cursor-theme-size=24
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=0
gtk-enable-input-feedback-sounds=0
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"
gtk-xft-rgba="none"
gtk-modules="canberra-gtk-module:gail:atk-bridge"
----------------------------------------------------------------
$HOME/.bashrc
-----------------------------------------------------------------
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
source ~/.profile
HISTCONTROL=ignoredups:erasedups
shopt -s histappend
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
alias dir='dir --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias grep='grep --color=auto'
alias upd='/usr/bin/update'
alias wget='wget -c '
alias cleanup='sudo pacman -Rns `pacman -Qtdq`'
alias jctl="journalctl -p 3 -xb"
-----------------------------------------------------------------
$HOME/.bash_profile
-----------------------------------------------------------------
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
--------------------------------------------------------------
$HOME/.config/alacritty/alacritty.yml
----------------------------------------------------------------
colors:
primary:
background: '#282c34'
foreground: '#d8dee9'
dim_foreground: '#282c34'
cursor:
text: '#2e3440'
cursor: '#d8dee9'
vi_mode_cursor:
text: '#2e3440'
cursor: '#d8dee9'
selection:
text: CellForeground
background: '#4c566a'
search:
matches:
foreground: CellBackground
background: '#88c0d0'
bar:
background: '#434c5e'
foreground: '#d8dee9'
normal:
black: '#434c5e'
red: '#f9929b'
green: '#98c379'
yellow: '#ebcb8b'
blue: '#81a1c1'
magenta: '#b48ead'
cyan: '#88c0d0'
white: '#d8dee9'
bright:
black: '#4c566a'
red: '#bf616a'
green: '#8fbcbb'
yellow: '#fbdf90'
blue: '#81a1c1'
magenta: '#d2b8ed'
cyan: '#8fbcbb'
white: '#d8dee9'
dim:
black: '#373e4d'
red: '#94545d'
green: '#809575'
yellow: '#b29e75'
blue: '#68809a'
magenta: '#8c738c'
cyan: '#6d96a5'
white: '#aeb3bb'
key_bindings:
- { key: Return, mods: Control|Shift, action: SpawnNewInstance }
background_opacity: 1.00
window:
padding:
x: 20
y: 20
font:
normal:
family: monospace
style: Regular
size: 12
live_config_reload: true
dynamic_padding: true
background_opacity: 0.6
-------------------------------------------------------------------
$HOME/.config/gtk-3.0/settings.ini
-------------------------------------------------------------------
[Settings]
gtk-theme-name=Nordic-darker
gtk-icon-theme-name=Tela-circle-dark
gtk-font-name=Noto Sans 10
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=0
gtk-enable-input-feedback-sounds=0
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintmedium
gtk-xft-rgba=rgb
----------------------------------------------------------------
$HOME/.config/gtk-3.0/bookmarks
-----------------------------------------------------------------
file:///home/kai/Downloads Downloads
file:///home/kai/Documents Documents
file:///home/kai/Pictures Pictures
---------------------------------------------------------------
$HOME/.config/mako/config
---------------------------------------------------------------
anchor=bottom-right
font=monospace 10
background-color=#3b4252
text-color=#eceff4
width=350
margin=0,20,20
padding=10
border-size=2
border-color=#4c566a
border-radius=5
default-timeout=10000
group-by=summary
[grouped]
format=<b>%s</b>\n%b
--------------------------------------------------------------
$HOME/.config/mpv/mpv.conf
---------------------------------------------------------------
geometry=50%
mute=yes
ontop=yes
#profile=gpu-hq
hwdec=auto
#vo=gpu
#gpu-context=wayland
#slang=en
#alang=fi,en
#include=/path/to/the/file/you/want/to/include
#[eye-cancer]
#sharpen=5
#keepaspect=no
save-position-on-quit
--------------------------------------------------------------------
$HOME/.config/swappy/config
--------------------------------------------------------------------
[Default]
save_dir=$HOME/Pictures
save_filename_format=swappy-%Y%m%d-%H%M%S.png
line_size=5
text_size=20
text_font=sans-serif
-----------------------------------------------------------------
$HOME/.config/sway/config
------------------------------------------------------------------
set $mod Mod4
set $mod1 Mod1
set $left h
set $down j
set $up k
set $right l
set $term alacritty
set $fm pcmanfm
set $browser firefox
set $menu wofi -c ~/.config/wofi/config -I
set $editor geany
#workspace
set $WS1 1
set $WS2 2
set $WS3 3
set $WS4 4
set $WS5 5
set $WS6 6
set $WS7 7
#wm rules
for_window [window_role=pop-up,task_dialog,About] floating enable
for_window [app_id= mpv|imv|pavucontrol] floating enable
for_window [urgent=latest] focus
for_window [app_id=.*] focus
assign [app_id="Alacritty"] $WS1
assign [app_id="firefox"] $WS2
assign [app_id="pcmanfm"] $WS3
assign [app_id="geany"] $WS4
assign [app_id="mpv"] $WS5
assign [app_id=org.pwmt.zathura,gimp] $WS6
floating_modifier $mod normal
xwayland disable
gaps inner 2
gaps outer 2
default_border pixel 3
#smart_borders on
#autostart
output * bg ~/Pictures/wall/nord.jpg fill
exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec mako
#shortcuts
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym Control+XF86AudioMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym Control+XF86AudioRaiseVolume exec pactl set-source-volume @DEFAULT_SOURCE@ +5%
bindsym Control+XF86AudioLowerVolume exec pactl set-source-volume @DEFAULT_SOURCE@ -5%
bindsym XF86MonBrightnessUp exec light -A 1
bindsym XF86MonBrightnessDown exec light -U 1
bindsym Control+XF86MonBrightnessUp exec light -A 5
bindsym Control+XF86MonBrightnessDown exec light -U 5
bindsym $mod+e exec $fm
bindsym $mod+w exec $browser
bindsym $mod+Return exec $term
bindsym $mod+d exec $menu
bindsym Print exec ~/.local/bin/screenshot
bindsym $mod+i exec $editor ~/.config/sway/config
bindsym $mod+Shift+i exec $editor ~/.config/waybar/config
bindsym $mod+q kill
bindsym $mod+p exec ~/.config/wofi/windows.py
bindsym $mod+Shift+r reload
bindsym $mod+Escape 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' 'swaymsg exit'
bindsym $mod+1 workspace $WS1
bindsym $mod+2 workspace $WS2
bindsym $mod+3 workspace $WS3
bindsym $mod+4 workspace $WS4
bindsym $mod+5 workspace $WS5
bindsym $mod+6 workspace $WS6
bindsym $mod+7 workspace $WS7
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $WS1
bindsym $mod+Shift+2 move container to workspace $WS2
bindsym $mod+Shift+3 move container to workspace $WS3
bindsym $mod+Shift+4 move container to workspace $WS4
bindsym $mod+Shift+5 move container to workspace $WS5
bindsym $mod+Shift+6 move container to workspace $WS6
bindsym $mod+Shift+7 move container to workspace $WS7
# Layout stuff:
bindsym $mod+b splith
bindsym $mod+v splitv
bindsym $mod1+s layout stacking
bindsym $mod1+w layout tabbed
bindsym $mod1+e layout toggle split
bindsym $mod+f fullscreen
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
bindsym $mod+a focus parent
# Scratchpad:
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
#indow manipulation
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# Resizing containers:
bindsym $mod1+Left resize shrink width 10px
bindsym $mod1+Down resize grow height 10px
bindsym $mod1+Up resize shrink height 10px
bindsym $mod1+Right resize grow width 10px
# Status Bar:
bar {
position top
swaybar_command waybar
}
#touchpad tap to click
input type:touchpad {
dwt enabled
tap enabled
natural_scroll enabled
}
#multiple keyboard layout
input * {
xkb_layout "us,np"
xkb_options "grp:shifts_toggle"
}
## Window decoration
# class border backgr. text indicator child_border
client.focused #88c0d0 #434c5e #eceff4 #8fbcbb #88c0d0
client.focused_inactive #88c0d0 #2e3440 #d8dee9 #4c566a #4c566a
client.unfocused #88c0d0 #2e3440 #d8dee9 #4c566a #4c566a
client.urgent #ebcb8b #ebcb8b #2e3440 #8fbcbb #ebcb8b
include /etc/sway/config.d/*
---------------------------------------------------------------------
$HOME/.config/waybar/config
---------------------------------------------------------------------
{
"layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height": 25,
"modules-left": ["custom/launcher","sway/workspaces", "sway/mode"],
"modules-right": ["custom/pacman","idle_inhibitor","custom/keyboard-layout", "network" ,"backlight", "pulseaudio", "battery" ,"clock","tray","custom/power"],
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{icon}",
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"sway/window": {
"format": "{}",
"max-length": 20,
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
"icon-size": 14,
"spacing": 5
},
"clock": {
"tooltip-format": "{:%A %B %d %Y | %H:%M}",
"format": " {:%a %d %b %I:%M %p}", //12 hour format
//"format": " {:%a %d %b %H:%M}", //24 hour format
"format-alt": " {:%d/%m/%Y %H:%M:%S}",
//"timezones": [ "Kolkata" ],
//"max-length": 200
"interval": 1
},
"memory": {
"format": "{used:0.1f}G",
"on-click": "alacritty -e htop"
},
"backlight": {
// "device": "acpi_video1",
"format": "{icon} {percent}%",
"format-icons": ["", ""],
"on-scroll-down": "light -A 1%",
"on-scroll-up": "light -U 1%"
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
//"format-icons": ["", "", "", "", "", "", "", "", "", ""]
},
"network": {
// "interface": "wlp2s0", // (Optional) To force the use of this interface
"format": "⚠ Disabled",
"format-wifi": " {essid}",
"format-ethernet": " {ifname}: {ipaddr}/{cidr}",
"format-disconnected": "",
// "on-click": "alacritty -e sudo wifi-menu"
},
"pulseaudio": {
"scroll-step": 5,
"format": "{icon} {volume}%",
"format-bluetooth": "{icon} {volume}%",
"format-muted":"muted ",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
},
"custom/pacman": {
"format": " {}",
"interval": 7200, // every two hours
"exec": "checkupdates | wc -l", // # of updates
"exec-if": "exit 0", // always run; consider advanced run conditions
"on-click": "alacritty -e sudo pacman -Syu ; pkill -SIGRTMIN+8 waybar", // update system
"signal": 8
},
"custom/power": {
"format":"⏻",
"on-click": "nwgbar",
"tooltip": false,
},
"custom/keyboard-layout": {
"exec": "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4",
// Interval set only as a fallback, as the value is updated by signal
"interval": 5,
"format": " {}", // Icon: keyboard
// Signal sent by Sway key binding (~/.config/sway/key-bindings)
"signal": 1, // SIGHUP
"tooltip": false,
// "on-click": "~/.config/waybar/scripts/keyhint.sh",
},
"custom/launcher": {
"format":" ",
"on-click": "wofi -I ",
"tooltip": false,
},
}
-------------------------------------------------------------------------
$HOME/.config/waybar/style.css
---------------------------------------------------------------------
/* =============================================================================
*
* Waybar configuration
*
* Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
*
* =========================================================================== */
/* -----------------------------------------------------------------------------
* Keyframes
* -------------------------------------------------------------------------- */
/*
Polar Night
nord0 #2e3440
nord1 #3b4252
nord2 #434c5e
nord3 #4c566a
Snow Storm
nord4 #d8dee9
nord5 #e5e9f0
nord6 #eceff4
Frost
nord7 #8fbcbb
nord8 #88c0d0
nord9 #81a1c1
nord10 #5e81ac
Aurora
nord11 #bf616a
nord12 #d08770
nord13 #ebcb8b
nord14 #a3be8c
nord15 #b48ead
*/
/* -----------------------------------------------------------------------------
* Base styles
* -------------------------------------------------------------------------- */
/* Reset all styles */
* {
color: #eceff4;
border: 0;
border-radius: 0;
padding: 0 0;
font-family:UbuntuMono;
font-size: 15px;
margin-right: 5px;
margin-left: 5px;
padding-bottom:3px;
}
window#waybar {
background:#2e3440;
}
#workspaces button {
padding: 2px 0px;
border-bottom: 2px;
color: #eceff4;
border-color: #d8dee9;
border-style: solid;
margin-top:2px;
}
#workspaces button.focused {
border-color: #81a1c1;
}
#mode {
color: #ebcb8b;
}
#clock, #battery, #cpu, #memory,#idle_inhibitor, #temperature,#custom-keyboard-layout, #backlight, #network, #pulseaudio, #mode, #tray, #window,#custom-launcher,#custom-power,#custom-pacman {
padding: 0 3px;
border-bottom: 2px;
border-style: solid;
}
/* -----------------------------------------------------------------------------
* Module styles
* -------------------------------------------------------------------------- */
#clock {
color:#a3be8c;
}
#backlight {
color: #ebcb8b;
}
#battery {
color: #d8dee9;
}
#battery.charging {
color: #81a1c1;
}
@keyframes blink {
to {
color: #4c566a;
background-color: #eceff4;
}
}
#battery.critical:not(.charging) {
background: #bf616a;
color: #eceff4;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#cpu {
color:#a3be8c ;
}
#memory {
color: #d3869b;
}
#network.disabled {
color:#bf616a;
}
#network{
color:#a3be8c;
}
#network.disconnected {
color: #bf616a;
}
#pulseaudio {
color: #b48ead;
}
#pulseaudio.muted {
color: #3b4252;
}
#temperature {
color: #8fbcbb;
}
#temperature.critical {
color: #bf616a;
}
#idle_inhibitor {
color: #ebcb8b;
}
#tray {
}
#custom-launcher,#custom-power{
border-style: hidden;
margin-top:2px;
}
#window{
border-style: hidden;
margin-top:1px;
}
#mode{
margin-bottom:3px;
}
#custom-keyboard-layout{
color:#d08770;
}
------------------------------------------------------------------
$HOME/.config/wofi/config
-----------------------------------------------------------------
xoffset=660
yoffset=275
show=drun
width=600
height=500
always_parse_args=true
show_all=true
print_command=true
insensitive=true
prompt=
---------------------------------------------------------------
$HOME/.config/wofi/style.css
------------------------------------------------------------------
/*
scheme: "Nord"
author: "arcticicestudio"
*/
@define-color base10 #2E3440;
@define-color base00 #3B4252;
@define-color base02 #434C5E;
@define-color base03 #4C566A;
@define-color base04 #D8DEE9;
@define-color base05 #E5E9F0;
@define-color base06 #ECEFF4;
@define-color base07 #8FBCBB;
@define-color base08 #88C0D0;
@define-color base09 #81A1C1;
@define-color base0A #5E81AC;
@define-color base0B #BF616A;
@define-color base0C #D08770;
@define-color base0D #EBCB8B;
@define-color base0E #A3BE8C;
@define-color base0F #B48EAD;
#entry {
border-radius: 0px;
padding: 5px 2px 5px 2px;
margin: 0px 4px 0px 4px;
}
@keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}
#entry:selected {
color: @base0D;
background-color: @base02;
padding: 7px;
}
#text:selected {
color: @base04;
}
#window {
animation-name: fadeIn;
animation-duration: 0.4s;
background-color: transparent;
font-family: Ubuntu Mono;
/* font-size:14; */
}
#input {
border: none;
background-color: @base10;
border-radius: 0px;
margin: 4px 4px 8px 4px;
padding: 8px;
}
#inner-box {
color: @base04;
border-radius: 0px;
/* margin-right: 180px; */
}
#outer-box {
background-color: @base00;
border-radius: 0px;
border: 1px solid #474747;
padding: 10px;
box-shadow: 0px 0px 3px 1px #0F0F0F;
margin: 1px;
}
#scroll {
}
#text {
color: @base04;
background-color: transparent;
}
#img {
background-color: transparent;
}
---------------------------------------------------------------------
$HOME/.config/wofi/style.widgets.css
------------------------------------------------------------------
/*
scheme: "Nord"
author: "arcticicestudio"
*/
@define-color base10 #2E3440;
@define-color base00 #3B4252;
@define-color base02 #434C5E;
@define-color base03 #4C566A;
@define-color base04 #D8DEE9;
@define-color base05 #E5E9F0;
@define-color base06 #ECEFF4;
@define-color base07 #8FBCBB;
@define-color base08 #88C0D0;
@define-color base09 #81A1C1;
@define-color base0A #5E81AC;
@define-color base0B #BF616A;
@define-color base0C #D08770;
@define-color base0D #EBCB8B;
@define-color base0E #A3BE8C;
@define-color base0F #B48EAD;
*{
font-family: UbuntuMono;
}
#window {
margin: 0px 5px 0px 5px;
}
#inner-box {
background-color: @back;
}
#outer-box {
margin: 5px;
padding:10px;
background-color: @back;
margin-top: -22px;
}
#scroll {
}
#text {
padding: 5px;
color: white;
}
#entry {
}
#entry:selected {
background-color: @base03;
}
#text:selected {
}
---------------------------------------------------------------------
$HOME/.config/wofi/windows.py
--------------------------------------------------------------------
#!/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 -c ~/.config/wofi/config -s ~/.config/wofi/style.css -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)
--------------------------------------------------------------------
$HOME/.local/bin/import-gsettings
--------------------------------------------------------------------
#!/bin/sh
# usage: import-gsettings
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
gnome_schema="org.gnome.desktop.interface"
gtk_theme="$(grep 'gtk-theme-name' "$config" | cut -d'=' -f2)"
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | cut -d'=' -f2)"
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | cut -d'=' -f2)"
font_name="$(grep 'gtk-font-name' "$config" | cut -d'=' -f2)"
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
gsettings set "$gnome_schema" icon-theme "$icon_theme"
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
gsettings set "$gnome_schema" font-name "$font_name"
----------------------------------------------------------------------
$HOME/.local/bin/powermenu
--------------------------------------------------------------------
#!/bin/bash
chosen=$(echo -e "[xx Cancel]\n Logout\n Shutdown\n Reboot\nzz Sleep\n Hibernate\nzz Sleephibernate" | wofi -W 12 -b -w 6 -L 8 -dmenu -i)
if [[ $chosen = " Logout" ]]; then
swaymsg exit
elif [[ $chosen = " Shutdown" ]]; then
systemctl poweroff
elif [[ $chosen = " Reboot" ]]; then
systemctl reboot
elif [[ $chosen = "zz Sleep" ]]; then
systemctl suspend
elif [[ $chosen = " Hibernate" ]]; then
systemctl hibernate
elif [[ $chosen = "zz Sleephibernate" ]]; then
systemctl suspend-then-hibernate
fi
---------------------------------------------------------------------
$HOME/.local/bin/screenshot
-------------------------------------------------------------------
#!/bin/bash
# `list_geometry` returns the geometry of the focused of visible windows. You can also get they title
# by setting a second argument to `with_description`. The geometry and the title are seperated by `\t`.
#
# Arguments:
# $1: `focused` or `visible`
# $2: `with_description` or nothing
#
# Output examples:
# - with the `with_description` option:
# 12,43 100x200\tTermite
# - without the `with_description` option:
# 12,43 100x200
function list_geometry () {
[ "$2" = with_description ] && local append="\t\(.name)" || local append=
swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.'$1' and .pid) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)'$append'"'
}
WINDOWS=`list_geometry visible with_description`
FOCUSED=`list_geometry focused`
CHOICE=`wofi -dmenu -p 'Screenshot' << EOF
fullscreen
region
focused
$WINDOWS
EOF`
SAVEDIR=${SWAY_INTERACTIVE_SCREENSHOT_SAVEDIR:=~}
mkdir -p -- "$SAVEDIR"
FILENAME="$SAVEDIR/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"
EXPENDED_FILENAME="${FILENAME/#\~/$HOME}"
case $CHOICE in
fullscreen)
grim "$EXPENDED_FILENAME"
;;
region)
grim -g "$(slurp)" "$EXPENDED_FILENAME"
;;
focused)
grim -g "$FOCUSED" "$EXPENDED_FILENAME"
;;
'')
notify-send "Screenshot" "Cancelled"
exit 0
;;
*)
GEOMETRY="`echo \"$CHOICE\" | cut -d$'\t' -f1`"
grim -g "$GEOMETRY" "$EXPENDED_FILENAME"
esac
# If swappy is installed, prompt the user to edit the captured screenshot
if command -v swappy $>/dev/null
then
EDIT_CHOICE=`wofi -dmenu -p 'Edit' -lines 2 << EOF
yes
no
EOF`
case $EDIT_CHOICE in
yes)
swappy -f "$EXPENDED_FILENAME" -o "$EXPENDED_FILENAME"
;;
no)
;;
'')
;;
esac
fi
wl-copy < "$EXPENDED_FILENAME"
notify-send "Screenshot" "File saved as <i>'$FILENAME'</i> and copied to the clipboard." -i "$EXPENDED_FILENAME"
-------------------------------------------------------------------
$HOME/.local/bin/swayprop
----------------------------------------------------------------
#!/bin/bash
#this is xprop for sway
ALL_NODES='recurse(.nodes[]?, .floating_nodes[]?) | select(.pid and .visible)'
WINDOW_NAME='(.app_id // .window_properties.class)'
ID_PREFIX='"\(.id):"'
WINDOW_PROTOCOL='(if .shell == "xwayland" then "X11" else "wayland" end)'
WINDOW_GEOMETRY='(.rect | "\(.x),\(.y) \(.width)x\(.height) ")'
WINDOW_PID='(.pid | tostring)'
# Output format, e.g. "1234 - 12:firefox (wayland)" or "5678 - 17:discord (X11)"
FORMAT="$WINDOW_PID + \" - \" + $ID_PREFIX + $WINDOW_NAME + \" (\" + $WINDOW_PROTOCOL + \")\""
FILT="$ALL_NODES | $WINDOW_GEOMETRY + $FORMAT"
function getprop() {
typeset -A views
local selected
while read POS GEOM INFO; do
views["$POS $GEOM"]="$INFO"
done
selected="$(printf "%s\n" "${!views[@]}" | slurp)"
if [[ -n "$selected" ]]; then
printf '%s\n' "${views[${selected}]}"
fi
}
if [[ "$1" == "wait" ]]; then
swaymsg -t subscribe '["workspace"]' | jq -r ".current | $FILT" | getprop
else
swaymsg -t get_tree | jq -r "$FILT" | getprop
fi
---------------------------------------------------------------------
$HOME/.local/bin/flux
---------------------------------------------------------------------
#!/bin/sh
wlsunset -l 27.7 -L 85.3
----------------------------------------------------------------------
Comments
Post a Comment