diff --git a/config/shared/foot/foot.ini b/config/shared/foot/foot.ini new file mode 100644 index 0000000..ea3bc9b --- /dev/null +++ b/config/shared/foot/foot.ini @@ -0,0 +1,16 @@ +font=monospace:size=10 +pad=4x0 +[key-bindings] +# scrollback-up-page=Shift+Page_Up Shift+KP_Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down Shift+KP_Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# scrollback-home=none +# scrollback-end=none +clipboard-copy=Control+c XF86Copy +clipboard-paste=Control+v XF86Paste + +[text-bindings] +\x03=Mod4+c diff --git a/config/shared/window-tagger/contents/code/main.js b/config/shared/window-tagger/contents/code/main.js new file mode 100644 index 0000000..3fd6c19 --- /dev/null +++ b/config/shared/window-tagger/contents/code/main.js @@ -0,0 +1,68 @@ +const version = "v11" +//console.info("WINDOW TAGGER STARTED - " + version) + +const windows = Array.from({length: 9}, () => null) + +for (let i = 0; i < 9; i++) { + registerShortcut( + `TagWindow${i+1}`, + `Tag current window to tag ${i+1}`, + `Meta+Shift+${i+1}`, + function() { + try { + //console.info(`Trying to tag at ${i+1}`) + if (!workspace.activeWindow) { + //console.info("No active window to tag") + return + } + + //console.info(`Tag ${i+1}: ${workspace.activeWindow.caption}`) + for (let j = 0; j < 9; j++) { + if (windows[j] === workspace.activeWindow) { + windows[j] = null; + } + } + windows[i] = workspace.activeWindow + } catch (e) { + console.info(e) + } + } + ); + + registerShortcut( + `FocusWindow${i}`, + `Focus Window at tag ${i+1}`, + `Meta+${i+1}`, + function() { + try { + //console.info(`Total: ${windows.filter(w => w !== null).length}`) + windows.forEach(w => { + if (w) { + //console.info(`- ${w.caption}`) + } + }) + if (!windows[i]) { + //console.info("Tag is empty") + return + } + + if (windows[i] === workspace.activeWindow) { + windows[i].minimized = true + //console.info("Focusing already focused window") + return + } + + try { + workspace.activeWindow = windows[i] + } catch (error ) { + // console.info(windows[i].valid, windows[i].deleted) + // console.info("Error: ", error) + windows[i] = null + } + } catch (e) { + // console.info(e) + } + } + ); +} + diff --git a/config/shared/window-tagger/metadata.json b/config/shared/window-tagger/metadata.json new file mode 100644 index 0000000..fbb3261 --- /dev/null +++ b/config/shared/window-tagger/metadata.json @@ -0,0 +1,21 @@ +{ + "KPlugin": { + "Name": "Window Tagger", + "Description": "Tag windows with numbers and quickly switch between them", + "Icon": "preferences-system-windows", + + "Authors": [ + { + "Email": "username@gmail.com", + "Name": "Firstname Lastname" + } + ], + "Id": "window-tagger", + "Version": "1.0", + "License": "GPLv3", + "Website": "https://github.com/username/myscript" + }, + "X-Plasma-API": "javascript", + "X-Plasma-MainScript": "code/main.js", + "KPackageStructure": "KWin/Script" +} diff --git a/config/shared/window-tagger/path.txt b/config/shared/window-tagger/path.txt new file mode 100644 index 0000000..1a2819e --- /dev/null +++ b/config/shared/window-tagger/path.txt @@ -0,0 +1 @@ +/home/tomas/.local/share/kwin/scripts